mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-04-04 23:00:23 +00:00
56 lines
1.3 KiB
JavaScript
56 lines
1.3 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, {
|
|
_shared: $.mobile.selectShared,
|
|
|
|
_create: function() {
|
|
var widget = this;
|
|
|
|
$.extend( widget, widget._shared(), {
|
|
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() {
|
|
var self = this,
|
|
selected = this.selected();
|
|
|
|
self.setButtonText();
|
|
self.setButtonCount();
|
|
}
|
|
});
|
|
})( jQuery );
|