/**jquery的select组件对于自定义样式上无法实现,只能实现宽设定,且不能自定义下拉项的样式**/
/**做如下修正使组件可以实现对宽高、文字位置的自定义,同时下拉项与组件样式定义保持一致**/
sSelect: function(_change, liStyle) {
return this.each(function(i,obj){
......
$('#'+selectId+' h4').empty().append($('#'+selectId+' option:selected').text());
var selectWidth=$('#'+selectId+' select').width();
//增加原select的style样式与jquery组件新式同步
var selectHeight=$('#'+selectId+' select').height();
var selectPleft=$('#'+selectId+' select').css("padding-left");
var selectPtop=$('#'+selectId+' select').css("padding-top");
if($.browser.safari){selectWidth = selectWidth+15}
$('#'+selectId+' h4').css({width:selectWidth})
if(null != selectHeight){
$('#'+selectId+' h4').css({height:selectHeight});
}
if(null != selectPleft){
$('#'+selectId+' h4').css("padding-left",selectPleft);
}
if(null != selectPtop){
$('#'+selectId+' h4').css("padding-top",selectPtop);
}
//-->
var selectUlwidth = selectWidth + parseInt($('#'+selectId+' h4').css("padding-left")) + parseInt($('#'+selectId+' h4').css("padding-right"));
......
.bind("click",function(e){
......
$('#'+selectId).css({'position':'relative','z-index':'999'});
//更新内容 <!--
$.fn.setSelectValue(selectId, {width:selectWidth,height:selectHeight,pleft:selectPleft,ptop:selectPtop});
//-->
selectIndex = $('#'+selectId+' li').index($('.selectedli')[0]);
......
//更新内容 <!--
setSelectValue:function(sID, liStyle){
var content = [];
$.each($('#'+sID+' option'), function(i){
if (liStyle != null){
var style = "";
if(null != liStyle.width) style += "width:"+liStyle.width+";";
if(null != liStyle.height) style += "height:"+liStyle.height+";";
if(null != liStyle.pleft) style += "padding-left:"+liStyle.pleft+";";
if(null != liStyle.ptop) style += "padding-top:"+liStyle.ptop+";";
content.push("<li class='FixSelectBrowser' style='"+style+"'>"+$(this).text()+"</li>");
}else{
content.push("<li class='FixSelectBrowser'>"+$(this).text()+"</li>");
}
});
content = content.join('');
$('#'+sID+' ul').html(content);
$('#'+sID+' h4').html($('#'+sID+' option:selected').text());
$('#'+sID+' li').eq($('#'+sID+' select')[0].selectedIndex).addClass("over").addClass("selectedli");
},
//-->
......