Last active
November 23, 2015 23:19
-
-
Save evaldeslacasa/c19cfef283fd6de922a9 to your computer and use it in GitHub Desktop.
aui script to use in button
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
| the main.js: | |
| AUI().ready( | |
| /* | |
| This function gets loaded when all the HTML, not including the portlets, is | |
| loaded. | |
| */ | |
| function() { | |
| alert("hola"); | |
| A=AUI(); | |
| A.one('#toggle-controls').on('click', function(e) { | |
| e.preventDefault(); | |
| if (A.one('body').hasClass('controls-visible')) { | |
| A.one('body').removeClass('controls-visible') | |
| .addClass('controls-hidden'); | |
| } else { | |
| A.one('body').removeClass('controls-hidden') | |
| .addClass('controls-visible'); | |
| } | |
| }); | |
| } | |
| ); | |
| Liferay.Portlet.ready( | |
| /* | |
| This function gets loaded after each and every portlet on the page. | |
| portletId: the current portlet's id | |
| node: the Alloy Node object of the current portlet | |
| */ | |
| function(portletId, node) { | |
| } | |
| ); | |
| Liferay.on( | |
| 'allPortletsReady', | |
| /* | |
| This function gets loaded when everything, including the portlets, is on | |
| the page. | |
| */ | |
| function() { | |
| } | |
| ); | |
| And the button is: | |
| <script type="text/javascript" src="$javascript_folder/main.js"></script> | |
| <a id="toggle-controls" href="#">Toggle Controls</a><br/> |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Solution in JQuery: script in portal_normal.vm