最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

CSS+jQuery實現(xiàn)的一個放大縮小動畫效果

 更新時間:2013年09月24日 11:35:16   作者:  
因為需求就只有4個元素。如果是要用CSS的class來處理,那就需要用到CSS3動畫了,好了下面為大家介紹下如何實現(xiàn)這個放大縮小動畫效果
今天幫朋友寫了一些代碼,自己覺得寫著寫著,好幾個版本以后,有點滿意,于是就貼出來。
都是定死了的。因為需求就只有4個元素。如果是要用CSS的class來處理,那就需要用到CSS3動畫了。
復制代碼 代碼如下:

<!DOCTYPE html>
<html>
<head>
<title> CSS+jQuery動畫效果 </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="鐵錨">
<style>
body{
z-index: 0;
width: 100%;
min-height: 400px;
}
.pages{
position: absolute;
}
.current{
position: absolute;
z-index: 12 !important;
left: 0px !important;
}
.page1{
background-color: #a5cfff;
z-index: 1;
width: 300px;
height:280px;
top: 100px;
left: 0px;
}
.page2{
background-color: #b1ca54;
z-index: 2;
width: 250px;
height:270px;
top: 160px;
left: 0px;
}
.page3{
background-color: #c2c6c9;
z-index: 3;
width: 200px;
height:260px;
top: 220px;
left: 0px;
}
.page4{
background-color: #ef9e9c;
z-index: 4;
width: 150px;
height:250px;
top: 250px;
left: 0px;
}
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>
$(function(){
// 增長
function increase($div,e){
var style = $div.attr("style");
$div.addClass("current").attr("styleold",style);
//
$div.stop();
$div.animate({
opacity:0.9,
width:"400px",
height: "400px",
top: "100px",
left: "0px"
},600)
.animate({
opacity:1.0
},30);

e.stopPropagation();
return false;
};
// 還原
function resize(e){
// 所有的都移除
var $page1 = $(".current.page1") ;
$page1.stop();
$page1.animate({
opacity:1.0,
width:"300px",
height: "280px",
top: "100px",
left: "0px"
},600,null,function(){
$page1.removeClass("current").attr("style","");
});

var $page2 = $(".current.page2") ;
$page2.stop();
$page2.animate({
opacity:1.0,
width:"250px",
height: "270px",
top: "160px",
left: "0px"
},600,null,function(){
$page2.removeClass("current").attr("style","");
});

var $page3 = $(".current.page3") ;
$page3.stop();
$page3.animate({
opacity:1.0,
width:"200px",
height: "260px",
top: "220px",
left: "0px"
},600,null,function(){
$page3.removeClass("current").attr("style","");
});

var $page4 = $(".current.page4") ;
$page4.stop();
$page4.animate({
opacity:1.0,
width:"150px",
height: "250px",
top: "250px",
left: "0px"
},600,null,function(){
$page4.removeClass("current").attr("style","");
});

e.stopPropagation();
return false;
};
//
$("#button1").unbind("mouseover").bind("mouseover",function(e){
//
var $page1 = $(".page1");
// 添加特定的
return increase($page1,e);

}).unbind("mouseout").bind("mouseout",function(e){
return resize(e);

});
//
$("#button2").unbind("mouseover").bind("mouseover",function(e){
//
var $page2 = $(".page2");
// 添加特定的
return increase($page2,e);

}).unbind("mouseout").bind("mouseout",function(e){
return resize(e);
});
//
$("#button3").unbind("mouseover").bind("mouseover",function(e){
//
var $page3 = $(".page3");
// 添加特定的
return increase($page3,e);

}).unbind("mouseout").bind("mouseout",function(e){
return resize(e);
});
//
$("#button4").unbind("mouseover").bind("mouseover",function(e){
//
var $page4 = $(".page4");
// 添加特定的
return increase($page4,e);

}).unbind("mouseout").bind("mouseout",function(e){
return resize(e);
});

//
$(".pages").unbind("mouseover").bind("mouseover",function(e){
//
var $this = $(this);
// 添加特定的
return increase($this,e);
}).unbind("mouseout").bind("mouseout",function(e){
// 所有的都移除
return resize(e);
});
//
$("body").click(function(e){
// 所有的都移除
return resize(e);
});
});
</script>
</head>

<body>
<div class="pages page1">page1</div>
<div class="pages page2">page2</div>
<div class="pages page3">page3</div>
<div class="pages page4">page4</div>

<div style="background-color: #a5cfff;">
<button id="button1">第一頁</button>
<button id="button2">第2頁</button>
<button id="button3">第3頁</button>
<button id="button4">第4頁</button>
</div>
</body>
</html>

相關文章

  • Jquery通過Ajax訪問XML數據的小例子

    Jquery通過Ajax訪問XML數據的小例子

    這篇文章主要介紹了Jquery通過Ajax訪問XML數據,有需要的朋友可以參考一下
    2013-11-11
  • jQuery插件zTree實現(xiàn)的基本樹與節(jié)點獲取操作示例

    jQuery插件zTree實現(xiàn)的基本樹與節(jié)點獲取操作示例

    這篇文章主要介紹了jQuery插件zTree實現(xiàn)的基本樹與節(jié)點獲取操作,結合實例形式分析了jQuery樹形插件zTree構造基本樹與針對節(jié)點的獲取操作相關實現(xiàn)技巧,需要的朋友可以參考下
    2017-03-03
  • jquery的extend和fn.extend的使用說明

    jquery的extend和fn.extend的使用說明

    jQuery.fn.extend(object); 對jQuery.prototype進得擴展,就是為jQuery類添加“成員函數”。jQuery類的實例可以使用這個“成員函數”。
    2011-01-01
  • jquery+swiper組件實現(xiàn)時間軸滑動年份tab切換效果

    jquery+swiper組件實現(xiàn)時間軸滑動年份tab切換效果

    這篇文章主要介紹了jquery+swiper組件實現(xiàn)時間軸滑動年份tab切換效果,本文通過實例代碼給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2021-12-12
  • jquery 仿QQ校友的DIV模擬窗口效果源碼

    jquery 仿QQ校友的DIV模擬窗口效果源碼

    本文使用大名頂頂的jquery來實現(xiàn)QQ校友的DIV模擬窗口,QQ的檢驗一些都是非常棒的
    2010-03-03
  • 詳解jQuery的表單驗證插件--Validation

    詳解jQuery的表單驗證插件--Validation

    jQuery Validate 插件為表單提供了強大的驗證功能,讓客戶端表單驗證變得更簡單,同時提供了大量的定制選項,滿足應用程序各種需求。本文主要對表單驗證插件-Validation進行案例分析,詳細介紹,具有很好的參考價值,需要的朋友一起來看下吧
    2016-12-12
  • JQuery拖拽元素改變大小尺寸實現(xiàn)代碼

    JQuery拖拽元素改變大小尺寸實現(xiàn)代碼

    "元素拖拽改變大小"其實和"元素拖拽"一個原理,以下附出源碼原型,弄明白了原理再擴展其他實際應用,思路就變得簡單、清晰得多了
    2012-12-12
  • jQuery操作value值方法介紹

    jQuery操作value值方法介紹

    這篇文章介紹了jQuery操作value值的方法,文中通過示例代碼介紹的非常詳細。對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2022-03-03
  • jquery使用jxl插件導出excel示例

    jquery使用jxl插件導出excel示例

    這篇文章主要介紹了jquery使用jxl插件導出excel的具體實現(xiàn)步驟,需要的朋友可以參考下
    2014-04-04
  • jquery實現(xiàn)直播彈幕效果

    jquery實現(xiàn)直播彈幕效果

    這篇文章主要為大家詳細介紹了jquery實現(xiàn)直播彈幕效果,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2019-11-11

最新評論

资源县| 丰城市| 武清区| 阿城市| 绍兴县| 和顺县| 黎城县| 普宁市| 芦溪县| 罗江县| 竹北市| 安宁市| 丹巴县| 阿尔山市| 甘德县| 温州市| 金山区| 永宁县| 若尔盖县| 田阳县| 宝兴县| 保山市| 白沙| 横峰县| 正阳县| 靖州| 扎囊县| 临泉县| 县级市| 新竹县| 楚雄市| 宽甸| 井陉县| 房产| 万年县| 厦门市| 泽普县| 阿城市| 浦县| 宁都县| 噶尔县|