Log in

View Full Version : Help With -Nested Side Bar Menu



Jimmy506
05-05-2011, 04:40 AM
Hi... any help is appreciated-

When I decrease the width of the "Nested Side Bar Menu", white space appears between it and the fly-out sub menus. Can anyone tell me how to close the gap?

http://www.dynamicdrive.com/style/csslibrary/item/nested_side_bar_menu/P20/

I changed the width in the CSS:

.sidebarmenu ul {
width: 180px;

Thanks,
Jimmy

Jimmy506
05-05-2011, 04:43 PM
Ok, I got that problem sorted out... found the submenu css.

Could anyone tell me how I could make the submenus fly-out to the left?
I moved my sidebar to the right side of the page.

Is it in the javascript?
<script type="text/javascript">

//Nested Side Bar Menu (Mar 20th, 09)
//By Dynamic Drive: http://www.dynamicdrive.com/style/

var menuids=["sidebarmenu1"] //Enter id(s) of each Side Bar Menu's main UL, separated by commas

function initsidebarmenu(){
for (var i=0; i<menuids.length; i++){
var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
for (var t=0; t<ultags.length; t++){
ultags[t].parentNode.getElementsByTagName("a")[0].className+=" subfolderstyle"
if (ultags[t].parentNode.parentNode.id==menuids[i]) //if this is a first level submenu
ultags[t].style.left=ultags[t].parentNode.offsetWidth+"px" //dynamically position first level submenus to be width of main menu item
else //else if this is a sub level submenu (ul)
ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" //position menu to the right of menu item that activated it
ultags[t].parentNode.onmouseover=function(){
this.getElementsByTagName("ul")[0].style.display="block"
}
ultags[t].parentNode.onmouseout=function(){
this.getElementsByTagName("ul")[0].style.display="none"
}
}
for (var t=ultags.length-1; t>-1; t--){ //loop through all sub menus again, and use "display:none" to hide menus (to prevent possible page scrollbars
ultags[t].style.visibility="visible"
ultags[t].style.display="none"
}
}
}

if (window.addEventListener)
window.addEventListener("load", initsidebarmenu, false)
else if (window.attachEvent)
window.attachEvent("onload", initsidebarmenu)

</script>

deathbycheese
05-05-2011, 08:14 PM
Hi Jimmy,

It's here:



ultags[t].style.left=ultags[t].parentNode.offsetWidth+"px" //dynamically position first level submenus to be width of main menu item
else //else if this is a sub level submenu (ul)
ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" //position menu to the right of menu item that activated it


Just change "left" to "right".

dbc

Jimmy506
05-05-2011, 09:08 PM
Thanks very much for the help!

Any idea how I can get the arrow to the left of the titles now. -submenus are now flying out to the left like I wanted, but I need the bullet in front of the text now...

Thanks,
Jimmy

deathbycheese
05-05-2011, 11:19 PM
It's here in your CSS:



.sidebarmenu a.subfolderstyle{
background: url(right.gif) no-repeat 97% 50%;
}


Just change the percentage until it's where you want it. BUT, you'll need to flip the image so it's pointing the other way.


dbc



------------------------------------------------------------
If this is helpful, please don't forget to click the 'thank' button!

Jimmy506
05-06-2011, 12:51 AM
Great- DeathByCheese!

That's Awesome!

Thanks very much for all your help today!

Jimmy

deathbycheese
05-06-2011, 03:00 AM
Your welcome Jimmy.
This forum has been such a help to me, it's nice to be able to give back a little. :)

dbc








-----------------------------------------------------
If this is helpful, remember to click the 'thanks' button!

Dino77
09-20-2011, 07:20 AM
Wanna thank you personally, DeathByCheese! your code was very helpful to my submenu. i was finally able to move it