Scroll spy Plugin

Support Area Forums Moonrise Scroll spy Plugin

This topic contains 5 replies, has 2 voices, and was last updated by  Bill Robbins 1 year, 1 month ago.

Viewing 6 posts - 1 through 6 (of 6 total)
URL to the page in question: http://
  • Author
    Posts
  • #37921

    Dare Adelugba
    Participant

    Hi Bill,

    Is the scroll spy compatible with this theme or any of the themes? I am trying to make a one-page website but not sure if I can integrate the plugin with the theme.

    Thank you,
    Dare

    #37923

    Bill Robbins
    Moderator

    Good Morning Dare,

    You could probably do that. Moonrise does have a smooth scrolling to same page links built in, so you would need to remove that. It’s this section in the custom-js.php file:

    
    // Smooth Scrolling 
    	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 - 100
    	        }, 1000);
    	        return false;
    	      }
    	    }
    	  });
    	});
    

    It looks like in the documentation at http://www.w3schools.com/bootstrap/bootstrap_scrollspy.asp that will need to be some changes to the body tag in the header.php file. You’ll also need to create a file for the scrollspy plugin’s file and add it to the theme. From there you can load it up like the other javascript is in the scripts.php file.

    It’s not something that I’ve tried with Moonrise so it may or may not work, but that’s roughly how to get started there.

    Take care,
    Bill

    #37928

    Dare Adelugba
    Participant

    Hi Bill,

    I hope I am not double-posting. I posted earlier but I may not have pressed the submit button.

    Perhaps my question should’ve been if it’s possible to update/highlight a fixed menu as you scroll down vertically.

    I like the “smooth scrolling” feature so I want to keep it but would be nice to know if I can add the elements of the scrollspy without removing the smooth scrolling js file.

    Thank you,
    Dare

    #37929

    Bill Robbins
    Moderator

    You’re all good on posting. Sorry if the earlier reply did not make it through.

    You may be able to keep the smooth scrolling with the scrollspy plugin. I would probably disable the smooth scrolling while setting up the scrollspy to cut down on potential conflicts. Then add it back in once the scrollspy works as you want it too. If it works then, you’ll be in good shape.

    #37931

    Dare Adelugba
    Participant

    Sounds good. I’ll will keep you posted. Thank you.

    #37932

    Bill Robbins
    Moderator

    Anytime

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Scroll spy Plugin’ is closed to new replies.