1) Script Title: Text and Image Crawler
2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...wler/index.htm
3) Describe problem: I would like to know if there is a way to randomize which image shows up first.
1) Script Title: Text and Image Crawler
2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...wler/index.htm
3) Describe problem: I would like to know if there is a way to randomize which image shows up first.
Use this modified version of the crawler.js file named here as crawler_rand.js (right click and choose 'save as'):
Attachment 3153
Change this on your page as highlighted:
Then you may add to your on page init, for example (highlighted):Code:<script type="text/javascript" src="crawler_rand.js"> /* Text and/or Image Crawler Script ©2009-2010John Davenport Scheuer as first seen in http://www.dynamicdrive.com/forums/ username: jscheuer1 This Notice Must Remain for Legal Useupdated: 02/16/2010 for random image order option*/ </script>
Code:<script type="text/javascript"> marqueeInit({random: true,uniqueid: 'art', direction: 'right', style: { //style object for this marquee container (use quotes on both sides of the : as shown) 'width': '60%', 'height': '235px', 'background-color': '#ddd', 'border': '1px solid #111', 'margin': '2ex auto 0 auto'}, inc: 6, //speed - pixel increment for each iteration of this marquee's movement moveatleast: 4, mouse: 'cursor driven' //mouseover behavior ('pause' 'cursor driven' or false) }); </script>
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Thank you John. This definitely randomizes the images. But it also seems to randomize which hyperlink is assigned to which image. Is there anyway to keep the images with their hyper links? Perhaps wrap them in a <div> or something like that?
You said images. No matter. We can make the tag the option, use this version:
Attachment 3155
Change this on your page as highlighted (from the last changes):
Then you may add to your on page init, for example (highlighted):Code:<script type="text/javascript" src="crawler_rand_2.js"> /* Text and/or Image Crawler Script ©2009-2010 John Davenport Scheuer as first seen in http://www.dynamicdrive.com/forums/ username: jscheuer1 This Notice Must Remain for Legal Use updated: 02/18/2010 for randomtagorder option */ </script>
That tells it to use theCode:<script type="text/javascript"> marqueeInit({ random:'a', uniqueid: 'art', direction: 'right', style: { //style object for this marquee container (use quotes on both sides of the : as shown) 'width': '60%', 'height': '235px', 'background-color': '#ddd', 'border': '1px solid #111', 'margin': '2ex auto 0 auto'}, inc: 6, //speed - pixel increment for each iteration of this marquee's movement moveatleast: 4, mouse: 'cursor driven' //mouseover behavior ('pause' 'cursor driven' or false) }); </script>'a'tags. Since the images are inside those tags, they will be randomized right along with them and retain their relationship to them. It assumes that all of the images are linked. If there were no links, one could specify'img'. Divisions shouldn't be used in the crawler because they will introduce line breaks. But if you were to have a mixture of linked and non-linked images, one could use span tags, ex:
and in the init:HTML Code:<span><a href="../files/photo1.jpg"><img src="../files/photo1.jpg" alt=""></a></span> <span><img src="../files/photo2.jpg" alt=""></span>
Code:marqueeInit({ random:'span', unique . . .
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Brilliant. Thank you very much. I do have a mix of images with and without links so the span option is perfect. Thank you again.
Bookmarks