PDA

View Full Version : Force loading of the Smooth Navigational Menu?



Bluesplayer
01-05-2010, 10:46 AM
1) Script Title: Smooth Navigational Menu

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

3) Describe problem: I have a wibiya toolbar on my site and I notice that should the toolbar be slow to load then the Smooth Nav Menu won't either. It only loads after the toolbar does. Is there a way to make sure the menu loads regardless of the condition of the toolbar?

jscheuer1
01-06-2010, 06:53 AM
If you place this sort of thing:


<script type="text/javascript">

ddsmoothmenu.init({
mainmenuid: "smoothmenu1", //menu DIV id
orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
classname: 'ddsmoothmenu', //class added to menu's outer DIV
//customtheme: ["#1c5a80", "#18374a"],
contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})

ddsmoothmenu.init({
mainmenuid: "smoothmenu2", //Menu DIV id
orientation: 'v', //Horizontal or vertical menu: Set to "h" or "v"
classname: 'ddsmoothmenu-v', //class added to menu's outer DIV
//customtheme: ["#804000", "#482400"],
contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})

</script>

as the very last thing before your closing </body> tag, you should be able to edit the ddsmoothmenu.js file here (near the end):


init:function(setting){
if (typeof setting.customtheme=="object" && setting.customtheme.length==2){ //override default menu colors (default/hover) with custom set?
var mainmenuid='#'+setting.mainmenuid
var mainselector=(setting.orientation=="v")? mainmenuid : mainmenuid+', '+mainmenuid
document.write('<style type="text/css">\n'
+mainselector+' ul li a {background:'+setting.customtheme[0]+';}\n'
+mainmenuid+' ul li a:hover {background:'+setting.customtheme[1]+';}\n'
+'</style>')
}
this.shadow.enable=(document.all && !window.XMLHttpRequest)? false : this.shadow.enable //in IE6, always disable shadow
jQuery(document).ready(function($){ //ajax menu?
if (typeof setting.contentsource=="object"){ //if external ajax menu
ddsmoothmenu.getajaxmenu($, setting)
}
else{ //else if markup menu
ddsmoothmenu.buildmenu($, setting)
}
})
}

} //end ddsmoothmenu variable

to:


init:function(setting){
if (typeof setting.customtheme=="object" && setting.customtheme.length==2){ //override default menu colors (default/hover) with custom set?
var mainmenuid='#'+setting.mainmenuid
var mainselector=(setting.orientation=="v")? mainmenuid : mainmenuid+', '+mainmenuid
document.write('<style type="text/css">\n'
+mainselector+' ul li a {background:'+setting.customtheme[0]+';}\n'
+mainmenuid+' ul li a:hover {background:'+setting.customtheme[1]+';}\n'
+'</style>')
}
this.shadow.enable=(document.all && !window.XMLHttpRequest)? false : this.shadow.enable //in IE6, always disable shadow
;(function($){ //ajax menu?
if (typeof setting.contentsource=="object"){ //if external ajax menu
ddsmoothmenu.getajaxmenu($, setting)
}
else{ //else if markup menu
ddsmoothmenu.buildmenu($, setting)
}
})(jQuery);
}

} //end ddsmoothmenu variable

This might do what you want. If not, I would probably need a link to your page:

Please post a link to the page on your site that contains the problematic code so we can check it out.

Bluesplayer
01-08-2010, 05:56 PM
Thanks for that code. I also asked for info at wibiya and they told me to alter a switch in my control panel with them that has helped a lot. Haven't used your code yet but if there is a recurrence of the problem I will try it then.