省市地区三级联动弹出层Jquery特效

此特效是一款非常实用的功能,它摆脱了通俗的下拉框联动效果,直接弹出一个层让你选择,增强用户体验效果,带有4个选项卡,分别为热门城市、省份、城市、区县,点击省列表自动跳到城市列表,列表多的话会自动分页,可以左右滚动翻页,引入了3个省、市、区JSON数据包,使用非常简单,引入相关的文件即可,讲这么多大家都流口水了吧,不说了看效果吧
 
效果如下:
标签:  jQuery

代码片段(1)[全屏查看所有代码]

1. [代码][JavaScript]代码     

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
( function () {
     $( ".proCitySelAll" ).click( function (event) {
         if ($( "body" ).data( "CitysAll" ) == null ) {
             sendAllCitiesAjax();
         }
         $( this ).select();
         $( ".provinceCity" ).hide();
         $( ".provinceCityAll" ).hide();
         $( "#dimCityQuery" ).hide();
         var o2 = $( this ).offset();
         var l2 = o2.left;
         var t2 = o2.top;
         var h2 = $( this ).height();
         $( ".provinceCityAll" ).css( "top" , t2 + h2 - 1).css( "left" , l2).toggle();
         $( ".provinceCityAll" ).click( function (event) {
             event.stopPropagation();
         });
         event.stopPropagation();
         $( "html" ).click( function () {
             $( ".provinceCityAll" ).hide();
         });
         $( "input.proCitySelAll" ).removeClass( "current2" );
         $( this ).addClass( "current2" );
         $( ".provinceCityAll" ).find( ".tabs" ).find( "a" ).removeClass( "current" );
         $( ".provinceCityAll" ).find( ".tabs" ).find( "a[tb=hotCityAll]" ).addClass( "current" );
         $( ".provinceCityAll" ).find( ".con" ).children().hide();
         $( ".provinceCityAll" ).find( ".con" ).find( ".hotCityAll" ).show();
         if ($( "body" ).data( "allProvinces" ) == null ) {
             sendAllProvinceAjax();
         }
         if ($( "body" ).data( "allCountys" ) == null ) {
             sendAllCountiesAjax();
         }
         $( ".provinceCityAll" ).find( ".tabs" ).find( "a" ).click( function () {
             if ($( this ).attr( "tb" ) == "cityAll" && $( ".provinceAll .list .current" ).val() == null ) {
                 return ;
             };
             if ($( this ).attr( "tb" ) == "countyAll" && $( ".cityAll .list .current" ).val() == null && $( ".hotCityAll .list .current" ).val() == null ) {
                 return ;
             };
             $( ".provinceCityAll" ).find( ".tabs" ).find( "a" ).removeClass( "current" );
             $( this ).addClass( "current" );
             var tb = $( this ).attr( "tb" );
             $( ".provinceCityAll" ).find( ".con" ).children().hide();
             $( ".provinceCityAll" ).find( ".con" ).find( "." + tb).show();
         });
     });
})();
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值