framework7 icon indicating copy to clipboard operation
framework7 copied to clipboard

event scroll not work

Open chalchis opened this issue 10 years ago • 2 comments

How to apply if an element is visible scrolling?

this my code

$$(document).on('scroll', '.page-content', function()
{
    console.log('scroll');
});

chalchis avatar Jun 01 '16 20:06 chalchis

this my only solution using Vanilla http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onscroll

//al cargar la vista de las evaluaciones activas
myApp.onPageInit('evaluaciones_p', function (page) 
{    
    var zona_div = document.getElementById("pagina_scrollA");
    zona_div.addEventListener('scroll', function()
    {
        scrolleando();

    }, false);
});
myApp.scrolleando = function()
{
    var $elem = $('#item_element');
    var $window = $(window);

    var docViewTop = $window.scrollTop();
    var docViewBottom = docViewTop + $window.height();

    var elemTop = $elem.offset().top;
    var elemBottom = elemTop + $elem.height();

    console.log( ((elemBottom <= docViewBottom) && (elemTop >= docViewTop)) );
};

chalchis avatar Jun 01 '16 21:06 chalchis

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jun 25 '18 18:06 lock[bot]