PDA

View Full Version : How to get image slider to stop after last image



klrman
02-21-2016, 07:17 AM
H, noob here :D

I am trying to get this image slider to stop after the last image is reached and still display that image so
that a user will have to hit the back button to move backwards again through the images until the first
one is reached again.

The way it works now, when the last image is reached, the next click forward moves the whole display upwards
with no image and I would rather it just can't move past the last image, except to move backwards again.

It is this dynamicdrive script http://www.dynamicdrive.com/dynamicindex14/dhtmlslide.htm

jscheuer1
02-21-2016, 04:23 PM
NOTE: The link in the above post was not to any script. I assumed you meant the one from your other post, which was essentially a duplicate of this post, but in the wrong section. If you have another script in mind, let us know.

This is an old script. I see it uses hash tag links as controls. Those can make a page jump to the top, but since the onclick event returns false, that shouldn't, and in fact doesn't happen for me. Some browsers might think though, once you're at the end, the return value is determined by something else. What browser and device are you using? Have you changed anything? If it is the hash tag link that's causing this, you can get rid of those. Where it has:


<tr>
<td width="50%" height="21"><p align="left"><a href="#" onClick="backward();return false">Previous Slide</a></td>
<td width="50%" height="21"><p align="right"><a href="#" onClick="forward();return false">Next Slide</a></td>
</tr>

Change that to:


<tr>
<td width="50%" height="21"><p align="left"><span style="cursor: pointer; color: navy;" onclick="backward();">Previous Slide</span></td>
<td width="50%" height="21"><p align="right"><span style="cursor: pointer; color: navy;" onclick="forward();">Next Slide</span></td>
</tr>

If you want more help, please answer the browser/device questions and post a link to the page on your site that contains the problematic code, so we can check it out.

klrman
02-22-2016, 02:18 AM
John, thanks for the help! I deleted the script and then copied it again and this time it works, so somehow the first time I must have not copied it incorrectly and left something out.
Now that it works, I will copy your above script to see what it does just for fun as I need to learn more about all this. Thanks again for taking the time to reply.