Link in Home Block to move to the next Home Block

Support Area Forums Selfie Link in Home Block to move to the next Home Block

Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
URL to the page in question: http://www.attb.nl
  • Author
    Posts
  • #31057
    Avatar photoJeroen van Aerle
    Participant

    Dear Bill,

    Is there a way to create a link in the content of a Home block that (when clicked) will make the Home page move to display the next Home Block?

    Kind Regards,

    Jeroen

    #31059
    Bill Robbins
    Moderator

    Hello Jeroen,

    Good question there. You can do that. Each section of the home page has a unique ID that you could use to create a link. You’ll need to view the source of your front page to find the IDs to work with.

    In the home page of the demo, the first one is #block-9 and the second is #block-14. To link from the first to the second, I would add a link to the content of the first one that has #block-14 as the URL. Make sure to leave out the http:// before the URL.

    That should let you add links to the next section.

    Have a great weekend,
    Bill

    #31096
    Avatar photoJeroen van Aerle
    Participant

    Thanks Bill!

    I assumed it would be something like that, but I left out the #. Great Help!

    Is there a way to make the transition go smooth? Like how the Home Blocks bounce to each other when in between Blocks?

    Jeroen

    #31110
    Bill Robbins
    Moderator

    Jeroen,

    Glad that helped out. You can try a quick edit to see if the smooth scroll will work here for you. I haven’t tested it with Selfie, but I do use it several of our other themes.

    1. Go to the Appearance section in your WordPress dashboard and choose Edit.
    2. From the list of files on your right, choose custom-js.php
    3. Right before the closing:
      
      </script>
      

      add this:

      
      		jQuery(function($) {
      			$('a[href*=#]:not([href=#])').click(function() {
      				if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
      				
      				var target = $(this.hash);
      				target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
      					
      					if (target.length) {
      						$('html,body').animate({
      				  			scrollTop: target.offset().top - 0
      						}, 1000);
      					
      						return false;
      					}
      				
      				}
      			});
      		});
      
    4. Save your changes.

    See if that doesn’t make the scrolling a bit more smooth.

    Have a great week,
    Bill

    #31145
    Avatar photoJeroen van Aerle
    Participant

    Hi Bill,

    No need for further testing. Everything works perfect!

    Many thanks!

    #31146
    Bill Robbins
    Moderator

    Anytime. Have a great day Jeroen 🙂

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Link in Home Block to move to the next Home Block’ is closed to new replies.