Good day! Need a slider:
there are five blocks on the left, and there is a block with a picture on the right, and you need to make sure that when: hover on the left the corresponding img is displayed. Share the link or show an example plz.
Good day! Need a slider:
there are five blocks on the left, and there is a block with a picture on the right, and you need to make sure that when: hover on the left the corresponding img is displayed. Share the link or show an example plz.
jquery? www.jquery.org
script is something like
$(document).ready( function(){ $(".leftBlock").hover(function(){ $("#image").attr("src",$(this).attr("image_src"))}, function(){$("#image").attr("src","default_image_url");} });
left divs are made by the leftBlock class, and in the diva attribute image_src we write the url pictures for display in the div with id = "image"
<html> <head> <script type = "text/javascript"> $(document).ready( function(){ $(".leftBlock").hover(function(){ $("#image").attr("src",$(this).attr("image_src"))}, function(){$("#image").attr("src","default_image_url");} }); </script> </head> <body> <div class="leftBlock" image_src="image1.jpg"> Left Block 1 </div> <div class="leftBlock" image_src="image2.jpg"> Left Block 2 </div> <div class="leftBlock" image_src="image3.jpg"> Left Block 3 </div> <div class="leftBlock" image_src="image4.jpg"> Left Block 4 </div> <div class="leftBlock" image_src="image5.jpg"> Left Block 5 </div> <div id="image_div" ><img id="image" src="default.jpg"/></div> </body> </html>
Source: https://ru.stackoverflow.com/questions/112996/
All Articles