| | |
CSS Version of this Javascript menu
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
CSS and JavaScript aren't interchangeable languages. They each are designed to do specific things. CSS is for styling the page, and JavaScript is for controlling your HTML dynamically (and for form validation).
CSS has some :hover effects that are similar to JavaScript's onMouseover, but you can't recreate a JS animation in CSS. The JavaScript looks fine, why do you need to change it?
CSS has some :hover effects that are similar to JavaScript's onMouseover, but you can't recreate a JS animation in CSS. The JavaScript looks fine, why do you need to change it?
Sure, it doesn't look very good compared to the JavaScript version though.
Here is a demo I made:
For the CSS :hover property to work in IE, you have to add a script to it (see the property on body -
You can download that file here. (packed JS IE CSS extension). Read about it here.
I made a demo of it here, but it may not be up some day if I remove it from my web hosting.
The CSS version of your menu is possible but not practical. I posted the code for reference.
Here is a demo I made:
index.html HTML Syntax (Toggle Plain Text)
<html> <head> <link rel="stylesheet" href="styles.css"/> </head> <body> <div id="menu"> <ul class="dropdown"> <li><a href="http://www.example.com">Test</a></li> <li><a href="http://www.daniweb.com">DaniWeb</a></li> <li><a href="http://www.blah.com">Blah</a></li> <li><a href="http://www.wurbo.com">Wurbo</a></li> <li><a href="http://www.spogg.com">Spogg</a></li> <li><a href="http://www.google.com">Google</a></li> <li><a href="http://www.yahoo.com">Yahoo</a></li> <li><a href="http://www.ubuntu.com">Ubuntu</a></li> <li><a href="http://www.w3schools.com">W3Schools</a></li> <li><a href="http://www.spogg.com/KnifeySpooney">KnifeySpooney</a></li> <li class="toggle">Toggle menu</li> </ul> </div> </body> </html>
styles.css CSS Syntax (Toggle Plain Text)
* { padding: 0; margin: 0; } body { behavior: url("csshover.htc"); text-align: center; } #menu { background-color: #D3D3D3; top: -205px; width: 200px; position: relative; margin: 0 auto; text-align: left; } #menu:hover { top: 0px; } .dropdown { width: 100%; } .dropdown li { padding-left: 3px; list-style: none; } .dropdown li:hover { background-color: #ADD8E6; } .dropdown li a { height: 20px; color: #000000; width: 100%; display: block; } .toggle { border-top: 1px solid black; margin-top: 4px; text-align: center; cursor: pointer; }
For the CSS :hover property to work in IE, you have to add a script to it (see the property on body -
behavior: url("csshover.htc"); )You can download that file here. (packed JS IE CSS extension). Read about it here.
I made a demo of it here, but it may not be up some day if I remove it from my web hosting.
The CSS version of your menu is possible but not practical. I posted the code for reference.
Last edited by itsjareds; May 16th, 2009 at 8:47 pm.
LIb,
Yes, it appears that you can establish styles in CSS but there are no instructions on how to do so. The Read Me file indicates that you should contact the author to find out how (email address provided). It is not clear why he chose not to include instructions with the distribution.
*** HOWEVER ***
I have managed to penetrate a rather convoluted system. This what to do:
Level 1
Styles that you will most likely want to change are already in CSS.
Level 2
If you need to change aspects that were not addressed by the Level 1 method, then there appears to be is a built-in mechanism for saving the code-generated stylesheet in editable form. I have not explored this in its entirety but the procedure appears to be as follows:
Of course, you may need to change the graphic so you will need to edit or create your own versions of image.bmp and clickhere.bmp(?) (in eg, Photoshop). I suggest working with copies of the original(s) rather than creating your own from scratch, at least to begin with.
I think that's about it. Good luck.
Airshow
Yes, it appears that you can establish styles in CSS but there are no instructions on how to do so. The Read Me file indicates that you should contact the author to find out how (email address provided). It is not clear why he chose not to include instructions with the distribution.
*** HOWEVER ***
I have managed to penetrate a rather convoluted system. This what to do:
Level 1
Styles that you will most likely want to change are already in CSS.
- Backup
demo.htm. - Open
demo.htmin your favourite text editor. - Edit any of the four styles in this file's style sheet to change the appearance of the menu.
- Save, then launch
demo.htmin your browser (etc. etc. until you are satisfied).
Level 2
If you need to change aspects that were not addressed by the Level 1 method, then there appears to be is a built-in mechanism for saving the code-generated stylesheet in editable form. I have not explored this in its entirety but the procedure appears to be as follows:
- Open the file
menuItems.js - Edit the line
design_mode:false, //...todesign_mode:true, //.....(but don't close the file yet). - View
demo.htmin your browser. - You will now see the demo page with the code-generated stylesheet overlaid.
- Right-click > select all, then copy to clipboard.
- Paste into the top of the stylesheet in demo.htm.
- In
menuItems.js(you didn't close it, remember?), edituser_defined_stylesheet:false, //...touser_defined_stylesheet:true, //... - Edit the line
design_mode:true, //...back todesign_mode:false, //.....
Of course, you may need to change the graphic so you will need to edit or create your own versions of image.bmp and clickhere.bmp(?) (in eg, Photoshop). I suggest working with copies of the original(s) rather than creating your own from scratch, at least to begin with.
I think that's about it. Good luck.
Airshow
![]() |
Similar Threads
- how to prevent javascript menu from getting hidden under flash movies (JavaScript / DHTML / AJAX)
- Javascript+css menu incompatible (JavaScript / DHTML / AJAX)
- designer seeking help with javascript menu (JavaScript / DHTML / AJAX)
- JavaScript Menu + vBulletin = Help! (JavaScript / DHTML / AJAX)
- Help with JavaScript Menu (JavaScript / DHTML / AJAX)
- DHTML & Javascript menu - trouble with z-index (JavaScript / DHTML / AJAX)
- Javascript menu blocked by browser what can I do for alternative (JavaScript / DHTML / AJAX)
- how to use a javascript menu in asp.net (ASP.NET)
Other Threads in the HTML and CSS Forum
- Previous Thread: Which is the best templating system
- Next Thread: HTML Post problem
| Thread Tools | Search this Thread |
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash form format google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization pnginie6 positioning problem scroll seo shopping studio swf swf. textcolor timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7





