html5 - javascript image slider hyperlinks -


i working on website , client wants image slider each slide links different page on site. prefer if stay in javascript cant seem wrap head around jquery. here code

javascript code in header

`<script type="text/javascript">  <!--  var img1 = new image() img1.src="downtowneventnew.jpg" var img2 = new image() img2.src="shakespeare.jpg" var img3 = new image() img3.src="downtownconcertnew.jpg" var img4 = new image() img4.src="rangerettes.jpg" //--> </script> 

html 5 , javascript in body

 <div class="content">       <div id="slide">            <div class="slide_container"> <a href="restaurants.html"><img src="downtowneventnew.jpg" name="slide"  /> </a> <script type="text/javascript"> <!-- var pic =1 function slides() { if (!document.images) return  document.images.slide.src=eval("img" +pic+".src") if (pic < 4) pic++  else pic =1 settimeout("slides()",5000) } slides() //-->  </script>  </div>      </div> 

use plugin nivo slider (that way don't need develop jquery scratch), , wrap image in anchor tag <a>:

<div id="slider">     <img src="images/thing.jpg" alt="no link" />     <a href="http://www.cnn.com"><img src="images/thing2.jpg" title="link!" /></a> </div> 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -