Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #25411 > unrolled thread

Trying to get a random image js to scroll left & right

Started bysuper70s <super70s@super70s.invalid>
First post2014-07-16 23:54 -0500
Last post2014-07-18 15:58 +0200
Articles 4 — 3 participants

Back to article view | Back to comp.lang.javascript


Contents

  Trying to get a random image js to scroll left & right super70s <super70s@super70s.invalid> - 2014-07-16 23:54 -0500
    Re: Trying to get a random image js to scroll left & right Gloops <gloops@zailes.invalid.org> - 2014-07-17 13:49 +0200
      Re: Trying to get a random image js to scroll left & right super70s <super70s@super70s.invalid> - 2014-07-17 14:16 -0500
    Re: Trying to get a random image js to scroll left & right "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-07-18 15:58 +0200

#25411 — Trying to get a random image js to scroll left & right

Fromsuper70s <super70s@super70s.invalid>
Date2014-07-16 23:54 -0500
SubjectTrying to get a random image js to scroll left & right
Message-ID<super70s-6AD519.23544116072014@reader.albasani.net>
Hi, I'm trying to get this JS of 150 images which load randomly to 
scroll left & right using arrows, similar to what Amazon.com does with 
their "Customers also bought..." movie suggestions. Anybody know how to 
fix this to get it to do that? Thank you.


<head>

<script type="text/javascript" src="randomAds.js"></script>

</head>

<p align="center">
<script type="text/javascript">
  randomorder(adblock, ' ')
</script>
</p>



Here's the accompanying randomAds.js text file:

var adblock=new Array()
adblock[0]='<a href="spcooperalice6.html"><img class="hover" 
src="http://www.myurl.com/mugshots/A/Alice_Cooper/images/Alice_Cooper12.g
if" class="imgBorder"></a>'
adblock[1]='<a href="spacdc.html"><img class="hover" 
src="http://www.myurl.com/mugshots/A/Angus_Young/images/Angus_Young4.gif"
 class="imgBorder"></a>'

...etc., etc., etc., 146 more images....

images/Warren_Zevon9.gif" class="imgBorder"></a>'
adblock[149]='<a href="foghat.html"><img class="hover" 
src="http://www.myurl.com/mugshots/D/images/Dave_Peverett3.gif" 
class="imgBorder"></a>'
adblock[150]='<a href="spmasondave.html"><img class="hover" 
src="http://www.myurl/mugshots/D/Dave_Mason/images/Dave_Mason2.gif" 
class="imgBorder"></a>'

function randomorder(targetarray, spacing) {
  var randomorder=new Array()
  var the_one
  var z=141
  for (i=0;i<targetarray.length;i++)
  randomorder[i]=i

  while (z<targetarray.length) {
    the_one=Math.floor(Math.random()*targetarray.length)
    if (targetarray[the_one]!="_selected!"){
      document.write(targetarray[the_one]+spacing)
      targetarray[the_one]="_selected!"
      z++
    }
  }
}

[toc] | [next] | [standalone]


#25416

FromGloops <gloops@zailes.invalid.org>
Date2014-07-17 13:49 +0200
Message-ID<lq8d8j$rr0$1@usenet.pasdenom.info>
In reply to#25411
super70s wrote, on 17 July 2014 06:54 UTC + 2 :
> Hi, I'm trying to get this JS of 150 images which load randomly to
> scroll left & right using arrows, similar to what Amazon.com does with
> their "Customers also bought..." movie suggestions. Anybody know how to
> fix this to get it to do that? Thank you.

Hello,

Perhaps it could help if you said what you obtain, which could induce 
what problem you meet ?


[toc] | [prev] | [next] | [standalone]


#25425

Fromsuper70s <super70s@super70s.invalid>
Date2014-07-17 14:16 -0500
Message-ID<super70s-8C857F.14165217072014@reader.albasani.net>
In reply to#25416
In article <lq8d8j$rr0$1@usenet.pasdenom.info>,
 Gloops <gloops@zailes.invalid.org> wrote:

> super70s wrote, on 17 July 2014 06:54 UTC + 2 :
> > Hi, I'm trying to get this JS of 150 images which load randomly to
> > scroll left & right using arrows, similar to what Amazon.com does with
> > their "Customers also bought..." movie suggestions. Anybody know how to
> > fix this to get it to do that? Thank you.
> 
> Hello,
> 
> Perhaps it could help if you said what you obtain, which could induce 
> what problem you meet ?

It's just a horizontal row of 8 gifs (size 66 x 99 pixels) out of a pool 
of 150.

I guess I'd have to add some kind of gifs for the arrow images, or maybe 
you could just use the "<" and ">" characters (in a much bigger size), I 
think that's how Amazon does it.

[toc] | [prev] | [next] | [standalone]


#25435

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2014-07-18 15:58 +0200
Message-ID<XnsA36EA293FA7EEeejj99@194.109.133.133>
In reply to#25411
super70s <super70s@super70s.invalid> wrote on 17 jul 2014 in 
comp.lang.javascript:

> Hi, I'm trying to get this JS of 150 images which load randomly to 
> scroll left & right using arrows

Try this, only made for webkit here, but can be extended.

The divs contaaining the numbers can be replaced by images 
of the right size. 

There is no theoretical limit to thenumber of images.

<http://hannivoort.org/temp/scrollleftandright.asp>

Too fast clicking will prevent nice scrolling 
and could/should be prevented by additional code. 

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web