$(function(){ $('#yii-debug-toolbar').hide(); // 相册ajax function index_lp (){ var html = ''; $('.m_album_r_lsit').html('') $.ajax({ url: "/house/albumlist", data:{hid:hid,album_id:album_id}, type: "POST", dataType: "json", success: function(data) {//请求成功完成后要执行的方法 if (data.code == 200) { $.each(data.data, function (i, data) { html+='
'; }); }; $('.m_album_r_lsit').html(html); $('.m_album_r_lsit .m_lsitImg').on('click',function(){ var _dataStyle = $(this).attr('data-style'); var _dataIndex = $(this).attr('data-index'); console.log(_dataStyle); console.log(_dataIndex); window.location='/house/pvimage/'+hid+'?album_id='+_dataStyle+'&mindex='+_dataIndex+'&hid='+hid+''; }) } }); } //获取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; } var hid = $('.m_album_l_title span').eq(0).attr('hid'); var album_id = ''; // URL接受参数 var _albumid = getUrlParam('album_id'); //类型 if(_albumid){ //是否从放大页,进入页面 album_id = _albumid $('.m_album_l_title span[value="'+_albumid+'"]').attr('class','on'); }else{ album_id = $('.m_album_l_title span').eq(0).attr('value'); $('.m_album_l_title span').eq(0).attr('class','on'); } index_lp(); $('.m_album_l_title span').on('click',function(){ hid = $(this).attr('hid'); album_id = $(this).attr('value'); $(this).attr('class','on').siblings().attr('class','') index_lp(); }) var height =$(window).height() -155; $('.m_album_box').height(height); }) var _dataid = $('.m_hq li.cur').attr('dataid'); //demo示例六 通过id调取 底部菜单插件 $('#mdemo06').navbarscroll({ defaultSelect:_dataid, scrollerWidth:6, fingerClick:1, endClickScroll:function(obj){ // console.log(obj.text()) } });