Using jQuery with Liferay, Part 2

Four more core effects are Show, Toggle, Fade In, and Animate.   This week’s portlet and the screencast below gives a demonstration of these four effects in a Liferay Portlet. As I should have mentioned last time, the code within the portlet to do one of these effects is very small. Here’s the code for the toggle:

jQuery('#link2').click(function() { jQuery('# block2').toggle();});

Of course, you have to setup a “div” with a unique “id=”. For portlets, we simply prepend the tag which makes the id unique across the portal. Take a look at the source code in the portlet’s view.jsp file for more information. I tried to keep the jQuery code clean and simple so beginners shouldn’t have to cringe too much ;-).

Tags: , ,

2 Responses to "Using jQuery with Liferay, Part 2"

  • Mid says:
  • Jeff Robinson says: