looking for code to scroll images

Reply

Join Date: Dec 2008
Posts: 2
Reputation: ryan12193 is an unknown quantity at this point 
Solved Threads: 0
ryan12193 ryan12193 is offline Offline
Newbie Poster

looking for code to scroll images

 
0
  #1
Sep 23rd, 2009
I am building a website with many images. I am looking for a code that will scroll my images. i am looking for it to show like 3 pics then have arrows on either side so when you clik them (arrows) it will scroll to the next 3 pics. i have only been doing Xhtml and CSS for about 2 years so i am pretty new at this.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 315
Reputation: Thirusha is an unknown quantity at this point 
Solved Threads: 50
Thirusha's Avatar
Thirusha Thirusha is offline Offline
Posting Whiz

Re: looking for code to scroll images

 
0
  #2
Sep 23rd, 2009
I dont have one, but try google, there are loads of examples out there. You can search for "sroll images script" or "image slideshow"
Life... Is a Moment
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 302
Reputation: sreein1986 is an unknown quantity at this point 
Solved Threads: 33
sreein1986's Avatar
sreein1986 sreein1986 is offline Offline
Posting Whiz

Re: looking for code to scroll images

 
0
  #3
Sep 24th, 2009
Hi Use below Javascript where you want scrolling images in your html page

HTML and CSS Syntax (Toggle Plain Text)
  1. <SCRIPT LANGUAGE="JavaScript">
  2. var interval = 2; // delay between rotating images (in seconds)
  3. var random_display = 0; // 0 = no, 1 = yes
  4. interval *= 1000;
  5.  
  6. var image_index = 0;
  7. image_list = new Array();
  8. image_list = new Array();
  9. image_list[image_index++] = new imageItem("../Images/cdsamples/cd1.jpg"); // Your Image URL here
  10. image_list[image_index++] = new imageItem("../Images/cdsamples/cd2.jpg"); // Your Image URL here
  11. image_list[image_index++] = new imageItem("../Images/cdsamples/cd3.jpg"); // Your Image URL here
  12. image_list[image_index++] = new imageItem("../Images/cdsamples/cd4.jpg"); // Your Image URL here
  13. image_list[image_index++] = new imageItem("../Images/cdsamples/cd5.jpg"); // Your Image URL here
  14. image_list[image_index++] = new imageItem("../Images/cdsamples/cd6.jpg"); // Your Image URL here
  15. image_list[image_index++] = new imageItem("../Images/cdsamples/cd7.jpg"); // Your Image URL here
  16. image_list[image_index++] = new imageItem("../Images/cdsamples/cd8.jpg"); // Your Image URL here
  17. image_list[image_index++] = new imageItem("../Images/cdsamples/cd9.jpg"); // Your Image URL here
  18. image_list[image_index++] = new imageItem("../Images/cdsamples/cd10.jpg"); // Your Image URL here
  19. image_list[image_index++] = new imageItem("../Images/cdsamples/cd12.jpg"); // Your Image URL here
  20. image_list[image_index++] = new imageItem("../Images/cdsamples/cd13.jpg"); // Your Image URL here
  21. image_list[image_index++] = new imageItem("../Images/cdsamples/cd14.jpg"); // Your Image URL here
  22. image_list[image_index++] = new imageItem("../Images/cdsamples/cd15.jpg"); // Your Image URL here
  23. var number_of_image = image_list.length;
  24. function imageItem(image_location) {
  25. this.image_item = new Image();
  26. this.image_item.src = image_location;
  27. }
  28. function get_ImageItemLocation(imageObj) {
  29. return(imageObj.image_item.src)
  30. }
  31. function generate(x, y) {
  32. var range = y - x + 1;
  33. return Math.floor(Math.random() * range) + x;
  34. }
  35. function getNextImage() {
  36. if (random_display) {
  37. image_index = generate(0, number_of_image-1);
  38. }
  39. else {
  40. image_index = (image_index+1) % number_of_image;
  41. }
  42. var new_image = get_ImageItemLocation(image_list[image_index]);
  43. return(new_image);
  44. }
  45. function rotateImage(place) {
  46. var new_image = getNextImage();
  47. document[place].src = new_image;
  48. var recur_call = "rotateImage('"+place+"')";
  49. setTimeout(recur_call, interval);
  50. }
  51. // End -->
  52. </SCRIPT>
Last edited by sreein1986; Sep 24th, 2009 at 12:30 pm.
Thanx,
Shiriyal

http://shiriyal.blogspot.com/
if you problem solved add me as a reputation and mark it mark as solved
Reply With Quote Quick reply to this message  
Reply

Tags
code, image, images, jpeg, multimedia, scroll, website

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC