Comments (5)
Have you tried changing the baseZIndex
used by Dropotron?
from jquery.dropotron.
Yes. The problem with this, is that when the dropmenu is detached from the nav, it is placed in an entirely different skel panel which is z-indexed "under" the nav panel, which is an overlay panel. Since the panels are entirely separate divs with z-index and positioning, z-index of the dropmenu will only affect elements within that panel. In other words, to have the dropmenu on top, I will have to z-index the page panel above the nav panel, effectively hiding the whole menu entirely. If I could control the detachment, it would solve the problem, is it possible to tell dropotron where in the DOM to attach itself?
from jquery.dropotron.
Not without modifying Dropotron itself, but if you're okay with that, this bit of code (line 534 of the unminified source) controls how that works:
// Detach the menu and move it to the end of the <body> element.
$menu
.detach()
.appendTo($body);
Changing $body
to a different element/selector (eg. $('#myelement')
) ought to do the trick.
from jquery.dropotron.
Thanks a million, problem solved! I actually elaborated a little bit and added a setting 'attachSelector' with default value 'body', then replaced the harcoded ('body') in line 97 with (settings.attachSelector). So now I can customize the attachment from the initializer, if needed, otherwise it will default to body as before.
I also figured out that it is the skel-panels framework that actually causes the problem, because it reorganizes things in the DOM after dropotron has been initialized. So my solution here was to append the dropotron to the #nav element and use a ul:not(.dropotron) css selector to avoid the main menu styling interfering with the dropotron css.
BTW, the project I am working on is customizing the TXT Starter Kit for Umbraco CMS, which I believe is originally your TXT by HTML5UP, right? However, the submenus are not implemented in the Starter Kit, and that is what I have accomplished now actually, thanks to your help:-)
Would you consider making my attachSelector setting an official part of the dropotron code? It would mean I don't have to synchronize any updates, and maybe someone else could even find use for it? (I'm thinking particularly of Umbraco and skel-panels users.)
from jquery.dropotron.
Sure, I'll look into doing that in the next release.
from jquery.dropotron.
Related Issues (20)
- Is there a way to make the dropdown work on ipad HOT 3
- Capture click event from dropdown HOT 2
- menuClass: 'dropotron' won't be added HOT 1
- Detach and cloneOnDetach break dropotron in iOS Safari HOT 1
- Add "active" class to ul
- Padding issue HOT 1
- Close Navbar on Page Scroll
- Scroll on dropDown
- Weird symbol when building the dropdown list on server side HOT 1
- skip submenu items HOT 2
- How to use a Login Form with Dropotron?
- NPM package?
- not working properly with anchors
- aria-expanded="true"
- images do not display HOT 2
- Long menu titles - wrap in mobile view? HOT 3
- Dropdown navigation disappears on some mobile devices HOT 1
- Incorrect position with inline submenu HOT 4
- bower package HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery.dropotron.