jQuery Select框下拉城市三级联动特效代码下载



64 254 85



特效描述:jQuery Select框下拉 城市三级联动,jQuerySelect框下拉城市三级联动特效代码下载

代码结构

1. 引入CSS

<link rel="stylesheet" type="text/css" href="css/city-picker.css">

2. 引入JS

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/citydata.js"></script>
<script type="text/javascript" src="js/cityPicker-1.0.0.js?v=1"></script>

3. HTML代码

<h2>模拟城市-无联动/无搜索</h2>
<div class="city-picker-selector" id="city-picker-selector">
	<div class="selector-item storey province">
		<a href="javascript:;" class="selector-name reveal">北京市</a>
		<input type="hidden" name="userProvinceId" class="input-price val-error" value="110000" data-required="userProvinceId">
		<div class="selector-list listing hide">
			<ul>
				<li>北京市</li>
				<li>天津市</li>
				<li>河北省</li>
				<li>山西省</li>
			</ul>
		</div>
	</div>
	<div class="selector-item storey city">
		<a href="javascript:;" class="selector-name reveal">北京市</a>
		<input type="hidden" name="userCityId" class="input-price val-error" value="110100" data-required="userCityId">
		<div class="selector-list listing hide">
			<ul>
				<li>北京市</li>
			</ul>
		</div>
	</div>
	<div class="selector-item storey district">
		<a href="javascript:;" class="selector-name reveal">海淀区</a>
		<input type="hidden" name="userDistrictId" class="input-price val-error" value="110108" data-required="userDistrictId">
		<div class="selector-list listing hide">
			<ul>
				<li>东城区</li>
				<li>西城区</li>
			</ul>
		</div>
	</div>
</div>
<!-- end .city-picker-selector -->
<h2>模拟城市-联动/搜索</h2>
<div class="city-picker-selector" id="city-picker-search">
	<div class="selector-item storey province">
		<a href="https://www.51qianduan.com/">51前端</a>
		<input type="hidden" name="userProvinceId" class="input-price val-error" value="" data-required="userProvinceId">
		<div class="selector-list listing hide">
			<div class="selector-search">
				<input type="text" class="input-search" value="" placeholder="拼音、中文搜索">
			</div>
			<ul>
				<li>北京市</li>
				<li>天津市</li>
			</ul>
		</div>
	</div>
	<div class="selector-item storey city">
		<a href="https://www.51qianduan.com/">51前端</a>
		<input type="hidden" name="userCityId" class="input-price val-error" value="" data-required="userCityId">
		<div class="selector-list listing hide">
			<div class="selector-search">
				<input type="text" class="input-search" value="" placeholder="拼音、中文搜索">
			</div>
			<ul></ul>
		</div>
	</div>
	<div class="selector-item storey district">
		<a href="https://www.51qianduan.com/">51前端</a>
		<input type="hidden" name="userDistrictId" class="input-price val-error" value="" data-required="userDistrictId">
		<div class="selector-list listing hide">
			<div class="selector-search">
				<input type="text" class="input-search" value="" placeholder="拼音、中文搜索">
			</div>
			<ul></ul>
		</div>
	</div>
</div>
<!-- end .city-picker-selector -->
<h2>原生城市-无联动</h2>
<div class="city-picker-select"></div>
<!-- end .city-picker-select -->
<script type="text/javascript">
	$(function () {
		//模拟城市-无联动/无搜索
		var selector = $('#city-picker-selector').cityPicker({
			dataJson: cityData,
			renderMode: true,
			search: false,
			linkage: false
		})
		$('#city-picker-selector').on('choose-province.citypicker', function(event, tagert, storage) {
			console.log(storage);
		});
		//设置城市
		selector.setCityVal([{
			'id': '110000',
			'name': '北京市'
		}, {
			'id': '110100',
			'name': '北京市'
		}, {
			'id': '110108',
			'name': '海淀区'
		}]);
		//模拟城市-联动/搜索
		$('#city-picker-search').cityPicker({
			dataJson: cityData,
			renderMode: true,
			search: true,
			linkage: true
		});
		//原生城市-无联动
		var select = $('.city-picker-select').cityPicker({
			dataJson: cityData,
			renderMode: false,
			linkage: false
		});
		//设置城市
		select.setCityVal([{
			'id': '140000',
			'name': '山西省'
		}, {
			'id': '140100',
			'name': '太原市'
		}, {
			'id': '140105',
			'name': '小店区'
		}]);
	});
</script>
<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
</div>



用户评论
大牛,别默默的看了,快登录帮我点评一下吧!:)      登录 | 注册


热门标签: 图片头像上传 文件上传 文本框 下拉框 复选 单选 登录框 注册框 搜索框 验证码 二级联动 三级联动 城市选择 value赋值 筛选 按钮控制 购物车 颜色选择 表单提交 全选/反选 添加删除 添加标签 密码强度验证 表单验证 html5按钮动画 按钮样式 密码修改设置 切换按钮 form表单

×
×

注册

官方QQ群

扫描上面二维码加微信群

官方QQ群

jQuery/js讨论群
群号:642649996
Css3+Html5讨论群
群号:322131262

加群请备注:从官网了解到