App下載

網(wǎng)頁圖片滾動鼠標經(jīng)過停止效果代碼 圖片滾動切換效果

猿友 2021-03-12 16:53:49 瀏覽數(shù) (7711)
反饋

圖片輪播是網(wǎng)頁上經(jīng)常使用的效果,今天W3Cschool小編給大家簡單介紹一下圖片滾動鼠標經(jīng)過停止效果如何用代碼實現(xiàn),使用CSS+DIV+Jquery很容易就能實現(xiàn),一起來看看吧!

網(wǎng)頁圖片滾動鼠標經(jīng)過停止效果

HTML:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>不間斷圖片滾動在線演示 - W3Cschool</title>
<link href="images/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script src="jQuery-jcMarquee.js" type="text/javascript"></script>
<script>
$(function(){ 
    $('#Marquee_x').jcMarquee({ 'marquee':'x','margin_right':'10px','speed':10 }); 
}); 
</script>
</head>
<body>
<div id="mrq">
    <div id="Marquee_x">
        <ul>
            <li>
                <div>
<a href="http://o2fo.com/" target="_blank"><img src="images/1.jpg" />
<span>w3cschool</span></a></div>
                <div><a href="#" target="_blank"><img src="images/2.jpg" />
<span>演示內容</span></a></div>
                <div><a href="#" target="_blank"><img src="images/3.jpg" />
<span>演示內容</span></a></div>
                <div><a href="#" target="_blank"><img src="images/4.jpg" />
<span>演示內容</span></a></div>
                <div><a href="#" target="_blank"><img src="images/5.jpg" />
<span>演示內容</span></a></div>
                 <div><a href="#" target="_blank"><img src="images/6.jpg" />
<span>演示內容</span></a></div>
                <div><a href="#" target="_blank"><img src="images/7.jpg" />
<span>演示內容</span></a></div>
                <div><a href="#" target="_blank"><img src="images/8.jpg" />
<span>演示內容</span></a></div>
                <div><a href="#" target="_blank"><img src="images/9.jpg" />
<span>演示內容</span></a></div>
            </li>
        </ul>
    </div>
</div>
</body>
</html>

在以上的html代碼中,每組DIV對應圖文數(shù)據(jù),可按需增減,margin_right屬性控制圖文的間距,speed屬性控制輪播的速度。

CSS:

@charset "utf-8"; 
/* o2fo.com */ 
body, div, ul, li{margin:0; padding:0;font-style: normal;font:12px/22px "\5B8B\4F53",Arial, Helvetica, sans-serif} 
ol, ul ,li{list-style:none} 
img {border: 0; vertical-align:middle} 
body{color:#000000;background:#FFF; text-align:center} 
.clear{clear:both;height:1px;width:100%; overflow:hidden; margin-top:-1px} 
a{color:#000000;text-decoration:none}  
a:hover{color:#BA2636;text-decoration:underline} 
#mrq{width:900px; margin:20px auto;border:1px solid #000; padding:2px} 
#Marquee_x { overflow:hidden; width: 900px }  
#Marquee_x ul li ,#Marquee_x ul li div{ float:left;line-height:25px;overflow:hidden} 
#Marquee_x ul li div{ float:left;line-height:25px;height:130px; width:140px; overflow:hidden} 
#Marquee_x ul li div img{ border:1px solid #DADADA; width:130px; height:100px; display:block} 
#Marquee_x ul li div span{ display:block;} 

圖片滾動切換效果代碼就給大家分享到這里了,希望能對各位有所幫助,更多編程的學習請關注 W3Cschool 官網(wǎng)


0 人點贊