...

View Full Version : Previous/Next



bigblondehead
11-18-2010, 02:55 PM
Hi there. I am sort of a mid-level javascripter, and I'm wondering if anyone would know a code I could use to make these previous/next buttons active. The reason I can't figure it out is that the thumbnails below currently control which image appears above, and I'd like the previous/next to also do so, but in the relative order of the corresponding thumbnails. I'd image there would be some way or specifying the current image, and adding either +1 or -1 or something along those lines? any help would be greatly appreciated. Page link below.

http://www.annaleithauser.com/rosemariehowe/country.html

sybil6
11-18-2010, 05:45 PM
Why dont you use a jQuery prev/next fadeIn/fadeOut gallery, it will do the job much better and easier. Ex: http://www.1stwebdesigner.com/design/fresh-jquery-image-gallery-display-solutions/

bigblondehead
11-18-2010, 06:05 PM
thanks for the response...I've never used that and my only hesitation is that I have so much else going on in my gallery already...the thumbnails slide in and out, and I have all the images swapping correctly. Is there any type of script that would just either add or subtract 1 to the name of the currently displayed image?

Old Pedant
11-18-2010, 08:43 PM
I think we could do that, but you have a bigger error that you should fix, first.

If I click on the >> arrow at the right of the thumbnails and then click on any thumbnail, I get a SPRY error message. Should you figure that bug out, first?

But in the meantime, another problem you have is that ancient ancient DreamWeaver code in there. That stuff is so old, it creaks. Was used when computers still were larger than trucks. (Oh, okay....slight exaggeration.)

Pretty much you should get rid of anything that starts with "MM_".

And your code is FIGHTING itself!!!

You have this:


<a onclick="MM_affectAppearFade( ... ) ...>
<img ... onclick="MM_swapImage( ... ) ...>
</a>

ONE of those onclicks needs to go! But better would be to scrap *all* MM_ stuff.

Ahh...I figured out why you get the SPRY error I noted!!!

Your large image is

<img id="country_1" ...>

Yet in one of the two sliding panels, all the onclick's refer to


<a onclick="MM_affectAppearFade('city_1', ... ) ...>
<img ... onclick="MM_swapImage('city_1', ... ) ...>
</a>
and of course there is no such ID as "city_1", so *KABLOOEY*.

Anyway, fix the basic problems first, then let's talk about next/previous.

And if AT ALL possible, stop using DreadWalker. DuckWaster would have been better named "Nigthmare Weaver".

bigblondehead
11-18-2010, 11:44 PM
Great...thank you for all that. I see that the onclicks were clashing...so does the code I have for the 1st thumbnail look better? It seems to be creating the same problem when I put it online (it, along with all the other ones, works perfectly locally on my computer).

Here's the code for that 1st thumbnail:

<a href="#" onclick="MM_effectAppearFade('country_1', 2000, 0, 100, false); MM_swapImage('country_1','','images/country_1.jpg',1); changeCaption('1/12')"><img src="images/country_t1.jpg" name="country_t1" class="ibdr" width="45" height="45" id="country_t1" style="margin-right:1px"></a>



Thanks!

bigblondehead
11-18-2010, 11:44 PM
Great...thank you for all that. I see that the onclicks were clashing...so does the code I have for the 1st thumbnail look better? It seems to be creating the same problem when I put it online (it, along with all the other ones, works perfectly locally on my computer).

Here's the code for that 1st thumbnail:

<a href="#" onclick="MM_effectAppearFade('country_1', 2000, 0, 100, false); MM_swapImage('country_1','','images/country_1.jpg',1); changeCaption('1/12')"><img src="images/country_t1.jpg" name="country_t1" class="ibdr" width="45" height="45" id="country_t1" style="margin-right:1px"></a>



Thanks!

Old Pedant
11-19-2010, 12:22 AM
As I said, the problem with the slow images is because you are not pre-loading the large images.

DreamWeaver does have a standard function for doing this. Or you could find one online. Or if you can't find one, I guess I could try creating one. But if I did that, I'd want to rewrite it all. <grin/>

In the long run--and not very long--you'd be much better off just getting rid of *ALL* the DW code (anything that starts with MM_) and going entirely to some other library. Spry, if it will do it all. Something else, if not.

bigblondehead
11-19-2010, 11:25 AM
I guess I'm more of a novice than I thought...so anyhow it seems I've got the image problem solved...the thing I really need now is to focus on the Previous/Next buttons. Any thoughts on those? I really don't know how to start. Thanks!

Philip M
11-19-2010, 12:32 PM
And if AT ALL possible, stop using DreadWalker. DuckWaster would have been better named "Nightmare Weaver".

Old Pedant, you know very well that it's name is ScreamWeaver. :D

bigblondehead - I do suggest you follow this advice. :)

bigblondehead
11-19-2010, 02:50 PM
Thank you all for your advice, but the thing I'm most concerned with now is the previous/next button. I like the way the page is currently functioning, and I'd just like to add functionality to those two. Thanks a lot!

Old Pedant
11-19-2010, 07:15 PM
Okay...do you want them to move from set to set? That is, when you go NEXT from #12, does it move to #1 in the other set of 12??? Or should it cycle back to #1 in the current set? (The latter will be easier, because if you change sets you have to also change which sub-panel is showing.) Or do you want it to not cycle? (But then you have to provide a visual indication that the end has been reached, so cycling is easier.)

bigblondehead
11-19-2010, 08:20 PM
I want it to actually go to the next image in the same set (or if it was image 12 in the 1st set, then image 1 from the next set--which I guess would have to load the 2nd set of lower images as well.) So If you're looking at picture 4, I'd like "next" to display picture 5, or "previous" to display picture 3. Ok let me know if that isn't clear, I'm struggling over here!

Old Pedant
11-19-2010, 08:25 PM
*SIGH* Even after I tell you that going to the next set is harder?

Okay, if I get time I'll muck with it.

It's some really really messy code, so it's not as trivial as it should be.

Old Pedant
11-20-2010, 12:05 AM
I'm going to push back one last time.

Did you see this demo?
http://coffeescripter.com/code/ad-gallery/

That is *SO* close to what you have *AND* it has several additional nice features.
Including the ability to put captions on the images, if you want. Including a timed slide show if you want. *AND* it even has the preload built in, so you won't see the problem you have now with new images.

It would take a lot of work to take that thing you have now up to this level.

bigblondehead
11-21-2010, 10:06 AM
Thanks, that is very nice, but the client definitely wants a previous/next button. Is there no simple way?

Old Pedant
11-21-2010, 10:20 PM
Adding previous/next to that ad-gallery code would be much much easier than adding it to the code you are using.

The complication in your code is the use of those two panels. So that to go next from the last image in one panel to the first in the next means swapping panels along with everything else.

In addition to which, the code itself is pretty poorly written. There no reason to have to call *TWO* functions just to change to another image. And the fact that it uses inline styles and obsolescent coding and....well, it's just pretty much a mess.

I think I warned you that if you insisted on keeping the panels and also the previous/next that I would want to rewrite it all from scratch. I think it wouldn't be much more work to do that than to attempt to change this sow's ear into a silk purse.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum