diff --git a/dist/components/dropdown.js b/dist/components/dropdown.js index 9a060f738..a8123f075 100644 --- a/dist/components/dropdown.js +++ b/dist/components/dropdown.js @@ -17,6 +17,7 @@ $.fn.dropdown = function(parameters) { var $allModules = $(this), $document = $(document), + $window = $(window), moduleSelector = $allModules.selector || '', @@ -1492,9 +1493,11 @@ $.fn.dropdown = function(parameters) { .find('option') .each(function() { var - name = $(this).html(), - value = ( $(this).attr('value') !== undefined ) - ? $(this).attr('value') + $option = $(this), + name = $option.html(), + disabled = $option.attr('disabled'), + value = ( $option.attr('value') !== undefined ) + ? $option.attr('value') : name ; if(settings.placeholder === 'auto' && value === '') { @@ -1502,8 +1505,9 @@ $.fn.dropdown = function(parameters) { } else { select.values.push({ - name: name, - value: value + name : name, + value : value, + disabled : disabled }); } }) @@ -2558,7 +2562,7 @@ $.fn.dropdown = function(parameters) { $currentMenu.addClass(className.loading); onScreen = ($.fn.visibility !== undefined) ? $currentMenu.visibility('bottom visible') - : $(window).scrollTop() + $(window).height() >= $currentMenu.offset().top + $currentMenu.height() + : $window.scrollTop() + $window.height() >= $currentMenu.offset().top + $currentMenu.height() ; module.debug('Checking if menu can fit on screen', onScreen, $menu); $currentMenu.removeClass(className.loading); @@ -3101,7 +3105,10 @@ $.fn.dropdown.settings.templates = { } html += '
'; return html; diff --git a/dist/components/dropdown.min.js b/dist/components/dropdown.min.js index a95a40199..77511a4b5 100644 --- a/dist/components/dropdown.min.js +++ b/dist/components/dropdown.min.js @@ -8,5 +8,5 @@ * http://opensource.org/licenses/MIT * */ -!function(e,t,n,i){"use strict";e.fn.dropdown=function(a){var o,s=e(this),r=e(n),l=s.selector||"",c="ontouchstart"in n.documentElement,u=(new Date).getTime(),d=[],v=arguments[0],m="string"==typeof v,f=[].slice.call(arguments,1);return s.each(function(){var h,g,b,p,w,C,x,y=e.isPlainObject(a)?e.extend(!0,{},e.fn.dropdown.settings,a):e.extend({},e.fn.dropdown.settings),S=y.className,A=y.message,T=y.metadata,k=y.namespace,L=y.regExp,D=y.selector,I=y.error,R=y.templates,q="."+k,V="module-"+k,E=e(this),O=E.find(D.text),F=E.find(D.search),P=E.find(D.input),M=E.find(D.icon),z=E.prev().find(D.text).length>0?E.prev().find(D.text):E.prev(),H=E.children(D.menu),j=H.find(D.item),U=!1,N=!1,K=this,W=E.data(V);x={initialize:function(){x.debug("Initializing dropdown",y),x.is.alreadySetup()?x.setup.reference():(x.setup.layout(),x.save.defaults(),x.restore.selected(),x.create.id(),c&&x.bind.touchEvents(),x.bind.mouseEvents(),x.bind.keyboardEvents(),x.observeChanges(),x.instantiate())},instantiate:function(){x.verbose("Storing instance of dropdown",x),W=x,E.data(V,x)},destroy:function(){x.verbose("Destroying previous dropdown for",E),x.remove.tabbable(),E.off(q).removeData(V),H.off(q),r.off(b),w&&w.disconnect(),C&&C.disconnect()},observeChanges:function(){"MutationObserver"in t&&(w=new MutationObserver(function(e){x.debug("