OSJS Scroll

  
Hi There,

I'm trying to build a small application that gets triggered on the jQuery scroll function. Is this function also supported by OSJS?

On this moment i have the following code but nothing is happening, the scroll function is not triggered when my div with overflow auto scrolls.

<script type=""text/JavaScript"">

osjs(document).ready(function($){
    $('#"+ContainerId+"').scroll(function(){
        alert(""test"");        
    });
});

</script>
What does your browser's Developer Tools tell you? Is it showing a JavaScript error? If you copy/paste the code as sent to the browser (with the correct ID in it), and run it in the console, does it work? If you test the jQuery selectors, do they work as expected?

J.Ja
Hi Justin,

So i tried already different things, i changed the OSJS to $ because i was told that OS8 support's the $ sing for jquery. When i do a alert with $('#"+ContainerId+"').html() i get the value so the selector is working. When i change the $('#"+ContainerId+"').scroll to $(window).scroll it's working i get a alert. Firebug is not giving anny erros so that wont help.

http://jsfiddle.net/srePP/32/
Is the Container part of an AJAX Refresh? That can change the ID when it happens, and so the jQuery would need to get re-run.

Have you set a breakpoint in the browser developer tools to see if your scroll code is getting called at all? Have your set a breakpoint to make sure that the initial code to bind it to scroll() happens.

J.Ja
Hi Justin,

The ('#"+ContainerId+"').scroll is not triggerd so i gues the binding is not working out great. But it's strange because the ('#"+ContainerId+"').html() alert will give me the html of the div. On the div there is no AJAX refresh so I have no idea what the problem is!
Hi,

try it in Chrome and instead of alert do a console.log.
javascript doesn't always like it when using alerts.. some events will act differently.