function layer_media_init_func(layerid,params){ var $curlayer=$('#'+layerid), _duration = -1; $('#wp-media-image_'+layerid).off('mouseover').mouseover(function (event) { if($curlayer.data('wopop_effects') && $curlayer.hasClass('now_effecting')){ return; } var effect=$curlayer.data('wopop_imgeffects'); var $this=$(this); var running=$this.data('run'); if(effect && running!=1){ var effectrole = effect['effectrole']; var dset = effect['dset']; var effectel=$curlayer; if(effectrole=='dantu' && effect['effect']=="effect.rotation"){ $curlayer.data('iseffectrotate',true); effectel=$curlayer.find('.wp-media_content'); }else if(effectrole !='dantu' && dset && dset['effect']=="effect.rotation"){ $curlayer.data('iseffectrotate',true); effectel=$curlayer.find('.wp-media_content'); }else if(effect['effect_on_img'] && effectrole=='dantu' && effect['effect']=="effect.zoomin"){ effectel=$curlayer.find('img'); } effectel.setimgEffects(true,effect,1); if(effectrole !='dantu' && typeof(dset)!="undefined"){ // fixed bug#5949 if ($curlayer.hasClass('now_effecting')) { _duration = dset.duration; $curlayer.wopop_effect_command('stop'); } var temp_effect = {}; temp_effect['type'] = effect['type']; temp_effect['effectrole'] = 'dantu'; temp_effect['effect'] = effect['dset']['effect']; temp_effect['duration'] = effect['dset']['duration']; effectel.setimgEffects(true,temp_effect,1); } } }); // fixed bug#5949 $curlayer.mouseleave(function(e){ var $target = $(this), _tt = parseInt(_duration); if (!isNaN(_tt) && _tt >= 0 && !$target.hasClass('now_effecting')) { var timer = setTimeout(function(){ $target.showEffects(); _duration = -1; clearTimeout(timer); }, _tt); } }); var imgover=$('#wp-media-image_'+layerid).closest('.img_over'); imgover.children('.imgloading').width(imgover.width()).height(imgover.height()); imgover.css('position','relative'); $('#'+layerid).layer_ready(function(){ layer_img_lzld(layerid); }); if(!params.isedit && !params.has_effects){ if ($('#'+$('#'+layerid).attr('fatherid')).attr('type') == 'pop_up') { $('#wp-media-image_'+layerid).attr('src',params.img_src); $('#wp-media-image_'+layerid).parents('.img_over:first').children('.imgloading').remove(); } } }; function layer_article_list_checkid_func(params){ $(function(){ var layer_id = "#"+params.layer_id; $(layer_id+' .articleid:not(.memberoff)').unbind('click.list_check').bind('click.list_check',function(event){ event.preventDefault(); var gourl = $(this).attr('href'); var targettype = $(this).attr('target'); _this = $(this); $.ajax({ type: "POST", url: parseToURL('article_list','checkarticleid'), data: {id:$(this).attr('articleid')}, dataType: "json", async:false, success: function(r){ var islogin = params.islogin; if(r.code == -2 && !islogin){ //是会员 if(!islogin){ event.preventDefault(); $LAB .script(relativeToAbsoluteURL("script/datepicker/custom_dialog.js")) .wait(function(){ show_custom_panel(parseToURL('userlogin','login_dialog'),{ title:'Login', overlay:true, id:'wp_user_info' }); }); } return false; }else if(r.code == -1){ //不是会员 ismember = false; } if(targettype == undefined && gourl != 'javascript:void(0);'){ location.href=gourl; }else if(targettype != undefined && gourl != 'javascript:void(0);'){ window.open(gourl,'','',true); } } }) }) }) } function layer_article_list_init_func(param){ if(!getSystemSession()){ var $window=$(window); var layerid=param.layer_id; if($('#'+layerid).length&&$('#'+layerid).closest('#canvas,#site_footer').length){ // var $body = $('#scroll_container'); // var scrolTop = Math.max($(window).scrollTop(), $body.scrollTop()); } } var layerid=param.layer_id; var articleStyle=param.articleStyle; window['set_thumb_'+layerid]=function(obj) { var callback=function(img){ img.fadeIn('slow',function(){ img.closest('li').find('.imgloading').remove(); }); } $(obj).each(function() { var img=$(this); callback(img); }); } if(articleStyle=='two_column'){ $("#"+layerid).layer_ready(function(){ var $p = $('ul:first li p', "#"+layerid); $p.width('auto'); var maxW = Math.max.apply(Math, $p.map(function(){ return $(this).outerWidth(true); }).toArray()); $p.width(maxW); }); }else{ if (articleStyle === "skin3" || articleStyle === "ulist3") { $(function(){ var maxliheight = 0,tmplayerid = "#"+layerid; if (tmplayerid.length == 1) return;var $tmpnode = $(tmplayerid+' li > .wp-new-article-style-c'); maxliheight = Math.max.apply(null,$tmpnode.map(function(){return $(this).outerHeight();}).toArray()); if (maxliheight) $tmpnode.height(maxliheight); // 右间距 2014/03/17 $(tmplayerid).bind("fixedmarginright", function(e, margin){ var $target = $(this),$li = $target.find('li'); if(margin != undefined) $li.css("margin-right", margin+'px'); var $first = $li.filter(':first'),liwidth = $first.outerWidth(), mgnright = $._parseFloat($first.css("marginRight")), maxwidth = $target.children('.wp-article_list_content').width(), maxcols = Math.floor(maxwidth / (liwidth + mgnright)); if(maxwidth >= maxcols * (liwidth + mgnright) + liwidth) maxcols += 1; for(var i = 1,licnt = $li.length; i <= licnt; i++){ if (i % maxcols != 0) continue; if ((maxcols == 1) && (2*liwidth <= maxwidth)) continue; $li.filter(':eq('+(i - 1)+')').css("margin-right", '0'); } $li = null; }).triggerHandler("fixedmarginright"); // < .wp-new-article-style-01-left').outerWidth(true); $PL.find('li > .wp-new-article-style-01-right').css({"width": (MAXW - LW)+'px',"overflow": 'hidden',"word-wrap": 'break-word'}); //set li width var self=$(this);var leftwidth=self.find('.wp-new-article-style-01-left').outerWidth(); var rightwidth=self.find('.wp-new-article-style-01-right').outerWidth(); //设置时间日期容器的宽度,设置之后无法添加文章浏览量 if(articleStyle == "ylist2") $PL.find('li .time').parent('.tinubox').css({"width": (MAXW - LW)+'px'}); $PL = null; if(articleStyle != "ylist2") self.css('width',(leftwidth+rightwidth+350)+'px'); }) }).triggerHandler("fixedliwidth"); }); } } } function layer_article_list_animate_func(param){ var layerid=param.layer_id; var articleStyle=param.articleStyle; var support_animate=true; if(!support_animate) return; if($.inArray(articleStyle,['default','skin1','ylist2','skin4'])==-1){ return; } var layerobj=$('#'+layerid); var animatelis=layerobj.find('li'); var animateobj=[]; var index=0; animatelis.each(function(){ var li=$(this); animateobj.push({el:li,index:index,isStop:false}); index++; }) function startAnimate(obj){ if(obj.isStop) return; var el=obj.el;var index=obj.index; el.velocity({opacity: [1,0], translateY: [0,'100%'], translateZ: 0 }, {visibility:'visible',delay:index*100,duration: 1000}); obj.isStop=true; } function isLiInWindow(obj){ var el=obj.el; var eltop=el.offset().top; var elbottom=eltop+el.height(); var winH=$('#scroll_container').height(); return eltop>0 && eltop20 && elbottom-1){ e.preventDefault(); var pageid = page||$(this).attr("href").replace("###",''); if(param.editmode == "1") $.method.article_list.refreshArticleList({"page":pageid,"layerid":layerid}); else { var dom = $cstlayer.find('.article_list_save_itemList'), params = { }; var liststyle={"artliststyle":param.artliststyle} $.ajax({ type: "GET", url: parseToURL("article_list","get_page"), data: {article_category:param.article_category_param,layer_id: layerid,page: pageid,article_category_more:param.article_category_more}, success: function(data){ var $layer = $("#"+layerid); var oldHeight = $layer.find('.article_list-'+layerid).height(); $layer.children('.wp-article_list_content').hide().before(data).remove(); if(!ua.match(/chrome\/46/)){ var this_dom = $('#'+layerid); this_dom.find(".wp-pager_link").css({'position':'relative','bottom':'auto','width':'100%'}); if(!this_dom.data('not_need_heightadapt')) wp_heightAdapt($layer); var cheight = this_dom.find(".wp-article_content").height(); var oulheight = this_dom.find(".article_list-"+layerid).height(); var olkheight = this_dom.find(".wp-pager_link").outerHeight(); var fcontent = this_dom.find(".wp-article_list_content"); var botmag = parseInt(fcontent.css("border-bottom-width"))+parseInt(fcontent.css("padding-bottom")); if(cheight>oulheight+olkheight &&!$layer.data('not_need_heightadapt')){ this_dom.find(".wp-pager_link").css({'position':'absolute','bottom':botmag+'px','width':'100%'}) } /** * #修复“分页”后高度出现异常问题(bug#4316)2015/11/17 * #插件内容高度实际上没有问题,只因“分页”区域定位问题而导致的错觉 * bug(#4515)发现模块高度小于内容高度导致分页隐藏 */ var $C = $layer.children('.wp-article_list_content'),$W = $C.children('.article_list-'+layerid); var c_h = $C.height(),w_h = $W.height(); if(c_h-1){ $pglnker.find('a').triggerHandler('click',[Math.min(pgid,maxpg)]); }else{ urlhrf=urlhrf.replace(/\d+$/,Math.min(pgid,maxpg)) location.href=urlhrf; } } } } function _int(numString){ var number = parseInt(numString); if(isNaN(number)) return 0; return number; } return false; }; break; case "button": ent = 'click'; fnc = function(){ if (pgid.length && /^[1-9]{1}\d*$/.test(pgid)) { var maxpg = _int($pglnker.find('span.total').html()); if(!maxpg) maxpg = 1; var pagelink=$pglnker.find('a:first'); var urlhrf = pagelink.attr("href"); if(urlhrf.indexOf("##")>-1){ $pglnker.find('a').triggerHandler('click',[Math.min(pgid,maxpg)]); }else{ urlhrf=urlhrf.replace(/\d+$/,Math.min(pgid,maxpg)) location.href=urlhrf; } } function _int(numString){ var number = parseInt(numString); if(isNaN(number)) return 0; return number; } return false; }; break; } if(fnc && $.isFunction(fnc)) $input[ent](fnc); }); }); }; function layer_tb_product_list_init_func(param){ var layerid=param.layer_id; var productStyle=param.productStyle; window['set_thumb_'+layerid]=function(obj){ var callback=function(img){ img.fadeIn('slow',function(){ img.closest('.img,.wp-new-product-style-01-left').children('.imgloading').remove(); }); } $(obj).each(function() { var img=$(this); callback(img); }); } $(function(){ setTimeout(function(){ if(productStyle=== "03"||productStyle=== "04"){ $(".tb_product_list-"+layerid+" li").each(function(){ var tmph = parseInt($('.productsmallfloating img').eq(0).height()); var mrt = $(this).find('.productlistid').height()-10-tmph; var mrtw = ($(this).find('.productlistid').width()-$(this).find('.productsmallfloating').width())/2; $(this).find('.productsmallfloating').css({'marginTop':mrt+'px','marginLeft':mrtw+'px'}) }) } },300) }) if (productStyle === "01"||productStyle === "03") { $("#"+layerid).bind("fixedmarginright", function(e, margin){ var $target = $(this),$li = $target.find('.tb_product_list-'+layerid+' > ul > li'); if(margin != undefined) {$li.css("margin-right", margin+'px');} else { var limargin=$li.filter(':first').css("margin-right"); if(parseInt(limargin)>0){ $li.css("margin-right", $li.filter(':first').css("margin-right")); }else{ setTimeout(function(){ $li.css("margin-right", $li.filter(':first').css("margin-right")); },300) } } // 2014/04/23 leiminglin 修改为动态获取li的padding 和 border var $first = $li.filter(':first'); var paddingLeft = $first.css("padding-left")||'0'; var paddingRight = $first.css("padding-right")||'0'; var liwidth = $first.width() + parseInt( paddingLeft.match(/\d+/) ) + parseInt( paddingRight.match(/\d+/) ) + parseInt( $first.css("border-left-width") ) * 2, //30、6 li的padding和border mgnright = $._parseFloat($first.css("marginRight")), maxwidth = $target.children('.wp-tb_product_list_content').width(), maxcols = Math.floor(maxwidth / (liwidth + mgnright)); if(maxwidth >= maxcols * (liwidth + mgnright) + liwidth) maxcols += 1; for(var i = 1,licnt = $li.length; i <= licnt; i++){ if (i % maxcols != 0) continue; if ((maxcols == 1) && (2*liwidth <= maxwidth)) continue; $li.filter(':eq('+(i - 1)+')').css("margin-right", '0'); } if(!$("#"+layerid).find('.wp-pager_link:visible').length){ var firstcol=($li.length % maxcols != 0)?(parseInt($li.length/maxcols)*maxcols+1):(($li.length/maxcols-1)*maxcols+1); for(var i = 1,licnt = $li.length; i <= licnt; i++){ if(i>=firstcol) $li.filter(':eq('+(i - 1)+')').css("margin-bottom", '7px'); } } layer_img_lzld(layerid); }) $(function(){ var maxliheight = 0,tmplayerid = "#"+layerid; if (tmplayerid.length == 1) return;var $tmpnode = $(tmplayerid+' li .wp-new-article-style-c'); $tmpnode.css('height',''); // fix bug 8231, setTimeout(function(){ maxliheight = Math.max.apply(null,$tmpnode.map(function(){return $(this).outerHeight();}).toArray()); if (productStyle == '01' && param.prdbacheight != '0') { maxliheight = param.prdbacheight; } if (maxliheight) { $tmpnode.height(maxliheight); if(!$(tmplayerid).data('not_need_heightadapt')) wp_heightAdapt($(tmplayerid)); } },0); // 右间距 2014/03/17 $(tmplayerid).triggerHandler("fixedmarginright"); // <-1){ var pageid = page||$(this).attr("href").replace("###",''); if(param.editmode == "1") $.method.tb_product_list.refreshProductList({"page":pageid,"layerid":layerid,"orderby":param.orderby,"ordertype":param.sortby}); else { var dom = $cstlayer.find('.tb_product_list_save_itemList'), params = {}; var liststyle={"prdliststyle":param.prdliststyle} var search_txt = $.trim($("#"+layerid).find('.search-input').val()); var startprice = $.trim($(".price-input").eq(0).val()); //取搜索开始价格值 var endprice = $.trim($(".price-input").eq(1).val()); //取搜索结束价格值 var product_category = $("#"+layerid).find("input[name='get_product_category']").val(); //分类产品分页丢失 if($("#"+layerid).find(".wp-pager_link").length){ var pagerlink=$("#"+layerid).find(".wp-pager_link"); if(pagerlink.css('position')=='relative'){ var pageparent=pagerlink.offsetParent(); var firstpageofpos2=pagerlink.offset().top-pageparent.offset().top; var oripagepos=$("#"+layerid).data('firstpageofpos'); if(oripagepos){ if(Math.abs(firstpageofpos2-oripagepos)<20) firstpageofpos2=oripagepos } $("#"+layerid).data('firstpageofpos',firstpageofpos2); } } $.ajax({ type: "GET", url: parseToURL("tb_product_list","get_page"), data: {product_category:param.product_category,layer_id: layerid,page: pageid,search_txt:search_txt,start_price:startprice,end_price:endprice,"orderby":param.orderby,"ordertype":param.sortby,"filter_arr":param.filter_arr}, success: function(data){ var $layer = $("#"+layerid); var oldHeight = $layer.find('.tb_product_list-'+layerid).height(); $layer.children('.wp-tb_product_list_content').before(data).remove(); var maxliheight = 0,tmplayerid = "#"+layerid; if (tmplayerid.length == 1) return;var $tmpnode = $(tmplayerid+' li .wp-new-article-style-c'); maxliheight = Math.max.apply(null,$tmpnode.map(function(){return $(this).outerHeight();}).toArray()); if (maxliheight) $tmpnode.height(maxliheight); // 右间距 2014/03/17 $(tmplayerid).triggerHandler("fixedmarginright"); // <0 && this_dom.find(".wp_filter_attr").css("display") !='none'){ old_attr = this_dom.find(".wp_filter_attr").outerHeight(); } var old_searchbox = 0; if(this_dom.find(".wp-tb_product_list_searchbox").length>0 && this_dom.find(".wp-tb_product_list_searchbox").css("display") !='none'){ old_searchbox = this_dom.find(".wp-tb_product_list_searchbox").outerHeight(); } if(cheight>oulheight+olkheight+old_attr+old_searchbox){ if(!this_dom.data('firstpageofpos')){ this_dom.find(".wp-pager_link").css({'position':'absolute','bottom':'0px','top':'','width':'100%','line-height':'23px'}) this_dom.find('.mCSB_container').css('min-height','100%'); }else{ var firstpageofpos=this_dom.data('firstpageofpos'); this_dom.find(".wp-pager_link").css({'position':'absolute','bottom':'','top':firstpageofpos+'px','width':'100%','line-height':'23px'}) this_dom.find('.mCSB_container').css('min-height','100%'); } } //explain:产品列表模块刷新后将页面定位到该模块距离浏览器顶部的距离,author:fpf,date:2014-12-18,action:modify; //1/定位到网站页首2/定位到产品列表页首 if(pageskips == 1){ $('#scroll_container').scrollTop(0); } else if(pageskips == 2){ var product_listtop = $cstlayer.css('top').replace('px',''); var father = $cstlayer.attr('fatherid')||''; if(father){ var father_top = $('#'+father).css('top').replace('px',''); product_listtop = parseInt(product_listtop)+parseInt(father_top); if($("#"+father).length>0){ var fathers = $("#"+father).attr('fatherid')||''; if(fathers){ var father_tops = $('#'+fathers).css('top').replace('px',''); product_listtop = parseInt(product_listtop)+parseInt(father_tops); } } } if(product_listtop){$('#scroll_container').scrollTop(product_listtop);} } } }); } return false; } }); if(param.editmode != "1"){ if($.cookie('wp_layer_page_'+layerid) && $.cookie('wp_layer_page_'+layerid) != param.curpage){ $pglnker.find('a:first').trigger('click',$.cookie('wp_layer_page_'+layerid)); } } // About input $pglnker.find('.pttypeinput').each(function(i,dom){ var $input = $(this),ent = pgid = '',fnc; switch($input.attr("type")) { case "text": ent = 'keyup'; fnc = function(){ pgid = this.value = this.value.replace(/(?:\b0|[^\d+])/i,''); //分页的style4样式的skin4皮肤,点击回车跳转到指定页面 var keycode = event.keyCode; if (keycode == 13) { var pagerstyle = $pglnker.parent().nextAll('.tb_product_list_save_itemList').attr('pagerstyle'); var pstarr = pagerstyle.split('index.html'),pstyle = pstarr[0],pskin = pstarr[1]; if (pstyle == 'style4' && pskin == 'skin4') { if (pgid.length && /^[1-9]{1}\d*$/.test(pgid)) { var maxpg = _int($pglnker.find('span.total').html()); if(!maxpg) maxpg = 1; var pagelink=$pglnker.find('a:first'); var urlhrf = pagelink.attr("href"); if(urlhrf.indexOf("##")>-1){ $pglnker.find('a').triggerHandler('click',[Math.min(pgid,maxpg)]); }else{ urlhrf=urlhrf.replace(/\d+$/,Math.min(pgid,maxpg)) location.href=urlhrf; } } } } function _int(numString){ var number = parseInt(numString); if(isNaN(number)) return 0; return number; } return false; }; break; case "button": ent = 'click'; fnc = function(){ if (pgid.length && /^[1-9]{1}\d*$/.test(pgid)) { var maxpg = _int($pglnker.find('span.total').html()); if(!maxpg) maxpg = 1; var pagelink=$pglnker.find('a:first'); var urlhrf = pagelink.attr("href"); if(urlhrf.indexOf("##")>-1){ $pglnker.find('a').triggerHandler('click',[Math.min(pgid,maxpg)]); }else{ urlhrf=urlhrf.replace(/\d+$/,Math.min(pgid,maxpg)) location.href=urlhrf; } } function _int(numString){ var number = parseInt(numString); if(isNaN(number)) return 0; return number; } return false; }; break; } if(fnc && $.isFunction(fnc)) $input[ent](fnc); }); }); } function layer_tb_product_list_refreshOrder_func(param){ var layerid=param.layer_id; window['refreshOrderby_'+layerid]=function(obj,flag) { var start_price = $.trim($('#'+layerid+' .price-input').eq(0).val()); var end_price = $.trim($('#'+layerid+' .price-input').eq(1).val()); var search_txt = $.trim($('#'+layerid).find('.search-input').val()); var search_name= $.trim($('#'+layerid).find('input[name="cityname"]').val()); var tmp_obj = {layer_id:layerid,search_name:search_name,location:$.trim($("#"+layerid).find("input[name='location']").val()),start_price:start_price,end_price:end_price,search_txt:search_txt,product_category:$.trim($("#"+layerid).find("input[name='get_product_category']").val() ||param.product_category)} //筛选属性 var attr_loop_str=[]; var filter_show = []; $('#'+layerid+' .wp_filter_attr .sorting').each(function(i){ var attr_loop = ''; attr_loop = $(this).find('.pttypeinput').val(); if(attr_loop) attr_loop_str.push(attr_loop); if ($(this).attr('isshow') == '1') { filter_show.push(i); } }); var attrid = obj; if($.isPlainObject(obj)){ attrid = obj.rm_attrid; delete obj.rm_attrid; } var isShow = $('#'+layerid+' .wp_filter_attr').data('show'); if(isShow){ var showContions = []; var j = 0; for(var n = 0; n < attr_loop_str.length; n++){ var tempArr = []; var tempStr = ''; var attrName = ''; var attrKey = ''; if(tempArr = attr_loop_str[n].split(',')){ if(tempArr.length > 1){ for(var m = 0; m < tempArr.length; m++){ attrName = $('#'+layerid+' .wp_filter_attr .sorting').find('a[attrval="'+tempArr[m]+'"]').text(); if(m == tempArr.length - 1){ tempStr += attrName; }else{ tempStr += attrName+','; } } attrName = tempStr; }else{ attrName = $('#'+layerid+' .wp_filter_attr .sorting').find('a[attrval="'+attr_loop_str[n]+'"]').text(); } attrKey = attr_loop_str[n]; showContions[j] = {'attrkey' : attrKey,'attrname': attrName}; j++; } } if(flag == 2){ showContions = showContions.filter(function (item) { return item.attrkey != attrid; }); } var vHtml = ''; for(var i = 0; i < showContions.length; i++){ vHtml += '
'; vHtml += '
'+showContions[i].attrname+'
'; vHtml += ''; vHtml += '
'; } } if(flag == 2){ attr_loop_str = attr_loop_str.filter(function (item) { return item != attrid; }); } attr_loop_str=attr_loop_str.join('$$$'); $("#"+layerid).find("input[name='filter_arr']").val(attr_loop_str); var filter_obj = {filter_arr:$.trim($("#"+layerid).find("input[name='filter_arr']").val())}; $.extend(tmp_obj,obj,filter_obj); var contentheight=$("#"+layerid+" .wp-tb_product_list_content").css('height'); tmp_obj.filter_show = filter_show.length>0?filter_show.join(','):''; $.ajax({ type:'POST', url:parseToURL('tb_product_list','orderby'), data:tmp_obj, success:function(data){ $("#"+layerid).html(data); if(isShow){ if(showContions.length > 0){ var chain = $('#'+layerid+' .wp_filter_attr .cont .selattrs'); chain.find('.nocondition').hide(); chain.prepend(vHtml); } } if(flag == 3){ $("#"+layerid).find('a[attrval="'+attrid+'"]').addClass('noHover'); $("#"+layerid).find('a[attrval="'+attrid+'"]').one('mouseleave',function(){ $(this).removeClass('noHover'); }); } if(contentheight && contentheight!='') $("#"+layerid+" .wp-tb_product_list_content").css('height',contentheight); $("#"+layerid).triggerHandler("fixedmarginright"); if (param.productStyle=== "01") { var maxliheight = 0,tmplayerid = "#"+layerid; var thisdom = $("#"+layerid).find(".img_lazy_load"); thisdom.each(function(){ $(this).fadeOut().fadeIn(100); $(this).attr("src",$(this).attr("data-original")); }); // fix bug 8231 和上边调用的代码重复,不用调用两遍 } var this_dom = $('#'+layerid); this_dom.find(".wp-pager_link").css({'position':'relative','bottom':'auto','width':'100%'}); setTimeout(function(){ if(!this_dom.data('not_need_heightadapt')) wp_heightAdapt(this_dom); var cheight = this_dom.find(".wp-product_content").height(); var oulheight = this_dom.find(".tb_product_list-"+layerid).height(); var olkheight = this_dom.find(".wp-pager_link").outerHeight(); var old_attr = 0; if(this_dom.find(".wp_filter_attr").length>0 && this_dom.find(".wp_filter_attr").css("display") !='none'){ old_attr = this_dom.find(".wp_filter_attr").outerHeight(); } var old_searchbox = 0; if(this_dom.find(".wp-tb_product_list_searchbox").length>0 && this_dom.find(".wp-tb_product_list_searchbox").css("display") !='none'){ old_searchbox = this_dom.find(".wp-tb_product_list_searchbox").outerHeight(); } if(cheight>oulheight+olkheight+old_attr+old_searchbox){ if(!this_dom.data('firstpageofpos')){ this_dom.find(".wp-pager_link").css({'position':'absolute','bottom':'0px','top':'','width':'100%','line-height':'23px'}) }else{ var firstpageofpos=this_dom.data('firstpageofpos'); this_dom.find(".wp-pager_link").css({'position':'absolute','bottom':'','top':firstpageofpos+'px','width':'100%','line-height':'23px'}) } } },200) } }); } }; var getScrollbarWidth = function() { var odiv = document.createElement('div'), styles = { width: '100px',height: '100px',overflowY: 'scroll'}, i, scrollbarWidth; for (i in styles) odiv.style[i] = styles[i]; document.body.appendChild(odiv); scrollbarWidth = odiv.offsetWidth - odiv.clientWidth; odiv.remove(); return scrollbarWidth; } var btnFloat =function(data,layid){ $layid = $('#'+layid) var btf_right = data.float_right?data.float_right:1 var btf_bottom = data.float_bottom?data.float_bottom:1 if(data.float_enable=='show'){ var gscrollWidth = 18; gscrollWidth = getScrollbarWidth(); btf_right = parseInt(gscrollWidth) + parseInt(btf_right); $layid.hide() var effects=$layid.data('wopop_effects'); var noclass='cstlayer'; if(effects&&effects.effect){noclass=' ';} $layid.removeClass(noclass).appendTo('body').attr('style','') .css({"position":"fixed","right":btf_right+"px","z-index": "999","bottom":btf_bottom+"px"}).show() } }