fieldset { border:0; }
label,select,.ui-select-menu { float: left; margin-right: 10px; }
select { width: 200px; }
+ .wrap span.ui-selectmenu-item-header,
+ .wrap ul.ui-selectmenu-menu li a
+ { color: black !important; }
</style>
<script type="text/javascript">
$(function(){
$('select#speedAa').selectmenu({
style:'popup',
- maxHeight: 150
+ maxHeight: 150,
+ wrapperElement: "<div class='wrap' />"
});
$('select#speedB').selectmenu({
}
return newText;
}
- </script>
- <!--
- <script type="text/javascript" src="http://ui.jquery.com/applications/themeroller/themeswitchertool/"></script>
- <script type="text/javascript"> $(function(){ $('<div style="position: absolute; top: 20px; right: 10px;" />').appendTo('body').themeswitcher(); }); </script>
- -->
+
+ // add themeswitcher
+ $(function(){
+ var ts = $('<div class="ui-button ui-widget ui-state-default ui-corner-all" style="padding: 5px; position: absolute; top: 20px; right: 10px;">Click here to add Themeswitcher!</div>')
+ .appendTo('body')
+ .bind("click", function() {
+ ts.text("Loading Themeswitcher...");
+ $.getScript('http://ui.jquery.com/applications/themeroller/themeswitchertool/', function() {
+ ts.removeClass("ui-button ui-widget ui-state-default ui-corner-all").text("").unbind("click").themeswitcher();
+ });
+ });
+ });
+ </script>
</head>
<body>
<br />
<option value="Faster">Faster</option>
</select>
</fieldset>
- <h2>"default popup" Style with maxHeight set </h2>
+ <h2>"default popup" Style with maxHeight set and custom wrapper</h2>
<fieldset>
<label for="speedAa">Select a Speed:</label>
<select name="speedAa" id="speedAa">
},
width: null,
menuWidth: null,
- handleWidth: 26,
+ handleWidth: 26,
maxHeight: null,
icons: null,
format: null,
- bgImage: function() {}
+ bgImage: function() {},
+ wrapperElement: ""
},
_create: function() {
//create menu button wrapper
this.newelement = $('<a class="'+ this.widgetBaseClass +' ui-widget ui-state-default ui-corner-all" id="'+this.ids[0]+'" role="button" href="#" tabindex="0" aria-haspopup="true" aria-owns="'+this.ids[1]+'"></a>')
.insertAfter(this.element);
-
+ //
+ this.newelement.wrap(o.wrapperElement);
//transfer tabindex
var tabindex = this.element.attr('tabindex');
if(tabindex){ this.newelement.attr('tabindex', tabindex); }
//create menu portion, append to body
var cornerClass = (o.style == "dropdown")? " ui-corner-bottom" : " ui-corner-all";
this.list = $('<ul class="' + self.widgetBaseClass + '-menu ui-widget ui-widget-content'+cornerClass+'" aria-hidden="true" role="listbox" aria-labelledby="'+this.ids[0]+'" id="'+this.ids[1]+'"></ul>').appendTo('body');
+ this.list.wrap(o.wrapperElement);
//serialize selectmenu element options
var selectOptionData = [];
.attr('for',this.element.attr('id'))
.unbind('click');
this.newelement.remove();
+ // FIXME option.wrapper needs
this.list.remove();
this.element.show();
this._closeOthers(event);
this.newelement
.addClass('ui-state-active');
-
- this.list
- .appendTo('body')
- .addClass(self.widgetBaseClass + '-open')
+ if (self.options.wrapperElement) {
+ this.list.parent().appendTo('body');
+ } else {
+ this.list.appendTo('body');
+ }
+ this.list.addClass(self.widgetBaseClass + '-open')
.attr('aria-hidden', false)
.find('li:not(.'+ self.widgetBaseClass +'-group):eq('+ this._selectedIndex() +') a')[0].focus();
if(this.options.style == "dropdown"){ this.newelement.removeClass('ui-corner-all').addClass('ui-corner-top'); }