Skip to content

Instantly share code, notes, and snippets.

@kezzbracey
Created June 30, 2015 02:16
Show Gist options
  • Save kezzbracey/b421ad18c536c1de075d to your computer and use it in GitHub Desktop.
Save kezzbracey/b421ad18c536c1de075d to your computer and use it in GitHub Desktop.
Menu fix
<!-- In "mainmenu.php" find this code on line 7 -->
<script type="text/javascript">
jQuery(document).ready( function(){
jQuery( '.mainmenuselect' ).change(function() {
window.location = jQuery(this).find( 'option:selected' ).val();
});
});
</script>
<!-- Add this line of code after line 8 -->
jQuery( '.mainmenuselect' ).find( 'option[value="' + window.location.href + '"]' ).prop('selected', true);
<!-- You should end up with this code: -->
<script type="text/javascript">
jQuery(document).ready( function(){
jQuery( '.mainmenuselect' ).find( 'option[value="' + window.location.href + '"]' ).prop('selected', true);
jQuery( '.mainmenuselect' ).change(function() {
window.location = jQuery(this).find( 'option:selected' ).val();
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment