/    Sign up×
Community /Pin to ProfileBookmark

Image Scroll Help

I got some help thank you

to post a comment
JavaScript

14 Comments(s)

Copy linkTweet thisAlerts:
@bigredkacyauthorFeb 05.2005 — Please somone help me
Copy linkTweet thisAlerts:
@JPnycFeb 05.2005 — Because you initialized i=0 for the 2nd function too. So it's just starting at the beginning of the array, regardless of where it's called from. i should = 81 for the 2nd group. Also, your 1st function will throw an error since the array buckets 10 through 80 are missing, and in the 2nd half of the array, the opening " are missing.
Copy linkTweet thisAlerts:
@bigredkacyauthorFeb 05.2005 — I dont understand can you show me for the second one?
Copy linkTweet thisAlerts:
@JPnycFeb 05.2005 — Well 1st off, just declare 1 array, and declare it once, not twice, with buckets going from 0 to 19. You only have 20 images, right? Then the loop in the 1st function will be:

for (i=0;i<10;i++)



Then in your 2nd function the loop will be:

for (i=10;i<morphimages.length;i++)

Because the array is declared outside any function (globally) it can be accessed by any function on the page, without declaring it again.
Copy linkTweet thisAlerts:
@JPnycFeb 06.2005 — You see that array you have there with the images in it? Well just extend it to include the next 10 pics, so you add buckets 10 through 19. Then, just replace the for loops you have, with the ones i posted, and if the functions worked at all before, then they'll do what you want.
Copy linkTweet thisAlerts:
@bigredkacyauthorFeb 06.2005 — I tried to change the first one to

[Code]

for (i=0;i<;10;i++)
{
imageholder[i]=new Image()
imageholder[i].src=morphimages[i]
}

[/Code

I seem to get a error. Aim me at bigredkacy or msn at [email][email protected][/email]

Kacy
Copy linkTweet thisAlerts:
@JPnycFeb 06.2005 — Yes, because between the < and the 10 you have a ;

Remove it.
Copy linkTweet thisAlerts:
@bigredkacyauthorFeb 06.2005 — ok i got that part to work now i need to add 3 more of the same script.

For the second one you told me to do 10<morphimages but will that effect 3 and 4?

heres what i did for 2.

[CODE]
<SCRIPT language=JavaScript1.1>
<!--
var morphspeed=3000
var morphimages=new Array()

morphimages[11]="newitems/image41.jpg"
morphimages[12]="newitems/image42.jpg"
morphimages[13]="newitems/image43.jpg"
morphimages[14]="newitems/image44.jpg"
morphimages[15]="newitems/image45.jpg"
morphimages[16]="newitems/image46.jpg"
morphimages[17]="newitems/image47.jpg"
morphimages[18]="newitems/image48.jpg"
morphimages[19]="newitems/image49.jpg"
morphimages[20]="newitems/image50.jpg"

var morphlinks=new Array()
morphlinks[11]="www.test.com"
morphlinks[12]="www.test.com"
morphlinks[13]="www.test.com"
morphlinks[14]="www.test.com"
morphlinks[15]="www.test.com"
morphlinks[16]="www.test.com"
morphlinks[17]="www.test.com"
morphlinks[18]="www.test.com"
morphlinks[19]="www.test.com"
morphlinks[20]="www.test.com"

var imageholder=new Array()
var ie55=window._Blank

for for (i=10;<morphimages.length;i++)
{
imageholder[i]=new Image()
imageholder[i].src=morphimages[i]
}

function gotoshow()
{
sw=(screen.availWidth);
sh=(screen.availHeight);
theWin=window.open(morphimages[whichlink],'theWin','menubar=1,directories=1,status=1,buttons=1,toolbar=1,location=1,scrollbars=1,width='+sw+' ,height='+sh+',top=0,left=0');
}

document.write('<a href="javascript<B></B>:gotoshow(0);"><img name="morph" width="250" height="188" border=0 src="'+morphimages[0]+'" style="filter:progid:DXImageTransform.Microsoft.Fade(MaxSquare=15,Duration=1)"></a>')

var whichlink=0
var whichimage=0
var continueRun = true;
var pixeldelay=(ie55)? document.images.morph.filters[0].duration*1000 : 0

function morphit()
{
if(continueRun == true)
{
if (!document.images)
return
if (ie55)
document.images.morph.filters[0].apply()
document.images.morph.src=imageholder[whichimage].src
if (ie55)
document.images.morph.filters[0].play()
whichlink=whichimage
whichimage=(whichimage<morphimages.length-1)? whichimage+1 : 0
}
setTimeout('morphit()',morphspeed+pixeldelay)
}

morphit()
//-->
</script>

[/CODE]
Copy linkTweet thisAlerts:
@JPnycFeb 06.2005 — Just declare the array once, like this:

var morphimages=new Array()

morphimages[0]="newitems/image1.jpg"

morphimages[1]="newitems/image2.jpg"

morphimages[2]="newitems/image3.jpg"

morphimages[3]="newitems/image4.jpg"

morphimages[4]="newitems/image5.jpg"

morphimages[5]="newitems/image6.jpg"

morphimages[6]="newitems/image7.jpg"

morphimages[7]="newitems/image8.jpg"

morphimages[8]="newitems/image9.jpg"

morphimages[9]="newitems/image10.jpg"

morphimages[10]="newitems/image50.jpg"

morphimages[11]="newitems/image41.jpg"

morphimages[12]="newitems/image42.jpg"

morphimages[13]="newitems/image43.jpg"

morphimages[14]="newitems/image44.jpg"

morphimages[15]="newitems/image45.jpg"

morphimages[16]="newitems/image46.jpg"

morphimages[17]="newitems/image47.jpg"

morphimages[18]="newitems/image48.jpg"

morphimages[19]="newitems/image49.jpg"

Same goes for the array of links. They must be declared once like above. You only need repeat the function. Now if you're adding 20 more images, then extend this array to 39.

Now the variable "i" must be set to whatever number corresponds to the pic you want to begin with. I set it to 10 in the 2nd loop, because the 1st pic you're going to show, is in bucket number 10 in the array. for(i=10;i<20;i++)


So the next one will start with pic 20. Therefore i=20. Your array should end with 39. for(i=20;i<30;i++)

and the last one for(i=30;i<40;i++)

Copy and paste those loops into your functions, because the ones you posted contain typos that will throw errors.
Copy linkTweet thisAlerts:
@bigredkacyauthorFeb 06.2005 — sorry for all the trouble but i need it on all 4 corners on http://integy.automated-shops.com/randomin.html of the images.

wont the one script only show the same sections?
Copy linkTweet thisAlerts:
@JPnycFeb 06.2005 — One array with 40 images (0-39), but four functions. Each function will access and display 1/4th of the array, or 10 images. Function 1 shows pics 0-9, function 2, 10-19, function 3, 20-29, etc.

The array is not actually part of any of the functions. It's declared outside all of them (known as a global declaration), and when that's the case, they all have access to it.
Copy linkTweet thisAlerts:
@JPnycFeb 06.2005 — 1 question, are these supposed to run from the page load on, and continuously, or are they onclick? Because you already have 2 functions running on that page and your functions will slow down, if not stop, particularly on older slower machines.
Copy linkTweet thisAlerts:
@bigredkacyauthorFeb 06.2005 — they are supposed to run like the center one. if it will be easier to do them all i would do that. but i am not verygod at JS
Copy linkTweet thisAlerts:
@JPnycFeb 06.2005 — So you want to have 5 slide shows going plus that scrolling in the left column? Your page is going to crawl on any older machines. No idea how well a browser is gonna run 6 functions at once.
×

Success!

Help @bigredkacy spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...