我一直在努力解决这个谜团近2个小时,这让我很头疼。我已经尝试了2个插件,而且我总是得到“*不是函数”。我的代码与示例完全相同,所以我不知道为什么它不起作用。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>asd</title>
<script type="text/javascript" src="jquery.js"></script>
<script type='text/javascript' src='serial/jquery.scrollTo.js'></script>
<script type='text/javascript' src='serial/jquery.serialScroll.js'></script>
<script type="text/javascript">
$(document).ready(function(){
$('#slider').serialScroll({
items:'li',
offset:-230, //when scrolling to photo, stop 230 before reaching it (from the left)
start:1, //as we are centering it, start at the 2nd
duration:1200,
force:true,
stop:true,
lock:false,
cycle:false, //don't pull back once you reach the end
easing:'easeOutQuart', //use this easing equation for a funny effect
jump: true //click on the images to scroll to them
});
});
</script>
</head>
<body>
<div id="slider">
<ul>
<li><img width="500" height="500" src="dummy/dummy.jpg" alt="Css Template Preview" /></li>
<li><img width="500" height="500" src="dummy/dummy1.jpg" alt="Css Template Preview" /></li>
<li><img width="500" height="500" src="dummy/dummy2.jpg" alt="Css Template Preview" /></li>
<li><img width="500" height="500" src="dummy/dummy3.jpg" alt="Css Template Preview" /></li>
</ul>
</div>
</body>
</html>
我必须错过那里必不可少的东西,因为我什么都没看错。 我正在使用jQuery 1.4.2。还有我试过的插件 - Easy Slider,jQuery serial scroll
答案 0 :(得分:4)
我假设这两行中的src
属性:
<script type='text/javascript' src='serial/jquery.scrollTo'></script>
<script type='text/javascript' src='serial/jquery.serialScroll'></script>
应以.js
<script type='text/javascript' src='serial/jquery.scrollTo.js'></script>
<script type='text/javascript' src='serial/jquery.serialScroll.js'></script>