ershouche/WebRoot/script/jquery.select.js

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

(function($) {
	/**
	 * select 下拉选择框组件
	 * version: 1.0
	 */
	$.fn.select = function(){
		return this.each(function () {
        	var _iSel = new $.iSelect(this);
        	_iSel = null;
   	 	});
	};

	$.iSelect = function( select ){
		if( !select || select.multiple ){
			return false;
		}
		
		var isel_id = select.id;
		if( !isel_id || isel_id === "" || typeof isel_id == "undefined" ){
			isel_id = "iSel-"+Math.round( Math.random()*10000 );
			select.id = isel_id;
		}
		if( document.getElementById("_iSelWrap_"+ isel_id) ){
			return false;
		}
		
		var $select = $(select), sel_w = select.offsetWidth;
		$select.addClass("iselect");
		var _onchange = select.onchange;
		
		if( sel_w >= 500 ){
			sel_w = 500;
		}
		
		var isel_wrap = '<div id="_iSelWrap_'+isel_id+'" class="iselect-wrapper"></div>';
		var isel_wrapin = '<span id="_iSelVal_'+isel_id+'" class="iselwrap-val"></span>';
		
		// 包裹select
		$select.wrap( isel_wrap );
		$("#_iSelWrap_"+ isel_id).append( isel_wrapin );
		
		var iSel_val = $("#_iSelVal_"+ isel_id);
		
		select.onchange = null;
		$select.change(function(){
			var _val = this.options[this.selectedIndex].text;
			iSel_val.text( _val );
			
			// 执行可能存在的原始onchange事件
			if( _onchange && typeof _onchange != "undefined" ){
				_onchange.apply(this);
			}
		});
		
		// 初始下显示select默认值
		var sel_option = $select.find("option:selected").first();
		if( sel_option.length <= 0 ){
			sel_option = $select.find("option:first");
		}
		
后面还有 7 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。