Forum Discussion

Jake_N's avatar
Jake_N
Mentor
7 years ago

Badge Hove Function

Hey again everyone, I have hit another thing I would love help with.   I have an example of what I want here https://www.workshop.com.au/t5/badges/userbadgespage/user-id/865/page/1 I would like t...
  • peterlu's avatar
    7 years ago
    Jake_N That is a built in Lithium user badges page. Revoke is Out-of-Box feature. I think Revoke is for admin to see. Normal user should not be able to see the revoke. Correct me if I am wrong :) Also there are some APIs for badges, and you can build some fancy function for this page. By default, it is clicking to see the back of the badge card. You can use LITHIUM.jQuery to unbind the click function. see jquery off() function. And you can use CSS hover to achieve the hover effect.
  • ClaudiusH's avatar
    ClaudiusH
    7 years ago

    On a Lithium community page the jQuery root object is  instantiated as 

    LITHIUM.jQuery

    So you need to use the LITHIUM. namespace in order to access it. This is if you are not using your own jQuery object and library.

     

    The behaviour of showing the badge description on hover is actually the Lithium out of the box behaviour for the "View All Badges" page. It is realized fully via CSS and showing one of the two containers for reach badge depending on hover state. This is the container structure you would build:

    { [Badge front with image and name]  [Badge back with description] }

    The :hover would apply to the  { } outer container.

     

    The "Revoke badge" button can't be re-created via API right now. See also the related discussion here: https://community.lithium.com/t5/Developer-Discussion/Recreating-Badge-List-Component/m-p/278456