Wednesday, April 09, 2008

Inline Lightbox effect and velocity macro

To get lightbox2 effect, with inline HTML content, one can make use of Thickbox . Thickbox is written on top of Jquery. I am sure that there are plenty of javascript library which one can use to achieve the same effect. One of such kind that I came across is lightview although lightview is not free for commercial use. The goal is to be able to integrate Struts2, Velocity, Sitemesh, Hibernate and Spring. With usual Javascript Jazz and Ajax interaction on the frontend. I hope that Velocity turns out to be more promising than JSP. Just that I am struggling in getting started with Velocity.
Lightbox effect would be required on numerous pages, so I decided to make use of velocity macro to make syntax a bit easier. The velocity macro turns out like below (for Ajax page)
#macro ( lightviewLink $link $linkText $title $height $width $modal )
a href="$link?height=$height&width=$width&modal=$modal" class="thickbox" title="$title"$linkText</a>

Above macro can be used in velocity pages like below
#lightviewLink ("login.html" "Login - non modal" "Please sign in" "85" "250" "false")


Post a Comment