mpjx
08-07-2008, 05:33 PM
1) Script Title: Chrome CSS Drop Down Menu (v2.4)
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/chrome/index.htm
3) Describe problem:
Hi all, I really could use some help with this script. First, a link to the problem page:
http://jali.hostedapps.co.uk/main.cfm
The Chrome CSS Drop Down is the beige top menu "Home", "Jali Designer", "Products", etc. I modified the unordered list part of the html in order to accommodate image replacement of text links. (This works fine and I'll happily share the code if anyone's interested.)
The problem is with the positioning of the dropdowns. As you can see from the code below, the structure of the html is "main" div which is relative positioned with "auto" margins to centre the page in the browser window. "main" div contains "menu" div, which contains "leftMenu" div and "rightMenu" div. The "dropmenu" divs are below "menu", "leftMenu" and "rightMenu" but within "main".
chrome.js calculates the position to display each dropdown from the edges of the browser window. Unfortunately when the absolute positioned dropdowns are displayed, they are positioned relative to "main" div, not the browser window. This means they're offset by whatever left margin has been displayed (and which varies according to the width of the browser window). They're also offset on vertically by the top margin of "main" div.
The ideal solution would be if getposOffset:function in chrome.js could be rewritten to get the offset relative to the "main" div parent element. Has anyone done this? I saw an old post with code for the 2.01 version which claimed to do exactly this - but it doesn't work.
Any help greatfully appreciated. Thanks.
Here's the code:
<div id="main">
.
.
.
.
<div id="menu">
<div id="leftMenu">
<div id="menu-home"><a href="/main.cfm">Home</a></div>
<div id="menu-jaliDesigner"><a href="/jdSubMenu/whatIsIt.cfm" rel="dropmenu1">Jali Designer</a></div>
<div id="menu-products"><a href="/products/jaliDesignerClass.cfm" rel="dropmenu2">Products</a></div>
<div id="menu-howTo"><a href="/howto/tellmein60seconds.cfm" rel="dropmenu3">How to…</a></div>
<div id="menu-designIdeas"><a href="/designIdeas/showcase.cfm" rel="dropmenu4">Design Ideas</a></div>
<div id="menu-aboutJali"><a href="/aboutUs/about.cfm" rel="dropmenu5">About Jali</a></div>
</div><!--end of leftMenu div-->
<div id="rightMenu">
<div id="menu-myWork"><a href="/account/" rel="dropmenu6">My Work</a></div>
<div id="menu-signOut"><a href="/login/?page=3">Sign Out</a></div>
</div><!--end of rightMenu div-->
</div><!--END OF MENU DIV -->
<!--BEGINNING OF DROPT DOWN MENUS-->
<div id="dropmenu1" class="dropmenudiv">
<a href="/jdSubMenu/whatIsIt.cfm">What is the Jali Designer?</a>
<a href="/products/jaliDesignerClass.cfm">Start designing!</a>
</div>
<div id="dropmenu2" class="dropmenudiv">
<a href="/products/furniture/furniture.cfm">Furniture</a>
<a href="/products/architectural/architectural.cfm">Architectural components</a>
<a href="/products/diy/diy.cfm">DIY shapes</a>
</div>
.
.
.
.
</div><!--end of MAIN div-->
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/chrome/index.htm
3) Describe problem:
Hi all, I really could use some help with this script. First, a link to the problem page:
http://jali.hostedapps.co.uk/main.cfm
The Chrome CSS Drop Down is the beige top menu "Home", "Jali Designer", "Products", etc. I modified the unordered list part of the html in order to accommodate image replacement of text links. (This works fine and I'll happily share the code if anyone's interested.)
The problem is with the positioning of the dropdowns. As you can see from the code below, the structure of the html is "main" div which is relative positioned with "auto" margins to centre the page in the browser window. "main" div contains "menu" div, which contains "leftMenu" div and "rightMenu" div. The "dropmenu" divs are below "menu", "leftMenu" and "rightMenu" but within "main".
chrome.js calculates the position to display each dropdown from the edges of the browser window. Unfortunately when the absolute positioned dropdowns are displayed, they are positioned relative to "main" div, not the browser window. This means they're offset by whatever left margin has been displayed (and which varies according to the width of the browser window). They're also offset on vertically by the top margin of "main" div.
The ideal solution would be if getposOffset:function in chrome.js could be rewritten to get the offset relative to the "main" div parent element. Has anyone done this? I saw an old post with code for the 2.01 version which claimed to do exactly this - but it doesn't work.
Any help greatfully appreciated. Thanks.
Here's the code:
<div id="main">
.
.
.
.
<div id="menu">
<div id="leftMenu">
<div id="menu-home"><a href="/main.cfm">Home</a></div>
<div id="menu-jaliDesigner"><a href="/jdSubMenu/whatIsIt.cfm" rel="dropmenu1">Jali Designer</a></div>
<div id="menu-products"><a href="/products/jaliDesignerClass.cfm" rel="dropmenu2">Products</a></div>
<div id="menu-howTo"><a href="/howto/tellmein60seconds.cfm" rel="dropmenu3">How to…</a></div>
<div id="menu-designIdeas"><a href="/designIdeas/showcase.cfm" rel="dropmenu4">Design Ideas</a></div>
<div id="menu-aboutJali"><a href="/aboutUs/about.cfm" rel="dropmenu5">About Jali</a></div>
</div><!--end of leftMenu div-->
<div id="rightMenu">
<div id="menu-myWork"><a href="/account/" rel="dropmenu6">My Work</a></div>
<div id="menu-signOut"><a href="/login/?page=3">Sign Out</a></div>
</div><!--end of rightMenu div-->
</div><!--END OF MENU DIV -->
<!--BEGINNING OF DROPT DOWN MENUS-->
<div id="dropmenu1" class="dropmenudiv">
<a href="/jdSubMenu/whatIsIt.cfm">What is the Jali Designer?</a>
<a href="/products/jaliDesignerClass.cfm">Start designing!</a>
</div>
<div id="dropmenu2" class="dropmenudiv">
<a href="/products/furniture/furniture.cfm">Furniture</a>
<a href="/products/architectural/architectural.cfm">Architectural components</a>
<a href="/products/diy/diy.cfm">DIY shapes</a>
</div>
.
.
.
.
</div><!--end of MAIN div-->