Scroll spy Plugin
URL to the page in question:
http://
-
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
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
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
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.
Sounds good. I’ll will keep you posted. Thank you.
- The topic ‘Scroll spy Plugin’ is closed to new replies.