You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by angelochen <an...@yahoo.com.hk> on 2012/01/13 11:54:09 UTC
T5.3.1 load js and execute it
Hi,
I have js file like following and I'd like it to be run when page is loaded,
using @Import includes the js file, but not running it, any way to achieve
this? Thanks,
(function(window, $, PhotoSwipe){
$(document).ready(function(){
// more code here
});
}(window, window.jQuery, window.Code.PhotoSwipe));
--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-1-load-js-and-execute-it-tp5142295p5142295.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5.3.1 load js and execute it
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 13 Jan 2012 08:54:09 -0200, angelochen
<an...@yahoo.com.hk> wrote:
> Hi,
Hi!
> I have js file like following and I'd like it to be run when page is
> loaded, using @Import includes the js file, but not running it, any way
> to achieve this? Thanks,
All JavaScript code in a .js file added to an HTML page is executed. Maybe
your code is just being ran before the page is ready. Try wrapping your
code in a function and use JavaScriptSupport.addScript() to invoke it.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org