Can anyone give me a script for a drop down menu that doesnot causes the whole page to push down...
Can anyone give me a script for a drop down menu that doesnot causes the whole page to push down...
gptsven, thank you for the dynamic drive link! it rocks! :D
Two rules of development:
1) Computers work for people; People do not work for computers
2) Maintainability is all that matters.
all you need to do is position:absolute; a DIV and then use top:; and left:; to place it.
It won't push the page down.
If you find my post useful please add to my reputation by clicking the +Rep button
You may also use the Donate link to donate credits - this is appreciated tooThanks to those whom have donated so far!
thanks vol7ron and gptsven
not sure i helped at all, but using javascript but here's a quick example I'll code up showing how you can get an element's position with javascript:
HTML Code:<div id="menuID" style="background:#f00; color:#fff; border:1px solid black; width:15em; position:absolute; z-index:10;" onmouseover="elem=getElementById('submenuID'); elem.style.top=this.offsetTop + this.offsetHeight + 1 + 'px'; elem.style.display='block';" > This is your menu </div> <div id="submenuID" style="background:#f03333; color:#fff; border:1px solid black; width:15em; position:absolute; z-index:10; display:none;" onmouseover="this.style.background='#00f';" onmouseout="this.style.display='none';" > This is your submenu </div>
Last edited by vol7ron; 12-11-2008 at 08:28 AM.
If you find my post useful please add to my reputation by clicking the +Rep button
You may also use the Donate link to donate credits - this is appreciated tooThanks to those whom have donated so far!
http://www.dynamicdrive.com/dynamici...edcollapse.htm
The link above is from the dynamicdrive page mentioned by gptsven. I created the html and downloaded the javascript and it works great!
Two rules of development:
1) Computers work for people; People do not work for computers
2) Maintainability is all that matters.
I have always found this site excellent when trying to create good css techniques - including drop-down menus - which it does for you.
www.cssplay.co.uk
both sites nice, however not really a fan of cssplay. good demonstrations, some errors, but they don't make it so easy to build your own.
as for dynamic drive, i remember using them a long time ago (around y2k) when DHTML was really popular.
If you find my post useful please add to my reputation by clicking the +Rep button
You may also use the Donate link to donate credits - this is appreciated tooThanks to those whom have donated so far!
I prefer pure css solutions in case JS isn't enabled (which 95% of the time it is).
A word of warning though with css styling - IE6!
very simply a big pain and you need to (or should) build in bug fixes for IE.
If you only have browsers using firefox/chrome/opera/anything else - no need to worry!
Edit:
There is a part of cssplay that builds them for you
http://www.cssplay.co.uk/menus/menu_builder_flyout.html
Last edited by freecrm; 12-12-2008 at 11:19 AM. Reason: Automerged Doublepost