You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "D.R." <d....@googlemail.com> on 2016/06/21 11:29:27 UTC

bootstrap affix onload not executed

Hi,

i try this example:
http://www.w3schools.com/bootstrap/bootstrap_affix.asp

with
     void afterRender() {
         _javaScriptSupport.require("bootstrap/affix");
     }

in a T5.4.1 environment, and the affix.js is loaded, require.js and 
jquery.js do some initialization, but the
$(window).on('load', function ()
is never executed. The js debugger never stops inside that function.

Any hint what to do in order to get that working?


Kind regards
David

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: bootstrap affix onload not executed

Posted by "D.R." <d....@googlemail.com>.
Hi Carlos,

thanks a lot for the hint and the info, works now as expected.


Kind regards
David


On 21.06.2016 19:29, Carlos Montero Canabal wrote:
> Hi,
>
> In Tapestry 5.4.X versions "$(window).on('load', function ()" is never call it for requireJs. So you can create a module as:
>
> my-affix-module.js (into META-INF/modules folder) with the code
>
> define([\u201cjquery\u201d, \u201cbootstrap/affix"], function($) {
> 	
> 	return function(){
> 		
> 		$('#myAffix').affix({
> 		  options...
> 	     });
> 		
> 	}
> 	
> });
>
> And require it on .java
>
> void afterRender() {
>      _javaScriptSupport.require(\u201cmy-affix-module\u201d);
> }
>
> I think it works
>
> Regards
>
> Carlos Montero
>
>> El 21/6/2016, a las 13:29, D.R. <d....@googlemail.com> escribi�:
>>
>> Hi,
>>
>> i try this example:
>> http://www.w3schools.com/bootstrap/bootstrap_affix.asp
>>
>> with
>>     void afterRender() {
>>         _javaScriptSupport.require("bootstrap/affix");
>>     }
>>
>> in a T5.4.1 environment, and the affix.js is loaded, require.js and jquery.js do some initialization, but the
>> $(window).on('load', function ()
>> is never executed. The js debugger never stops inside that function.
>>
>> Any hint what to do in order to get that working?
>>
>>
>> Kind regards
>> David
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: bootstrap affix onload not executed

Posted by Carlos Montero Canabal <ca...@gmail.com>.
Hi,

In Tapestry 5.4.X versions "$(window).on('load', function ()" is never call it for requireJs. So you can create a module as:

my-affix-module.js (into META-INF/modules folder) with the code

define([“jquery”, “bootstrap/affix"], function($) {
	
	return function(){
		
		$('#myAffix').affix({
		  options...
	     });
		
	}
	
});

And require it on .java

void afterRender() {
    _javaScriptSupport.require(“my-affix-module”);
}

I think it works

Regards

Carlos Montero

> El 21/6/2016, a las 13:29, D.R. <d....@googlemail.com> escribió:
> 
> Hi,
> 
> i try this example:
> http://www.w3schools.com/bootstrap/bootstrap_affix.asp
> 
> with
>    void afterRender() {
>        _javaScriptSupport.require("bootstrap/affix");
>    }
> 
> in a T5.4.1 environment, and the affix.js is loaded, require.js and jquery.js do some initialization, but the
> $(window).on('load', function ()
> is never executed. The js debugger never stops inside that function.
> 
> Any hint what to do in order to get that working?
> 
> 
> Kind regards
> David
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>