May 29, 2021 Article blog
Picture rotation is a commonly used effect on the web page, today W3Cschool small editor to give you a brief introduction to the picture scroll mouse after stopping effect how to implement with code, using CSS-DIV-Jquery is easy to achieve, let's see!
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="https://www.w3cschool.cn/" 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>
In the above html code, each set of DIV corresponding graphic data, can be increased or decreased on demand, margin_right properties control the spacing of the text, speed properties control the speed of carousel.
CSS:
@charset "utf-8";
/* www.w3cschool.cn */
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;}
Picture scroll switch effect code to share here, hope to help you, more programming learning please pay attention to the W3Cschool official website.