Last active
December 22, 2015 17:38
-
-
Save jhammann/6507111 to your computer and use it in GitHub Desktop.
I have a title which has to be clicked on to show some information. The title not only contains text but also contains an image of an arrow that is down when the text isn't visible and has to be changed to up when the text is visible. Normally you would do this by changing the source attribute but working with Rails and the asset pipeline can pr…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %h2 | |
| = link_to "javascript:void(0);", class: "info" do | |
| Information | |
| = image_tag "arrowDown.jpg" | |
| = image_tag "arrowUp.jpg", style: "display:none;" | |
| .infoContainer | |
| %p Info text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(".info").click(function(){ | |
| // simple slide animation which shows the information we want to see. | |
| $(".infoContainer").slideToggle("fast"); | |
| // in the element that is clicked are two images that change display state once the element is clicked. | |
| $(this).find('img').toggle(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment