JavaScript external slideshow pointing to div in html
I'm moving a website from aspx to html. The slideshow worked fine in aspx, but not in html. I must point the external javascript to the correct <div>
. I am a newbie. Do I change the script or do I add something before the <div>
?
Here's the script:
<script src="js/jquery.cycle.xxx.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#testImages').cycle({
fx: 'fade',
prev: '#prev',
next: '#next',
pager: '#fbPager',
pause: 1,
timeout: 8000
});
});
</script>
And here's the <di开发者_StackOverflowv>
containing the images:
<div id="xxxxx 2">
<div id="testImages2">
<a href="page1.html" target="_blank">
<img src="images/1.jpg" alt="xxxxxxxxxx" /></a>
<a href="page2.html">
<img src="images/2.jpg" alt="xxxxxxxxxx" /></a>
<a href="page3.html">
<img src="images/3.jpg" alt="xxxxxxxxxx" /></a>
<a href="page4.html">
<img src="images/4.jpg" alt="xxxxxxxxxx" /></a>
<a href="http://www.5.com/" target="_blank">
<img src="images/5.jpg" alt="xxxxxxxxxx" height="200px" width="300px" style="border: none" /></a>
<a href="http://www.6.htm" target="_blank">
<img src="images/6.jpg" alt="xxxxxxxxxx" /></a>
</div>
<div id="nxNav2">
<div id="px2"> <a href="#" title="xxxxxxx">
<img src="images/px.png" alt="xxxxxx" height="22" width="16" /></a></div>
<div id="xxPager2"></div>
<div id="nx2"> <a href="#" title="xxxxxxx">
<img src="images/nx.png" alt="xxxxx" height="22" width="16" /></a></div>
</div>
</div>
You'll need to include jQuery just before you include the jQuery plugin...
<script type="text/javascript" src="/your/path/jquery.min.js"></script>
<script src="js/jquery.cycle.xxx.min.js" type="text/javascript"></script>
Also, you are selecting #testImages
in your script:
$('#testImages').cycle({ ....
But your <div>
is called #testImages2
in your HTML:
<div id="testImages2">
You'll have to edit one or the other to make those the same.
精彩评论