On Jan 24, 2012, at 10:36 AM, neil.west1 wrote:
Hi Walt, I’ve just come back to this site to add my additional pages by linking back to specific carousel panes, but I’ve just noticed that linking back does indeed scroll through to the correct pane but it doesn’t trigger the hide/show layer items that appear on the pane. Is there a way to trigger these from a different page at the same time as the carousel?
The current ‘home’ page is here: http://www.thinktankcd.com/
It’s my intention to add a new page to each category for additional info, but they really need to be able to link back to the correct pane (and hide/show) on this page.
Target Show/Hide elements can only be triggered by a physical click on the trigger element. There’s no way to fake a click in the browser (for obvious security reasons).
Now in a more abstracted show/hide setup, you could do this by listening for a custom event (synthetic, not a real click event). Here’s an example:
$$('.target').invoke('hide');
document.observe('target:click', function(evt){
$$('.target').invoke('hide');
$(evt.element().readAttribute('data-target')).show();
evt.stop();
});
<a href="#foo" id="foo_trigger" data-target="foo"
onclick="this.fire('target:click')">Click</a>
<div id="foo" class="target">
This is initially hidden
</div>
What’s happening here is that targets are marked with the classname ‘target’. The first line hides all of them when the page loads. Then there’s a general handler that listens for the “target:click” event, works out where it was intended to go, and hides any currently showing targets, then shows the desired target. Finally, it stops the default behavior of that link, which is to anchor down to the div you’re showing.
All right, so far this is just a drop-in replacement for the target show/hide behavior. Where it differs is that because we’re using a fake event, we can call it out programmatically, and it will work exactly as if the link was clicked.
$('foo_trigger').fire(target:click');
There’s no need to do anything else, it will just work as if the link was physically clicked. This could be inserted into the existing function in Carousel that loads a particular pane. But because this is an entirely different method than the one used in Freeway’s built-in Target Show/Hide Actions, you can’t take advantage of this.
Walter
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options