jquery-mobile/js/jquery.mobile.forms.select.native.js
2011-08-08 13:53:53 -07:00

51 lines
1.2 KiB
JavaScript

/*
* jQuery Mobile Framework : "selectmenu" plugin
* Copyright (c) jQuery Project
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*/
(function( $, undefined ) {
$.widget( "mobile.nativeselect", $.mobile.widget, {
_create: function() {
var widget = this;
$.extend( widget, $.mobile.selectShared.call(this), {
typgeName: 'native',
button: $( "<div/>" )
});
},
build: function() {
var self = this;
this.select
.appendTo( self.button )
.bind( "vmousedown", function() {
// Add active class to button
self.button.addClass( $.mobile.activeBtnClass );
})
.bind( "focus vmouseover", function() {
self.button.trigger( "vmouseover" );
})
.bind( "vmousemove", function() {
// Remove active class on scroll/touchmove
self.button.removeClass( $.mobile.activeBtnClass );
})
.bind( "change blur vmouseout", function() {
self.button.trigger( "vmouseout" )
.removeClass( $.mobile.activeBtnClass );
})
.bind( "change blur", function() {
self.button.removeClass( "ui-btn-down-" + self.options.theme );
});
},
refresh: function() {
this.setButtonText();
this.setButtonCount();
}
});
})( jQuery );