Active
Project:
Megamenu
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
26 Aug 2010 at 20:00 UTC
Updated:
20 Nov 2012 at 12:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
mbiddlecombe commentedA further comment...
it seems like the left position value is only calculated if the bin goes beyond the edge of the window, otherwise it defaults to zero. I think for centred fixed width sites, the bin should be always be within the wrapper and not just the window.
Perhaps there could be a way to shift the bin left if it goes beyond the right edge of the wrapper. If this could be done programmatically, a fixed width pixel value could be entered into the admin screen.
Comment #2
sittard commentedAlso if you have added padding/margin to a wide bin then you might end up with a horizontal scroll bar on your site. I think the screen width offset needs to be a bit more generous and as suggested above it might be useful if it was programmatic or if the bin was more centered.
As a temporary suggestion I changed line 163 of megamenu.js to:
Which moves the whole bin 40 pixels further away from the window edge.
Comment #3
Anonymous (not verified) commentedComment #4
JimNastic commentedHi,
I tried something similar..
My container width is 960px and my menu is at the right hand side.
If the bin is narrow enough to stay within my "container" div, I want it not to spill outside the container. I made the following hack to the js file at line 162 to keep the menu aligned with the right hand edge. I havent tested much yet but so far, so good.
Comment #5
Stacy Prendeville commentedHi - I too am having issue with the width of the drop down, I would like it to be constrained with the 960 Width container so that it is not outside of the web design. I have tried to implement your code but its not working for me, I have attached a screen shot of the issue, is this a JS issue or something I can resolve within the CSS?
Anyone any ideas?
Thankyou
Comment #6
Anonymous (not verified) commentedThis is both a JS and a CSS issue. On the CSS side, slots are given a fixed width. On the JS side, bin widths and positions are calculated based on the slots they contain.
What JimNastic is doing is using 960px as the edge instead of the browser window. This would be a good candidate for a configurable parameter.
The line numbers for the above hack may have changed since the new release.
Comment #7
JimNastic commentedHi Stacy925
I have attached a screenshot of my site with the megamenu within 960px. You can see it live here: www.pensionen-mit-charme.de. The code I have used is quite an ugly hack of the megamenu module. After looking at your screenshot, I think maybe the reason my hack does not work for your site is that perhaps the megamenu popup area (i.e. "bin") is wider than 960px. As a test, why not remove or hide one of the 2nd level menu items or "slots" (e.g. hide "Seville Province")
Also, here is my css, adapted from the skin included within the module:
I hope this is helpful
regards,
jim
Comment #8
Stacy Prendeville commentedThanks for your comments! :-)
Comment #9
Stacy Prendeville commentedJimNastic - I have checked the bin width, in total it is less than 960 px - the width of the whole nav bar is 960 and on some drop downs I only have a few elements but the issue still occurs - I am still having strange results!!!
I have attached two screenshots, some of them have worked and are aligning to the right, others not? Seems very strange! Is there something I need to amend for my menu??? Is this something to do with the calculations in the JS? Sorry I cannot code at all so I am a bit clueless really...
Thanks
NB - Is this a lot of work for you? do you need to charge? Let me know
Comment #10
JimNastic commentedHi Stacy,
I'm happy to help as much as I can. The problem is I'm really just winging it myself as well. Based on the screenshots, I haven't really got any suggestions. I know it will be difficult to understand, but I would recommend using some debugging tools to track through the javascript and see what is happening. If you are using firefox browser, then install a plug in called firebug.
Here are some steps:
* Open firebug
* Select the "scripts" tab
* use the pull down menu to find the megamenu.js file
* Scroll down to find the section of code you have modified (around line 162)
* In the left you can see each line of code is numbered. When you click on a number you create a "breakpoint". This means that the browser will pause executing the code. It is like freezing the program so you can inspect what it is up to half way through running.
* Place a breakpoint next to the first bit of modified code "if EdgeOverlap...."
* Refresh the page
* Hover the mouse over the various variables in the code and you can see their current value
* Then you can instruct the brower (firebug) to step through the code one line at a time and you can see how the variables change values. You do this by pressing the little arrow. There is also a green play button which is like asking the program to run again until it gets to the end or hits another breakpoint
I know this is a steep learning curve, but I cant suggest much else. Why not give it a try and come back here when you have more questions.
Good luck!
Jim
Comment #11
Anonymous (not verified) commentedThis is an interesting issue. 960 compatibility is going to be a priority item after beta.
Comment #12
jtchem commentedOK - this is more of an "I just got lucky in my implementation" workaround - but, maybe it could be of use to someone else...
in the megamenu.js file, within the function megamenu_sizer() I replaced the lines:
with the following:
this just happened to work for us with the numbers of items we have in our pull down menus.
basically, if there is more than 5 top level items in a pull down, I get a width of 525; if there is 3 or 4 top level items, I get a width of 250, and anything else defaults to 250 at this point.
Hope this can help someone
You can see it in action here
Comment #13
volocuga commentedJim's hack (#4) working for me. Code lines were changed in dev from 2011-Feb-09 (I think this dev=6.x-2.0-beta1)
I attached patched megamenu.js below
Comment #14
volocuga commentedComment #15
akshita commentedHi
I have insatlled mega menu module on OpenPublic drupal 7.
Can you please upload the skin you have used.
Thanks
Revathi
Comment #16
akshita commentedCan you please upload the skin you have used(megamenu-skin-coa)
Thanks
Revathi Gajula
Comment #17
akshita commentedCan you please help me with the slot height. white space between the items due to height.
Comment #18
Anonymous (not verified) commentedComment #19
akshita commentedCan you please respond to #17 (related to megamenu issue).
Comment #20
Anonymous (not verified) commentedAkshita, please create a new issue and include the markup of the mega menu along with your CSS as attachments.
Comment #21
jepster_my megamenu works fine with all important browsers without js (for example ie 7 - ie9). only with css. with js the position of the item, which is closest to the border, is wrong calculated and the item is not directly under the main-item (vertical navigation).
So I've done a workaroung in my page.tpl.php:
May someone uses a better idea, which is simple to implement, without using a unstable dev-version.
Comment #22
parasolx commentedThanks JimNastic for your hack at #4.. it works for me..
Look alike a lot of modification done through JS and CSS to make last edge does not overlap with menus. Can feature request to put width or max-width of area these fabulous mega menu fit in?