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

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -