PDA

View Full Version : Responsive Side Toggle Menu fixed and no Javascript on wide screens



green
02-23-2018, 11:03 AM
1) Script Title: Responsive Side Toggle Menu

2) Script URL (on DD): http://dynamicdrive.com/dynamicindex1/sidetogglemenu.htm

3) Describe problem: I've been using the Responsive Side Toggle Menu for some time and it works fine. It is set to open on page load in screens over 680 px and has no toggle button. Under 680px the hamburger menu kicks in.


<script>
jQuery(function(){
menu1 = new sidetogglemenu({
id: 'togglemenu1',
marginoffset: 10,
position: 'left'
})
if (window.innerWidth > 680)
menu1.toggle();
})
</script>

However, I'm having issues with page load times according to Google Analytics and I read that Javascript shouldn't be used for "core operations" like depending on it for opening menu on page load. I have also noticed that by default many iPads do not use Javascript so my sidebar menu does not open at all on these devices.

My question is whether the sidebar menu can be set to be open on screens over 680px as a simple fixed div (with own vertical scroll bar as menu is long) with NO call on Javascript at all (eg. slide in effect) - in other words, just CSS. I don't need the toggle feature on the wider screens. Screens <680 would be responsive with the hamburger.

Perhaps I chose the wrong responsive menu type from the beginning but as there are many pages to my site, changing to another menu type now might be very laborious.

Thanks for any help you can provide.

Mike

Deadweight
02-23-2018, 03:20 PM
Actually, all browsers usually used JavaScript. Unless they, the uses, have it disabled. The probably is actually how browsers and OS read the JavaScript. However, I am currently at work but once I get home Ill take a look into it unless someone beats me to it (which is fine).

green
02-24-2018, 08:08 AM
Just to say, Thanks for taking this up. I haven't gone away, Deadweight (or illustrious colleagues at DD), and am keen to implement your solutions.