
Computer Desk DH006
Product information for Computer Desk DH006
$126.99
$86.9931% OFF
.pcA{display: block!important;} .phA{display: none!important;} #CKTA>div{position: relative} @media screen and (max-width:800px) { .pcA{display: none!important;} .phA{display: block!important;} } < > < > // = 800 && screen.width >= screen.height) { $(".box>.ph_bf").remove() }else { $(".box>.pc_bf").remove() } }); var prevIndex = 0; var curIndex = 0; $(".next").click(function() { var box=$(this).parent(); prevIndex=box.attr("previndex"); curIndex=box.attr("curindex"); //.is(":animated"):正在执行动画返回true,没在执行动画返回false if (box.children("img").eq(curIndex).is(":animated")) { return; } if (curIndex >= box.children("img").length - 1) { curIndex = 0; } else { curIndex++ } tab(box); prevIndex = curIndex; box.attr("previndex",prevIndex); box.attr("curindex",curIndex); }); $(".prev").click(function() { var box=$(this).parent(); prevIndex=box.attr("previndex"); curIndex=box.attr("curindex"); if (box.children("img").eq(curIndex).is(":animated")) { return; } if (curIndex <= 0) { curIndex = box.children("img").length - 1; } else { curIndex--; } tab(box); prevIndex = curIndex; box.attr("previndex",prevIndex); box.attr("curindex",curIndex); }); $(".nav li").click(function() { var box=$(this).parent().parent(); prevIndex=box.attr("previndex"); curIndex=box.attr("curindex"); if (box.children(".LBbox").eq(curIndex).is(":animated")) { return; } curIndex = $(this).index(); if (curIndex == prevIndex) { return; } tab(box); prevIndex = curIndex; box.attr("previndex",prevIndex); box.attr("curindex",curIndex); }); //左边按钮:向右边滑动; function tab(box) { var LBIdx = box.attr("lbindex"); //切大图; if (curIndex == 0 && prevIndex == $(".LB"+LBIdx+" .nav li").length-1) { //边界2,当前在最后一张,点击next //向左滑动:前一张向左滑动,当前那一张摆放在右边,滑动到当前位置; box.children("img").eq(prevIndex).animate({ left: -100+"%" }, 500) box.children("img").eq(curIndex).css("left", "100%").animate({ left: 0 }, 500) } else if (prevIndex == 0 && curIndex == $(".LB"+LBIdx+" .nav li").length-1 ) { //边界1,当前在第一张,点击prev //向右滑动:前一张向右滑动,当前那一张摆放在左边,滑动到当前位置 box.children("img").eq(prevIndex).animate({ left: 100+"%" }, 500) box.children("img").eq(curIndex).css("left", "-100%").animate({ left: 0 }, 500) } else if (curIndex > prevIndex) { box.children("img").eq(prevIndex).animate({ left: -100+"%" }, 500) box.children("img").eq(curIndex).css("left", "100%").animate({ left: 0 }, 500) } else { box.children("img").eq(prevIndex).animate({ left: 100+"%" }, 500) box.children("img").eq(curIndex).css("left", "-100%").animate({ left: 0 }, 500) } //切小点; $(".LB"+LBIdx+" .nav li").eq(curIndex).addClass("on").siblings().removeClass() } // ]]>