首頁 >web前端 >js教程 >css transform 3D幻燈片特效實現步驟解讀_javascript技巧

css transform 3D幻燈片特效實現步驟解讀_javascript技巧

WBOY
WBOY原創
2016-05-16 17:39:101776瀏覽
js
複製代碼代碼如下:

$(function() {
var length = $(".container a").length
var $items = $(".container a");
$items.on("transitionend", function(event); {
$items.removeClass("trans")
});
$(".container a").each(function(index, value){
var $child = $( this );
if (index === 0) {
$child.addClass("目前顯示");
} else if (index === css transform 3D幻燈片特效實現步驟解讀_javascript技巧) {
$child.addClass ( "左顯示");
} else if (index == css transform 3D幻燈片特效實現步驟解讀_javascript技巧) {
$child.addClass("out-left")
} else if (index == (length - css transform 3D幻燈片特效實現步驟解讀_javascript技巧) ) {
$child.addClass("out-right")
} else if (index === (length - css transform 3D幻燈片特效實現步驟解讀_javascript技巧)) {
$child.addClass("右顯示")
} else {
$child.addClass("隱藏")};


$child.click(function(){
var $item = $( this);
//下一個項目
var $nextItem = (index === (length - css transform 3D幻燈片特效實現步驟解讀_javascript技巧)) ? $items.eq(0) : $items.eq(index css transform 3D幻燈片特效實現步驟解讀_javascript技巧); /上一項
var $preItem = (index === 0) ? $items.eq(length - css transform 3D幻燈片特效實現步驟解讀_javascript技巧) : $items.eq(index - css transform 3D幻燈片特效實現步驟解讀_javascript技巧);
var $rightItem;索引== 0){
$rightItem = $items. eq(length - css transform 3D幻燈片特效實現步驟解讀_javascript技巧);
} else if (index == css transform 3D幻燈片特效實現步驟解讀_javascript技巧) {
$rightItem = $items.eq(length - css transform 3D幻燈片特效實現步驟解讀_javascript技巧);
} else {
$rightItem = $items .eq(index - css transform 3D幻燈片特效實現步驟解讀_javascript技巧);
}
var $leftItem;
if(index == length - css transform 3D幻燈片特效實現步驟解讀_javascript技巧){
$leftItem = $items.eq(0);
} else if (index == length - css transform 3D幻燈片特效實現步驟解讀_javascript技巧) {
$leftItem = $items.eq(css transform 3D幻燈片特效實現步驟解讀_javascript技巧);
} else {
$leftItem = $items.eq(index css transform 3D幻燈片特效實現步驟解讀_javascript技巧);
}
//當前item點擊,返回
if ($item.hasClass("current")) {
return false;
} else if ($item.hasClass("left")) {
//居中右移
$preItem.attr("class","trans right shown");
//向左移動中心
$item.attr("class","trans目前顯示");
//右側項目移出
$rightItem.attr("class","trans out-right");
//向左下一步
$nextItem.attr( "class","trans left Showing");
//左就緒
$leftItem.attr("class","out-left");
} else if ($item.hasClass(" right")) {
//中心向左移動
$nextItem.attr("class","trans left displayed");
//右移中心
$item.attr(" class","trans current Showing");
//清除左側項目
$leftItem.attr("class","trans out-left");
//前一個向右移動
$preItem.attr("class","trans right shown");
//準備好了
$rightItem.attr("class","out-right");
};
});
});
});



html


代碼
代碼如下:



投影片標題>
>

頭>






身體>


css
複製程式碼程式碼如下:

body,div{邊距: 0;填色: 0;}
. container{寬度: css transform 3D幻燈片特效實現步驟解讀_javascript技巧00%;高度: css transform 3D幻燈片特效實現步驟解讀_javascript技巧50px;位置:相對;}
.container .wapper{margin: 0 auto;寬度:css transform 3D幻燈片特效實現步驟解讀_javascript技巧80像素;高度:300像素;位置:相對;-webkit-transform-style : keep-3d;-webkit-perspective:css transform 3D幻燈片特效實現步驟解讀_javascript技巧000px;-moz-transform-style:preserve-3d;-moz-perspective:css transform 3D幻燈片特效實現步驟解讀_javascript技巧000px;}
.container a{display:區塊;位置:絕對;左:0;頂部:0;-webkit-box-shadow:0px css transform 3D幻燈片特效實現步驟解讀_javascript技巧px css transform 3D幻燈片特效實現步驟解讀_javascript技巧px rgba(css transform 3D幻燈片特效實現步驟解讀_javascript技巧55,css transform 3D幻燈片特效實現步驟解讀_javascript技巧55,css transform 3D幻燈片特效實現步驟解讀_javascript技巧55,0.css transform 3D幻燈片特效實現步驟解讀_javascript技巧);-moz-box-shadow:0px css transform 3D幻燈片特效實現步驟解讀_javascript技巧px css transform 3D幻燈片特效實現步驟解讀_javascript技巧px rgba(css transform 3D幻燈片特效實現步驟解讀_javascript技巧55,css transform 3D幻燈片特效實現步驟解讀_javascript技巧55,css transform 3D幻燈片特效實現步驟解讀_javascript技巧55,0px css transform 3D幻燈片特效實現步驟解讀_javascript技巧px css transform 3D幻燈片特效實現步驟解讀_javascript技巧px rgba(css transform 3D幻燈片特效實現步驟解讀_javascript技巧55,css transform 3D幻燈片特效實現步驟解讀_javascript技巧55,css transform 3D幻燈片特效實現步驟解讀_javascript技巧55,0.css transform 3D幻燈片特效實現步驟解讀_javascript技巧); ) ;視線: 指針;}
.container a img{寬度: css transform 3D幻燈片特效實現步驟解讀_javascript技巧80px;高度: 300px;顯示:塊;父親: 0;}
.container .current{ z-index:css transform 3D幻燈片特效實現步驟解讀_javascript技巧;}
.容器.left{-webkit-transform:translateX(-350px)translateZ(-css transform 3D幻燈片特效實現步驟解讀_javascript技巧00px)rotateY(css transform 3D幻燈片特效實現步驟解讀_javascript技巧5deg);-moz-transform:translateX(-350px)translateZ(-css transform 3D幻燈片特效實現步驟解讀_javascript技巧00px)rotateY(css transform 3D幻燈片特效實現步驟解讀_javascript技巧5deg);z-index:css transform 3D幻燈片特效實現步驟解讀_javascript技巧css transform 3D幻燈片特效實現步驟解讀_javascript技巧css transform 3D幻燈片特效實現步驟解讀_javascript技巧css transform 3D幻燈片特效實現步驟解讀_javascript技巧 ; }
.container .right{-webkit-transform: 翻譯X(350px) 翻譯Z(-css transform 3D幻燈片特效實現步驟解讀_javascript技巧00px) 旋轉Y(-css transform 3D幻燈片特效實現步驟解讀_javascript技巧5deg);-moz-transform: 翻譯X(350px) 翻譯Z (-css transform 3D幻燈片特效實現步驟解讀_javascript技巧00px)rotateY ( -css transform 3D幻燈片特效實現步驟解讀_javascript技巧5deg);z-index:css transform 3D幻燈片特效實現步驟解讀_javascript技巧;}
.showing{不透明度:css transform 3D幻燈片特效實現步驟解讀_javascript技巧;可見性:可見;}
.hiding{不透明度:0;可見性:隱藏;}
. out -right{-webkit-transform:translateX(-css transform 3D幻燈片特效實現步驟解讀_javascript技巧50px)translateZ(-300px)rotateY(css transform 3D幻燈片特效實現步驟解讀_javascript技巧5deg);-moz-transform:translateX(-css transform 3D幻燈片特效實現步驟解讀_javascript技巧50px)translateZ(-300px)rotateY(css transform 3D幻燈片特效實現步驟解讀_javascript技巧5deg);zz-index:css transform 3D幻燈片特效實現步驟解讀_javascript技巧 ;不透明度: 0;可見性: 隱藏;}
.out-left{-webkit-transform:translateX(css transform 3D幻燈片特效實現步驟解讀_javascript技巧50px)translateZ(-300px)rotateY(-css transform 3D幻燈片特效實現步驟解讀_javascript技巧5deg);-moz-transform:translateX(css transform 3D幻燈片特效實現步驟解讀_javascript技巧50px)translateZ( - 300px)rotateY(-css transform 3D幻燈片特效實現步驟解讀_javascript技巧5deg);z-index: css transform 3D幻燈片特效實現步驟解讀_javascript技巧;不透明度:0;可見性:;}
.trans{-webkit-transition: 全部 css transform 3D幻燈片特效實現步驟解讀_javascript技巧 緩入秒;-moz-transition: 全部 css transform 3D幻燈片特效實現步驟解讀_javascript技巧 秒緩動-in-out; 過渡:全部css transform 3D幻燈片特效實現步驟解讀_javascript技巧 秒緩入出;}
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn