/* * jQuery Mobile Framework : "customSelect" plugin (based on code from Filament Group,Inc) * Copyright (c) jQuery Project * Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. * Note: Code is in draft form and is subject to change */ (function($){ $.fn.customSelect = function(options){ return $(this).each(function(){ var select = $(this) .attr( "tabindex", "-1" ) .wrap( "
" ), selectID = select.attr( "id" ), label = $( "label[for="+ selectID +"]" ) .addClass( "ui-select" ), //extendable options o = $.extend({ chooseText: label.text(), theme: select.data("theme") }, options), buttonId = selectID + "-button", menuId = selectID + "-menu", thisPage = select.closest( ".ui-page" ), menuType, currScroll, button = $( "", { "href": "#", "role": "button", "title": "select menu", "id": buttonId, "aria-haspopup": "true", "aria-owns": menuId }) .text( $( this.options.item(this.selectedIndex) ).text() ) .insertBefore( select ) .buttonMarkup({ iconpos: 'right', icon: 'arrow-d', theme: o.theme }), menuPage = $( "
" + "
" + "
" + o.chooseText + "
"+ "
"+ "
"+ "
" ) .appendTo( $.pageContainer ) .page(), menuPageContent = menuPage.find( ".ui-content" ), screen = $( "
", { "class": "ui-listbox-screen ui-overlay ui-screen-hidden fade" }) .appendTo( thisPage ), listbox = $( "
", { "class": "ui-listbox ui-listbox-hidden ui-body-a ui-overlay-shadow ui-corner-all pop"} ) .insertAfter(screen), list = $( "