Web Design Forum  
 
Go Back   Web Design Forum > Web Software > Scripts

Reply
 
LinkBack Thread Tools Display Modes
Old 05-10-2011, 07:28 PM   #1
New Member
 
Join Date: Mar 2011
Posts: 13
Default Javascript scrolling images

Hey there,

wondering if I could also for a bit of advice, I'm using a Javascript to scroll images on the homepage of a site i'm working on...

what I ideally want to do it have each image as a h ref linking to a page within the site.

If i try to assign this in the .js file it stops to scrolling function.

Does anyone know a way around this?

below is my javascript.... if anyone can help it'd be greatly appreciated.

var imgs = new Array(); var imgcnt = 0; var thisimg = 0;
imgs[imgcnt++] = 'images/tiarasindex.gif';
imgs[imgcnt++] = 'images/braceletsindex.gif';
imgs[imgcnt++] = 'images/earringsindex.gif';
imgs[imgcnt++] = 'images/necklaceindex.gif';
imgs[imgcnt++] = 'images/vintageindex.gif';
imgs[imgcnt++] = 'images/shoesindex.gif';
imgs[imgcnt++] = 'images/accessoriesindex.gif';
imgs[imgcnt++] = 'images/bridesmaidindex.gif';


function nextImg() {
if (document.images) {
thisimg++;
if (thisimg >= imgcnt) thisimg = 0;
document.rollimg.src = imgs[thisimg];
}
}
function prevImg() {
if (document.images) {
thisimg--;
if (thisimg < 0) thisimg = imgcnt-1;
document.rollimg.src = imgs[thisimg];
}
}
JONNYB is offline   Reply With Quote


Old 05-10-2011, 09:40 PM   #2
Gold Member
 
Join Date: Feb 2011
Location: Australia
Posts: 369
Default

Are you getting any script errors?

Double check all your paths. Is your .js file in a subfolder or in the root directory?
__________________
Jason H.
DHDdirect.com
Domains - Hosting - Design
DHDdirect is offline   Reply With Quote
Old 05-12-2011, 02:40 PM   #3
New Member
 
Join Date: Mar 2011
Posts: 13
Default

hey, so the code ifs all right and the whole thing works (i.e. scroll etc) the problem appears to be with the href.

The .js file is saved in the route directory, but again that is working as the scroll is good.

When I'm adding the Href in, it's in the .js file also, do you know if this is meant to be possible?
JONNYB is offline   Reply With Quote
Old 05-21-2011, 11:32 AM   #4
New Member
 
Join Date: Mar 2011
Posts: 13
Default

sorry to be a pain but anyone got an idea on this one? driving me nuts!
JONNYB is offline   Reply With Quote
Reply

Tags
images, javascript, scrollbar

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 07:43 PM.


Camera Forum - Computer Forum - Web Design Forum

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.