How to Style h:outputLink as per PrimeFaces theme

UI Components for JSF
Post Reply
User avatar
bercolax
Posts: 133
Joined: 02 Aug 2009, 13:27
Location: Courtallam, India
Contact:

09 Dec 2011, 21:12

I am using the below code for <h:outputLink and I get the correct look and feel (similar to a p:commandButton). How ever I miss the nice hover effect available for PrimeFaces components.

Code: Select all

                   <h:outputLink styleClass="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"   value="/faces/user/report.xhtml">
                        <h:outputText styleClass="ui-button-text" value="Go To Report Generation Page"/>
                    </h:outputLink>
But how to get that hover effect? (I notice ui-state-hover class is appended. Is there any easy way to do add the hover effect ?)
PrimeFaces 3.4, Seam Faces 3.0.2.Final, Glassfish v3.1, Mojarra 2.1.10, NetBeans 7.2, Hibernate JPA 2.0, Seam Persistence 3.0.0.Final Theme default HOT-SNEAKS

User avatar
bercolax
Posts: 133
Joined: 02 Aug 2009, 13:27
Location: Courtallam, India
Contact:

09 Dec 2011, 21:22

Just got it to work using

Code: Select all

<h:outputLink onmouseover="$(this).addClass('ui-state-hover')" onmouseout="$(this).removeClass('ui-state-hover')"  .......
Please comment if there is a better way to do it.
PrimeFaces 3.4, Seam Faces 3.0.2.Final, Glassfish v3.1, Mojarra 2.1.10, NetBeans 7.2, Hibernate JPA 2.0, Seam Persistence 3.0.0.Final Theme default HOT-SNEAKS

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

10 Dec 2011, 12:23

I'd use unobstrusive javascript;

Code: Select all

$('a').mouseover(function() {
  $(this).addClass('ui-state-hover');
}).mouseout(function() {
  $(this).removeClass('ui-state-hover');
});
For example, above enhances all links on page.

User avatar
bercolax
Posts: 133
Joined: 02 Aug 2009, 13:27
Location: Courtallam, India
Contact:

10 Dec 2011, 12:28

Thanks for the suggestion. Will follow the approach suggested.
PrimeFaces 3.4, Seam Faces 3.0.2.Final, Glassfish v3.1, Mojarra 2.1.10, NetBeans 7.2, Hibernate JPA 2.0, Seam Persistence 3.0.0.Final Theme default HOT-SNEAKS

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 31 guests