Sure. Are you trying to show a bunch of different hidden elements on
the page one at a time? Here’s how I would do that.
First, don’t use Freeway’s techniques to hide the elements. Give them
all a common classname, and then use Prototype to hide them:
$$('div.hiddenStuff').invoke('hide');
That grabs all of the DIVs that have the class ‘hiddenStuff’ applied
to them and hides them at page load.
Then, make a link to each of these hidden DIVs, using the ID as the
URL and a classname so you can act on them all together: <a href="#hiddenDivOne" class="lightbox">One</a>
And then, to put it all together:
document.observe('click', function(evt){
var elm;
if(elm = evt.findElement('a.lightbox')){
evt.stop();
$('page_overlay').show();
var box = elm.href.toString().split('#').last();
$('content_area').update($(box).clone(true).show());
}
});
I haven’t tested that, but it should get you pretty close. If you
really just want to do this on one DIV, you don’t have to go through
all of those extra steps, just make sure that you know the ID of the
DIV you want to have appear, and give your trigger link an ID, too.
$('hiddenDiv').hide();
$('trigger').observe('click',function(evt){
evt.stop();
$('content_area').update($('hiddenDiv').clone(true).show());
});
One thing that occurs to me is you’re going to have to remove any
positioning from these hidden elements, or else they will materialize
inside the lightbox overlay with a hefty x/y offset. I think there’s
an Action for that, but you’ll have to hunt. In a pinch, Source Code
Snooper applied to each hidden element will do the trick. Remove the
top and left properties, and set the position to relative.
Walter
On Nov 26, 2010, at 8:41 PM, DeltaDave wrote:
While this works with your generated ‘content_area’ can I use it to
work with a specific Div (like ‘mycontent’) which is already on the
page.
David
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options