admin管理员组文章数量:1415111
I am using this plugin for jQuery: /
I want to do something when hovering a div element IF dropdown is currently open, or something else if dropdown is currently closed while hovering the div element.
Psuedo code:
$('#foo').hover(function() {
if ( $('*').dropdown('is_visible') ) {
alert('Dropdown is visible, so do something...');
}
else {
alert('Dropdown is NOT visible, so do something else...');
}
});
Can anyone see how this can be acheived with this plugin? Can I search the DOM for some class or something?
Thanks in advance!!
I am using this plugin for jQuery: http://labs.abeautifulsite/jquery-dropdown/
I want to do something when hovering a div element IF dropdown is currently open, or something else if dropdown is currently closed while hovering the div element.
Psuedo code:
$('#foo').hover(function() {
if ( $('*').dropdown('is_visible') ) {
alert('Dropdown is visible, so do something...');
}
else {
alert('Dropdown is NOT visible, so do something else...');
}
});
Can anyone see how this can be acheived with this plugin? Can I search the DOM for some class or something?
Thanks in advance!!
Share Improve this question asked Jul 17, 2014 at 3:42 NickNick 1432 silver badges10 bronze badges2 Answers
Reset to default 4You can seek class "dropdown-open". Might be:
if ($(".dropdown-open").length > 0) {
// A dropdown is opened
} else {
// No opening dropdown
}
The plugin uses a unique id for each dropdown, i.e., dropdown-1, dropdown-2, dropdown-3, etc.
You may use this id to target a specific dropdown. Check wether its css display
is block
or none
.
本文标签: javascriptjQuery dropdown pluginHow to know if dropdown is open or notStack Overflow
版权声明:本文标题:javascript - jQuery dropdown plugin - How to know if dropdown is open or not? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745200282a2647336.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论