Skip to content

Commit

Permalink
Fix initialization for mobile
Browse files Browse the repository at this point in the history
Do not initialize when loading on a < 768px wide screen. Correct typo.
  • Loading branch information
rniswonger authored Jul 10, 2016
1 parent dc4b10f commit a19f9e2
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions js/bootstrap-dropdownhover.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,17 @@

var resizeTimer;
$(document).ready(function () {
$('[data-hover="dropdown"]').each(function () {
var $target = $(this)
Plugin.call($target, $target.data())
})
if($(window).width() >= 768) { // Breakpoin plugin is activated (768px)
$('[data-hover="dropdown"]').each(function () {
var $target = $(this)
Plugin.call($target, $target.data())
})
}
})
$(window).on('resize', function () {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function(){
if($(window).width() >= 768) // Breakpoin plugin is activated (728px)
if($(window).width() >= 768) // Breakpoin plugin is activated (768px)
$('[data-hover="dropdown"]').each(function () {
var $target = $(this)
Plugin.call($target, $target.data())
Expand All @@ -234,4 +236,4 @@
}, 200)
})

}(jQuery);
}(jQuery);

0 comments on commit a19f9e2

Please sign in to comment.