[Zope] Re: open image in a fitted new window

Alan alanwilter at gmail.com
Fri Mar 23 07:38:18 EDT 2007


Thanks Tres and Tino.

BTW Tino, what do you mean with

"...or uses layers the big view on top with little DOM action (preferred)..."

something like passing the mouse point over the picture and have the
full-size version of the image?

Cheers,
Alan

On 22/03/07, zope-request at zope.org <zope-request at zope.org> wrote:
> Tres Seaver schrieb:
> ...
> > The only trick here is to get the javascript to include the "dynamic"
> > URL;  everything else is not specific to Zope or ZPT.  Here is the hack
> > I usually use for that::
> >
> >   <!-- assumes that 'image' is bound to an actual Zope image object -->
> >   <script type="text/javascript" lang="JavaScript"
> >           tal:define="img_url image/absolute_url"
> >           tal:content="string:var img_url='${img_url}';"></script>
> >
> > Your popup javascript can then refer to the 'img_url' JS variable to set
> > the window location.
> >
> >
> A little bit cleaner approach would be to have an ordinary link:
>
> <a class="magnify" href="path/to/big/image"><img src="path/to/thumbnail"
> width, height ... /></a>
>
>
> and have a general javascript which scans thru the DOM after load,
> finds the a-objects with class-attribute magnify and installs
> an handler for mouse click which overrides the usual link action
> and either pops up a window or uses layers the big view on top
> with little DOM action (preferred). You dont even net buzzy "Ajax"
> for this. The URL for the big picture is just encoded in the HTML
> already, so you can use the usual tal: attributes to define in
> ZPT.
>
> The result is clean xhtml code which works in any case and only
> is improved in case of javascript beeing available.
>
> Regards
> Tino


More information about the Zope mailing list