Dynamic One Page Navigation
-
Hi. I am real amature and I am trying right now for few hours already figured out how to set up Dynamic One Page Navigation. I was using this tutorial
https://premium.wpmudev.org/blog/twenty-seventeen-wordpress-theme/
and then second part of the tutorial:
https://premium.wpmudev.org/blog/five-hacks-twenty-seventeen/#dynamicSo I created custom menu links using IDs. (“Slu?by” and “Nabízíme”).
I download plugin “Custom Code CSS & JS” > “Add custom JS file” > I copy the code from tutorial:
“/*
One page nav code
*/jQuery( document ).ready(function(){
/* Add padding and id’s to each front page section */
jQuery( “h2.entry-title” ).each( function() {
var panelId = jQuery( this ).html().toLowerCase().replace(/\s+/g, “-“);
jQuery( this ).wrapInner(function() {
return “<span style=’padding-top:96px;’ id='” + panelId + “‘></span>”;
})
})/* Remove navigation link highlighting */
jQuery(‘#top-menu li’).removeClass(‘current-menu-item current_page_item ‘);/* Add highlighting on click */
jQuery(‘#top-menu li a’).on(‘click’, function(event) {
jQuery(this).parent().parent().find(‘li’).removeClass(‘current-menu-item’);
jQuery(this).parent().addClass(‘current-menu-item’);
});/* Check current URL and highlight nav for current page */
jQuery(‘#top-menu li a’).each( function() {
var pageUrl = jQuery( location ).attr( ‘href’ );
var navUrl = jQuery( this ).attr( ‘href’ );
if ( navUrl == pageUrl ) {
jQuery( this ).parent().addClass(‘current-menu-item’);
}
})
})”Did it installed to Child Theme I have? I hope so. I don’t know how to check that out. I need to have it in Child Theme in case of Themes updates. I dont want to lose it all.
It start working, but its not scrolling to the part I need. It just jump there.In the tutorial they also say to download plugin “jQuery Smooth Scroll”. I did that and nothing change” I only got arrow at the bottom of the page to go back up.
I am really sorry for my stupid questions, but I love how that page looks with “Dynamic One Page Navigation” and I would really like to learn how to do it myself. Thank you so much.
- This topic was modified 6 years, 10 months ago by .
- This topic was modified 6 years, 10 months ago by .
The page I need help with: [log in to see the link]
- The topic ‘Dynamic One Page Navigation’ is closed to new replies.