Mark Forums Read
  #1  
Old 04-07-2009, 10:28 AM
ajit22 ajit22 is offline
Member
 
Join Date: Jan 2009
Posts: 54
ajit22 is on a distinguished road
Default menu bar using css

Here is css souce code to create menu bar..
Code:
<style type="text/css"> #coolmenu{ border: 1px solid black; width: 170px; background-color: #E6E6E6; } #coolmenu a{ font: bold 13px Verdana; padding: 2px; padding-left: 4px; display: block; width: 100%; color: black; text-decoration: none; border-bottom: 1px solid black; } html>body #coolmenu a{ /*Non IE rule*/ width: auto; } #coolmenu a:hover{ background-color: black; color: white; } </style> <div id="coolmenu"> <a href="#">Link 1</a> <a href="#">Link 2</a> <a href="#">Link 3</a> <a href="#">Link 4</a> <a href="#">Link 5</a> </div>
__________________
New York Web design
Website design

Reply With Quote
 #Add to Ads's Reputation  
OldSponsored Ads
Ads AdsPromoter is online
Member
 
Join Date: LongTime
Posts: 1100
Ads is on a distinguished road
Default New Sponsored Ads



This message will go away once you are registered. Also, by registering, you will have access to all post topics, communicate privately with other members (PM), respond to polls, upload graphics, and access other special features! Registration is fast, simple and absolutely free so please Click Here to join our Web Hosting community today!
Reply With Quote
  #2  
Old 06-22-2009, 10:20 AM
gkumar gkumar is offline
Senior Member
 
Join Date: Jun 2009
Posts: 203
gkumar is on a distinguished road
Default menu bar using css

First I have created two css files and saved them as demo-menu-item.css and demo-menu-bar.css. They are based on the original menu-item.css and menu-bar.css which you will find inside the css_dhtmlsuite folder.

I have included these files by using the <link> attribute in the head section of this HTML file:

<link rel="stylesheet" href="css/demo-menu-item.css" media="screen" type="text/css">
<link rel="stylesheet" href="css/demo-menu-bar.css" media="screen" type="text/css">


If you open the css files menu-item.css and menu-bar.css, you will see that all classes starts with the "prefix" DHTMLSuite_. In the new css files, I want to use a custom prefix instead of "DHTMLSuite_". So I did a global search and replace in the new css files and replaced "DHTMLSuite_" with "Custom_".

Then I called two methods for the menuBar object in order to notify the script of the new css prefix:

menuBar.setMenuItemCssPrefix('Custom_');
menuBar.setCssPrefix('Custom_');


This is the entire js code for the menu bar you see above:

var menuModel = new DHTMLSuite.menuModel();
menuModel.addItemsFromMarkup('menuModel');
menuModel.setMainMenuGroupWidth(00);
menuModel.init();

var menuBar = new DHTMLSuite.menuBar();
menuBar.addMenuItems(menuModel);
menuBar.setMenuItemCssPrefix('Custom_');
menuBar.setCssPrefix('Custom_');
menuBar.setTarget('menuDiv');

menuBar.init();


File
View
Tools
An other way to define alternative css

There's also another way of doing this. The method described above is very useful if you want to have more than one menu on a page and with different styling(as we have here). If all your menus got the same styling, then you can follow a simpler procedure.

The first thing you do is to make a copy of menu-item.css and menu-bar.css and save them in the same folder as the originals(example: menu-item-2.css and menu-bar-2.css). Then make your changes to these two css files.(NB! You don't have to change the prefix of the css class when you're using this method).

The last thing you have to do is to make the menuBar object aware of these two css files:

menuBar.setCssLayout('menu-bar-2.css');
menuBar.setMenuItemLayoutCss('menu-item-2.css');


The script will load these two css files dynamically, so you don't have to include them by using <LINK> tags.
Reply With Quote
  #3  
Old 04-22-2010, 05:15 AM
chris34 chris34 is offline
Member
 
Join Date: Jan 2010
Location: U.K
Posts: 93
chris34 is on a distinguished road
Default

Thanks For sharing this Source Code With us,I Found it very useful for myself
Keep sharing such useful code with us........
__________________
Spam
Reply With Quote
 #Add to Ads's Reputation  
OldSponsored Ads
Ads AdsPromoter is online
Member
 
Join Date: LongTime
Location: Here
Posts: 1100
Ads is on a distinguished road
Default New Sponsored Ads



This message will go away once you are registered. Also, by registering, you will have access to all post topics, communicate privately with other members (PM), respond to polls, upload graphics, and access other special features! Registration is fast, simple and absolutely free so please Click Here to join our Web Hosting community today!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 12:57 PM.


Powered by vBulletin Version 3.6.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 2.4.0