Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions bootstrap-hover-dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
* Description: A simple plugin to enable Bootstrap dropdowns to active on hover and provide a nice user experience.
* License: MIT
* Homepage: http://cameronspear.com/blog/bootstrap-dropdown-on-hover-plugin/
*/


Comment on lines +11 to +15
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like some blank lines snuck in!

Suggested change
*/
*/

;(function ($, window, undefined) {
// outside the scope of the jQuery plugin to
// keep track of all dropdowns
Expand Down Expand Up @@ -47,7 +51,7 @@

$parent.hover(function (event) {
// so a neighbor can't open the dropdown
if(!$parent.hasClass('open') && !$this.is(event.target)) {
if(!$parent.hasClass('show') && !$this.is(event.target)) {
// stop this event, stop executing any code
// in this callback but continue to propagate
return true;
Expand All @@ -59,7 +63,8 @@
window.clearTimeout(timeoutHover)
timeout = window.setTimeout(function () {
$this.attr('aria-expanded', 'false');
$parent.removeClass('open');
$parent.removeClass('show');
$this.next('.dropdown-menu').removeClass('show');
$this.trigger(hideEvent);
}, settings.delay);
});
Expand All @@ -68,7 +73,7 @@
$this.hover(function (event) {
// this helps prevent a double event from firing.
// see https://github.com/CWSpear/bootstrap-hover-dropdown/issues/55
if(!$parent.hasClass('open') && !$parent.is(event.target)) {
if(!$parent.hasClass('show') && !$parent.is(event.target)) {
// stop this event, stop executing any code
// in this callback but continue to propagate
return true;
Expand Down Expand Up @@ -111,12 +116,13 @@
$allDropdowns.find(':focus').blur();

if(settings.instantlyCloseOthers === true)
$allDropdowns.removeClass('open');
$allDropdowns.removeClass('show');

// clear timer for hover event
window.clearTimeout(timeoutHover);
$this.attr('aria-expanded', 'true');
$parent.addClass('open');
$this.next('.dropdown-menu').addClass('show');
$parent.addClass('show');
$this.trigger(showEvent);
}, settings.hoverDelay);
}
Expand Down