javascript - jQuery dropdown plugin - How to know if dropdown is open or not? - Stack Overflow

I am using this plugin for jQuery: I want to do something when hovering a div element IF dropdown is c

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 badges
Add a ment  | 

2 Answers 2

Reset to default 4

You 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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745200282a4616289.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信