Created
October 24, 2018 18:40
-
-
Save KustomDeveloper/08777f52357e31ad62af9b98a0b43684 to your computer and use it in GitHub Desktop.
Change menu links so they work with one page scrolling website
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php if( !is_front_page() ) { ?> | |
| <script> | |
| //Change links so they work if it is not the homepage | |
| var j = jQuery.noConflict(); | |
| j(function() { | |
| j('#menu-primary-menu li a').each(function() { | |
| var href = j(this).attr('href'), | |
| siteUrl = window.location.protocol + '//' + window.location.host + '/'; | |
| if (document.location.href.indexOf(href) === -1) { | |
| j(this).attr('href', siteUrl + href); | |
| } | |
| }); | |
| }); | |
| </script> | |
| <?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment