Alright, This is really messy, but it works. If anyone's got any tips
on cleaning it up, have at it.

   if ($('body').is('#page-photography')) { //I only want it to fire
on one page. Guessing I save some miniscule amount of overhead on the
other pages.
                var loc = window.location.hash; // get the anchor from the link,
so http://www.example.com/index.php#test would give me #test
                loc = loc.replace(/\#/g,""); // remove the pound symbol to give
me just test
                var j = 0; // set a variable i'll be incrementing later. i have
to do this because of some messy html later on.
                var goHere = 0; //set this so that, no matter what, the
startingSlide parameter gets something
                $("#view-photos-block_1").children().children().each(function(i)
{ //i'm sure this could be cleaner. that might also be able to remove
the j variable.
                        if($(this).attr('id')) { //find out if there even is an 
id
attribute; important because this is what controls j incrementin
                                if($(this).attr('id') == loc) { //if the id and 
the anchor are
the same, set goHere. this will later be used as the startingSlide
parameter
                                        goHere = j;
                                        }
                                j++; //increment j; this give me the real 0 
index of the slide.
                                }
                })
        }

When I've got a site up, I can post a link. In any case, this works.
Maybe in the future, something much better than this could be
implemented into cycle; for startingSlide, take either a zero-indexed
slide, or an of the slide? Just a thought... No idea how hard it would
be to implement.

Thanks for all the pointers.

Isaac

On Oct 22, 10:50 pm, isaacn <[EMAIL PROTECTED]> wrote:
> Thanks. I'll give it a shot.
>
> Isaac
>
> On Oct 22, 7:08 pm, Mike Alsup <[EMAIL PROTECTED]> wrote:
>
> > Well, Cycle won't do that for you, but it lets you tell it which slide
> > you want it to start on.  So when your pages loads you can interrogate
> > the current window.location.href value and determine from that which
> > slide needs to be the first one displayed.  Then call cycle with the
> > 'startingSlide' option.
>
> > Mike
>
> > On Oct 22, 7:59 pm, isaacn <[EMAIL PROTECTED]> wrote:
>
> > > Is there a way to do a direct link to an arbitrary slide, from another
> > > page? I saw the demo where the link was on the same page, but this
> > > would be from somewhere that doesn't really know what slides exist (so
> > > it doesn't know which slide is where in the index.)
>
> > > For what it's worth, the slide itself has an ID -- #photo-x (where x
> > > is the drupal node ID, not the index of the slide); can Cycle or
> > > jQuery grab the URL that was called and match it up to the index,
> > > allowing the slide to be directly linked to?
>
> > > Thanks,
>
> > > Isaac

Reply via email to