123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- //获取url中的参数
- function getUrlParam(name){
- //构造一个含有目标参数的正则表达式对象
- var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
- //匹配目标参数
- var r = window.location.search.substr(1).match(reg);
- //alert(r);
- //返回参数值
- if (r!=null) return decodeURI(r[2]);
- return null;
- }
- // URL接受参数
- var _albumid = getUrlParam('type_id'); //类型
- var _hid = getUrlParam('hid'); //楼盘ID
- var _index = getUrlParam('mindex'); //下标
- index_lp();
- // 相册ajax
- function index_lp (){
- var html = '';
- $('.m_swiper_ajax').html('')
- $.ajax({
- url: "/house/housetype",
- data:{hid:_hid,type_id:_albumid},
- type: "POST",
- dataType: "json",
- success: function(data) {//请求成功完成后要执行的方法
- if (data.code == 200) {
- html+='<div class="m_swiper_box">';
- html+='<div class="m_swiper_head">';
- html+='<div class="m_swiper_fh"><a href="javascript:history.back(-1)"><img src="/image/v2/lpindex3.png" alt=""></a></div>';
- html+='<div class="swiper-pagination" id="swiperzs"></div>';
- html+='<div class="m_swiper_qb"><a href="javascript:void(0)">全部图片</a></div>';
- html+='</div>';
- html+='<div class="m_swiper swiper-container">';
- html+='<div class="m_swiper_ul swiper-wrapper">';
- $.each(data.data, function (i, data) {
- html+='<div class="m_swiper_li swiper-slide">';
- html+='<div class="swiper-zoom-container" data-style="'+data.type_id+'"><img src="'+data.img+'"></div>';
- html+='</div>';
- });
- html+='</div>';
- html+='</div>';
- html+='</div>';
- };
- $('.m_swiper_ajax').html(html);
- // 相册插件
- var swipercx = new Swiper('.m_swiper', {
- // loop : true,
- zoom: true,
- // autoHeight: true,
- initialSlide :_index,
- nextButton: '.swiper-button-next',
- prevButton: '.swiper-button-prev',
- pagination : '.swiper-pagination',
- paginationType : 'custom',
- paginationCustomRender: function (swiper, current, total) {
- return current + ' / ' + total;
- },
- // onInit: function(swiper){
- // $('#swiperzs').hide();
- // },
- observer:true,//修改swiper自己或子元素时,自动初始化swiper
- // onSlideChangeEnd: function(){
- // $('#swiperzs').show();
- // },
- });
-
-
- $('.m_swiper_qb a').on('click',function(){
-
- console.log(_albumid);
- window.location='/house/type/'+_hid+'?type_id='+_albumid+'';
- })
- }
- });
- }
- //demo示例六 通过id调取 底部菜单插件
- $('#demo06').navbarscroll({
- defaultSelect:0,
- scrollerWidth:6,
- fingerClick:1,
- endClickScroll:function(obj){
- // console.log(obj.text())
- }
- });
- // 底部菜单选中
- $('.scroller ul li[data-id="'+_albumid+'"]').attr('class','cur').siblings().attr('class','');
- // 底部菜单
- $('.scroller ul li').on('click',function(){
- _hid = $(this).attr('hid');
- _albumid = $(this).attr('data-id');
- _index = 0;
- index_lp();
- })
|