Merge pull request #767 from ImanMh/master

A delay added to CMS side menu tab change event to avoid the annoying tab changes
This commit is contained in:
Samuel Georges 2014-11-15 15:11:02 +11:00
commit c6f46d1397
1 changed files with 13 additions and 2 deletions

View File

@ -12,6 +12,8 @@
SidePanelTab.prototype.init = function() {
var self = this
this.tabOpenDelay = 200
this.tabOpenTimeout = undefined
this.$sideNavItems = $('#layout-sidenav ul li')
this.$sidePanelItems = $('[data-content-id]', this.$el)
this.sideNavWidth = $('#layout-sidenav ul li').outerWidth()
@ -51,10 +53,19 @@
})
self.$sideNavItems.mouseenter(function(){
if ($(window).width() < self.options.breakpoint || !self.panelFixed())
self.displayTab(this)
if ($(window).width() < self.options.breakpoint || !self.panelFixed()) {
var _this = this
self.tabOpenTimeout = setTimeout(function () {
self.displayTab(_this)
}, self.tabOpenDelay)
}
})
self.$sideNavItems.mouseleave(function (){
clearTimeout(self.tabOpenTimeout)
})
$(window).resize(function() {
self.updatePanelPosition()
self.updateActiveTab()