To apply Fancybox to an image it's best to use a <a href> tag pointing
to the image instead. Otherwise it tries to calculate based on the
size of the DOM element, which might be a bit hit-and-miss (check out
examples at http://fancybox.net/ also)

e.g.

-- markup:

<a href="#" wicket:id="myImg">My Image Fancybox</a>

-- java:

new Fancybox("myImg", ImageReferenceFactory.fromURL(""+urlFor(new
ResourceReference("image"))+"?pictureId=08d7463i4mh53bavkkmr")).setGroup(group).setBoxTitle("Photo
1 of 4"));

--
The example source does this type of thing also -

http://visural-wicket-examples.appspot.com/app/fancybox?wicket:bookmarkablePage=:com.visural.wicket.examples.ViewSourcePage&resource=/com/visural/wicket/examples/fancybox/FancyBoxExamplePage.java

HTH

On 26 February 2010 08:24, danisevsky <[email protected]> wrote:
> "visural-wicket" is great, thank you very much for sharing!
>
> I have one small issue, Fancybox does not calculate width of my images
> right. This is part of rendered html:
>
> <div id="fancybox-inner" style="overflow: auto; top: 10px; left: 10px;
> width: 1024px; height: 501px; display: block;">
>
> heigh: 501px - correct
> width: 1024px - not correct, this is width of original image, this could be
> smaller
>
> as a result is that Fancybox is wider then image.
>
> I serve images like shared resources.
>
> java code:
>
>        WebMarkupContainer container = new WebMarkupContainer("img") {
>           �...@override
>            protected void onComponentTag(ComponentTag tag) {
>                super.onComponentTag(tag);
>                tag.put("src", urlFor(new ResourceReference("image")) +
> "?pictureId=08d7463i4mh53bavkkmr");
>            }
>        };
>        add(container);
>        container.setOutputMarkupId(true);
>
>        add(new Fancybox("image1",
> container).setGroup(group).setBoxTitle("Photo 1 of 4"));
>
> markup:
>
>        <a class="button" href="#" wicket:id="image1">Image 1</a>
>        <div style="display: none;">
>             <img style="height:100%;" wicket:id="img"/>
>        </div>
>
> Could you gime me some advice?
>



-- 
Richard Nichols :: http://www.visural.com/ :: http://www.richardnichols.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to