You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ive been having trouble for hours. Tried with the HTML, CSS, and JS with no fix. All of my dropdown menus close when I click inside of them including login and nav bar. I need a fix
varbackdrop='.dropdown-backdrop'vartoggle='[data-toggle="dropdown"]'varDropdown=function(element){$(element).on('click.bs.dropdown',this.toggle)}Dropdown.VERSION='3.3.4'Dropdown.prototype.toggle=function(e){var$this=$(this)if($this.is('.disabled, :disabled'))returnvar$parent=getParent($this)varisActive=$parent.hasClass('open')clearMenus()if(!isActive){if('ontouchstart'indocument.documentElement&&!$parent.closest('.navbar-nav').length){// if mobile we use a backdrop because click events don't delegate$('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click',clearMenus)}varrelatedTarget={relatedTarget: this}$parent.trigger(e=$.Event('show.bs.dropdown',relatedTarget))if(e.isDefaultPrevented())return$this.trigger('focus').attr('aria-expanded','true')$parent.toggleClass('open').trigger('shown.bs.dropdown',relatedTarget)}returnfalse}Dropdown.prototype.keydown=function(e){if(!/(38|40|27|32)/.test(e.which)||/input|textarea/i.test(e.target.tagName))returnvar$this=$(this)e.preventDefault()e.stopPropagation()if($this.is('.disabled, :disabled'))returnvar$parent=getParent($this)varisActive=$parent.hasClass('open')if((!isActive&&e.which!=27)||(isActive&&e.which==27)){if(e.which==27)$parent.find(toggle).trigger('focus')return$this.trigger('click')}vardesc=' li:not(.disabled):visible a'var$items=$parent.find('[role="menu"]'+desc+', [role="listbox"]'+desc)if(!$items.length)returnvarindex=$items.index(e.target)if(e.which==38&&index>0)index--// upif(e.which==40&&index<$items.length-1)index++// downif(!~index)index=0$items.eq(index).trigger('focus')}functionclearMenus(e){if(e&&e.which===3)return$(backdrop).remove()$(toggle).each(function(){var$this=$(this)var$parent=getParent($this)varrelatedTarget={relatedTarget: this}if(!$parent.hasClass('open'))return$parent.trigger(e=$.Event('hide.bs.dropdown',relatedTarget))if(e.isDefaultPrevented())return$this.attr('aria-expanded','false')$parent.removeClass('open').trigger('ontouchstart',relatedTarget)})}functiongetParent($this){varselector=$this.attr('data-target')if(!selector){selector=$this.attr('href')selector=selector&&/#[A-Za-z]/.test(selector)&&selector.replace(/.*(?=#[^\s]*$)/,'')// strip for ie7}var$parent=selector&&$(selector)return$parent&&$parent.length ? $parent : $this.parent()}// DROPDOWN PLUGIN DEFINITION// ==========================functionPlugin(option){returnthis.each(function(){var$this=$(this)vardata=$this.data('bs.dropdown')if(!data)$this.data('bs.dropdown',(data=newDropdown(this)))if(typeofoption=='string')data[option].call($this)})}varold=$.fn.dropdown$.fn.dropdown=Plugin$.fn.dropdown.Constructor=Dropdown// DROPDOWN NO CONFLICT// ====================$.fn.dropdown.noConflict=function(){$.fn.dropdown=oldreturnthis}// APPLY TO STANDARD DROPDOWN ELEMENTS// ===================================$(document).on('click.bs.dropdown.data-api',clearMenus).on('click.bs.dropdown.data-api','.dropdown form',function(e){e.stopPropagation()}).on('click.bs.dropdown.data-api',toggle,Dropdown.prototype.toggle).on('keydown.bs.dropdown.data-api',toggle,Dropdown.prototype.keydown).on('keydown.bs.dropdown.data-api','[role="menu"]',Dropdown.prototype.keydown).on('keydown.bs.dropdown.data-api','[role="listbox"]',**Dropdown.prototype.keydown)
The text was updated successfully, but these errors were encountered:
Ive been having trouble for hours. Tried with the HTML, CSS, and JS with no fix. All of my dropdown menus close when I click inside of them including login and nav bar. I need a fix
The text was updated successfully, but these errors were encountered: