Window onload event does not fire in ipad ios 8.4

后端 未结 3 1701

I am facing following strange issue:

Functionality:
When I open my website page which has many images and have javascript/jquery used for clie

3条回答
  •  不知归路
    2021-01-16 11:54

    I counldn't find the reason why the control does not fire window.onload event. But for those who will get into the same issue, I am posting here the other way round to solve this issue. (and obviously I dont want to get a tumbleweed badge..)

    1. I have added most of the javascript in code behind (cs file) which was inside window.onload
    2. As I am calling a javascript function jWDScrollWindow() on page load to scroll the page, I added the $(".lazy").unveil(); inside jWDScrollWindow() function itself.

    This solves my issue in iPad, but the changes are not device specific.

    function jWDScrollWindow() {
        //Apply lazy loading functionality to images
        $(".lazy").unveil();
        //scroll by 1px to load the images
        $(window).scrollTop($(window).scrollTop() + 1);
    }
    

    This is not a full-fledged solution to the issue but a work aournd. If someone has a reason or solution on this issue, please do post as an answer.

提交回复
热议问题