有人能幫助我嗎?我想爲我的網站創建這種類型的圖像滑塊。但事情是我看到過這樣的菜單,但沒有幻燈片。
請給我一些指導,讓這樣的幻燈片。
謝謝你我的朋友。
我不是在jQuery的天才..所以我只是嘗試做一些事情,但沒有工作..
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
#slideshow {
position:relative;
height:350px;
}
#slideshow IMG {
position:absolute;
top:0;
left:0;
z-index:8;
}
#slideshow IMG.active {
z-index:10;
}
#slideshow IMG.last-active {
z-index:9;
}
</style>
<script src="jquery-1.10.2.js"></script>
<script>
function slideSwitch() {
var $active = $('#slideshow IMG.active');
if ($active.length == 0) $active = $('#slideshow IMG:last');
var $next = $active.next().length ? $active.next()
: $('#slideshow IMG:first');
$active.addClass('last-active');
$next.css({width: 0})
.addClass('active')
.animate({width: 376}, 1000, function() {
$active.removeClass('active last-active');
});
}
$(function() {
setInterval("slideSwitch()", 5000);
});
</script>
</head>
<body>
<div id="slideshow">
<img src="images(1).jpg" alt="" height="134" class="active">
<img src="images.jpg" alt="" height="134">
<img src="3.jpg" alt="" height="134">
<img src="4.jpg" alt="" height="134">
<img src="5.jpg" alt="" height="134">
<img src="6.jpg" alt="" height="134">
</div>
</body>
</html>
你現在試過的是什麼?任何鏈接或代碼? –
@RununKathuria - 我用我試過的代碼更新了我的問題。我對jquery不太瞭解。所以這段代碼沒有做我需要做的事 – Yasitha
你用jQuery插件很好嗎?或者你想通過你自己來實現它? –