Jquery Fade用法詳解
jquery淡入淡出演示
感覺用法都差不多,目前看來還比較簡單。
fadeIn
fadeOut
fadeToggle
fadeTo
一共4種用法
CSS代碼
<style> div{background-color:#eaeaea;border:solid 1px #999999;width:100px;height:100px;text-align:center;line-height:100px;font-size:16px;display:none;margin:10px;} </style>
JS代碼
<script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#one").click(function(){ $("#con_a").fadeIn(100); $("#con_b").fadeIn(500); $("#con_c").fadeIn(1000); }); $("#two").click(function(){ $("#con_a").fadeOut(100); $("#con_b").fadeOut(500); $("#con_c").fadeOut(1000); }); $("#three").click(function(){ $("#con_a").fadeToggle(100); $("#con_b").fadeToggle(500); $("#con_c").fadeToggle(1000); }); $("#four").click(function(){ $("#con_a").fadeTo("slow",0.5); $("#con_b").fadeTo("slow",0.7); $("#con_c").fadeTo("slow",0.9); }); }); </script>
HTML代碼
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>Jquery Fade demo</title> <style> div{background-color:#eaeaea;border:solid 1px #999999;width:100px;height:100px;text-align:center;line-height:100px;font-size:16px;display:none;margin:10px;} </style> <script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#one").click(function(){ $("#con_a").fadeIn(100); $("#con_b").fadeIn(500); $("#con_c").fadeIn(1000); }); $("#two").click(function(){ $("#con_a").fadeOut(100); $("#con_b").fadeOut(500); $("#con_c").fadeOut(1000); }); $("#three").click(function(){ $("#con_a").fadeToggle(100); $("#con_b").fadeToggle(500); $("#con_c").fadeToggle(1000); }); $("#four").click(function(){ $("#con_a").fadeTo("slow",0.5); $("#con_b").fadeTo("slow",0.7); $("#con_c").fadeTo("slow",0.9); }); }); </script> </head> <body> <h1>Jquery淡入淡出演示</h1> <button id="one">點(diǎn)擊我淡入</button> <button id="two">點(diǎn)擊我淡出</button> <button id="three">點(diǎn)擊我切換淡入淡出</button> <button id="four">透明度</button> <div id="con_a">1</div> <div id="con_b">2</div> <div id="con_c">3</div> </body> </html>
效果圖
到此這篇關(guān)于Jquery Fade用法詳解的文章就介紹到這了,更多相關(guān)Jquery Fade用法內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
EasyUI修改DateBox和DateTimeBox的默認(rèn)日期格式示例
本篇文章主要介紹了EasyUI修改DateBox和DateTimeBox的默認(rèn)日期格式示例,具有一定的參考價值,有興趣的可以了解一下。2017-01-01基于jquery的關(guān)于動態(tài)創(chuàng)建DOM元素的問題
在我們實(shí)際的項(xiàng)目之中,相信有很多的朋友直接使用了以下的格式創(chuàng)建DOM元素。2010-12-12js中獲取 table節(jié)點(diǎn)各tr及td的內(nèi)容簡單實(shí)例
下面小編就為大家?guī)硪黄猨s中獲取 table節(jié)點(diǎn)各tr及td的內(nèi)容簡單實(shí)例。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2016-10-10jquery實(shí)現(xiàn)textarea輸入字符控制(仿微博輸入控制字符)
首先獲取輸入框的值然后獲取輸入框的值;如果字?jǐn)?shù)大于500、發(fā)布按鈕禁用否從發(fā)布按鈕啟用,感興趣的朋友可以詳細(xì)了解下哈2013-04-04jQuery Ajax 加載數(shù)據(jù)時異步顯示加載動畫
這篇文章主要介紹了jQuery Ajax 加載數(shù)據(jù)時異步顯示加載動畫的相關(guān)資料,非常不錯,具有參考借鑒價值,需要的朋友可以參考下2016-08-08基于Jquery和CSS3制作數(shù)字時鐘附源碼下載(CSS3篇)
數(shù)字時鐘在web倒計時,web鬧鐘效果以及基于html5的web app中,本文給大家介紹基于jquery和css3制作數(shù)字時鐘附源碼下載,感興趣的朋友來看看吧2015-11-11