PDA

View Full Version : Resolved Responsive Side Toggle Menu Reversed



adaml_ipa
03-24-2014, 01:36 PM
1) Script Title: Responsive Side Toggle Menu

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

3) Describe problem: The code is brilliant and works beautifully, but what I'd like to do is reverse the code so that the menu is visible by default and then can be minimized/closed, rather than the original way of closed then opening.

I was trying to tweak the default variables in slidetogglemenu.js, such as curstate: 'open' and visibility: 'visible'. This allowed the menu container to be visible, but I couldn't see any content until I minimized and reopened the menu. What other lines in the code do I need to change to get this working?

Thanks!

Deadweight
03-24-2014, 04:50 PM
In the JS file change


var defaults = {
position: 'left',
pushcontent: true,
source: 'inline',
revealamt: 0,
marginoffset: 0,
dismissonclick: true,
curstate: 'closed'
}
to


var defaults = {
position: 'left',
pushcontent: true,
source: 'inline',
revealamt: 0,
marginoffset: 0,
dismissonclick: true,
curstate: 'open'
}

adaml_ipa
03-24-2014, 05:06 PM
Hi Deadweight...

Thanks for the reply. I've actually already tried this and although the "container" is open when the page loads, it is blank. There is no text or other content visible until I click on the button to close the menu and then again to open it. Is there another section of code in the JS file that needs to be edited?

Deadweight
03-24-2014, 05:34 PM
Sorry, I had a bit of a brain fart. The most simple way of actually doing this:


jQuery(function(){ // on DOM load
menu1 = new sidetogglemenu({ // initialize first menu example
id: 'togglemenu1',
marginoffset: 10
})
menu1.toggle();
})
Leave everything else the same. That also means switch back:


var defaults = {
position: 'left',
pushcontent: true,
source: 'inline',
revealamt: 0,
marginoffset: 0,
dismissonclick: true,
curstate: 'closed'
}

Enjoy

adaml_ipa
03-25-2014, 05:03 PM
Deadweight...Thank you so much for the time and effort in helping me out! It worked perfectly!

Deadweight
03-25-2014, 07:53 PM
No problem, if that is all just remember to resolve your thread:
Resolving your thread: First Post: => EDIT => Lower right: => GO ADVANCED => Top Advance Editor drop down: => PREFIX:Resolved