web - website is laggy when scrolling on chrome [closed]










1















My website (https://whatifhq.com) loads fine, and quite quickly. However, when I try to scroll down, it starts getting laggy and isn't smooth anymore. I've only encountered this problem in Chrome. (tested on chrome, edge, ie). I'm using Chrome V 70, WordPress for my website, and PHP 7.1



I read some other SO posts, most recommended removing some scripts, images, animations. So, I removed animate.css, Adsense, and some other images. However, it still isn't working.



This issue occurs only on the desktop. The mobile version of my site works fine on the same computer. (the mobile and desktop have basically the same content.)



One thing that may be causing the problem is my AJAX infinite scroll script. It checks what position the window is in and then decides whether to load the new content. however, this feature is also on my mobile site, which works fine. Also, the scrolling issue is also present on pages without AJAX, like this https://whatifhq.com/question/where-can-one-find-some-good-resume-cv-templates/



I've also done some speed testing and gotten really good scores. 85%+ Pagespeed, All 'A' WebPageTest.



Can someone please help?



Edit: Not Ajax. I removed the script and the page is still laggy.



Heres my My AJAX script



$(document).ready(function(){
InfinitiScroll = Backbone.View.extend(
el: 'body',
initialize : function()
var view = this;

$(window).scroll(function()
if($(window).scrollTop() >= ($(document).height() - $(window).height()) - 1000 && $("#post_loading").attr('data-fetch') == 1 )
view.ajaxData(query_default);


);

var loading = $('body').find('#post_loading'),
fetch = $(loading).data('fetch'),
type = $(loading).data('type'),
term = $(loading).data('term'),
taxonomy = $(loading).data('taxonomy'),
posts_per_page = $(loading).data('current-page'),
sort = $(loading).data('sort'),
keyword = $(loading).data('keyword'),
query_default =
action : 'et_post_sync',
method : 'scroll',
data :
posts_per_page : posts_per_page,
type : type,
term : term,
taxonomy : taxonomy,
sort : sort,
page : 1,
keyword : keyword

;
setInterval(function()
if($('ul#main_questions_list li.question-item').length < 6 && $("#post_loading").attr('data-fetch') == 1 )
view.ajaxData(query_default);

, 3000);

,
ajaxData : function(query_default)
var loading = $('body').find('#post_loading');
query_default['data']['page'] += 1;

$.ajax(
url : ae_globals.ajaxURL,
type : 'post',
data : query_default,
beforeSend : function()
$(loading).removeClass('hide');
$(loading).attr('data-fetch',0);
,
error : function()
$(loading).addClass('hide');
$(loading).attr('data-fetch',1);
,
success : function (response)
setTimeout(function()
if(response.success)
var container = $('body').find('#main_questions_list'),
questions = response.data.questions;
for (key in questions)
$(container).append(questions[key]);

$(loading).addClass('hide');
$(loading).attr('data-fetch',1);
else
$(loading).addClass('hide');


,1500);

);

);









share|improve this question















closed as too broad by Alon Eitan, sideshowbarker, ekad, Machavity, Makyen Nov 11 '18 at 23:13


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


















  • w3schools.com/howto/howto_css_smooth_scroll.asp. hope this solves. unless you show your ajax script, we really can't help u

    – magpie
    Nov 11 '18 at 16:29











  • @magpie I added the code

    – PicturePerfect366
    Nov 11 '18 at 16:31






  • 1





    I did some performance profiling while scrolling your non-ajax page: prnt.sc/lh0s2d. Note how fps drops to ~10 while scrolling and 95% of the time is consumed by requestAnimationFrame() calls. Looks like it all boils down to this function that gets called on each frame: prnt.sc/lh0s5f. I suspect that document.querySelectorAll() and setAttribute() are very expensive and calling them like that on each frame is what contributes to the lagginess

    – shkaper
    Nov 11 '18 at 16:45











  • @shkaper Thanks you so much! You were right. Turns out, it was an issue with Swift Performance. since I had lazy load enabled, Swift was checking every frame whether the image was loaded. I disable lazy load and its super smooth now. Problem solved!

    – PicturePerfect366
    Nov 11 '18 at 17:55











  • @PicturePerfect366 This is great! I'll add this as an answer so you can close the question.

    – shkaper
    Nov 11 '18 at 18:07















1















My website (https://whatifhq.com) loads fine, and quite quickly. However, when I try to scroll down, it starts getting laggy and isn't smooth anymore. I've only encountered this problem in Chrome. (tested on chrome, edge, ie). I'm using Chrome V 70, WordPress for my website, and PHP 7.1



I read some other SO posts, most recommended removing some scripts, images, animations. So, I removed animate.css, Adsense, and some other images. However, it still isn't working.



This issue occurs only on the desktop. The mobile version of my site works fine on the same computer. (the mobile and desktop have basically the same content.)



One thing that may be causing the problem is my AJAX infinite scroll script. It checks what position the window is in and then decides whether to load the new content. however, this feature is also on my mobile site, which works fine. Also, the scrolling issue is also present on pages without AJAX, like this https://whatifhq.com/question/where-can-one-find-some-good-resume-cv-templates/



I've also done some speed testing and gotten really good scores. 85%+ Pagespeed, All 'A' WebPageTest.



Can someone please help?



Edit: Not Ajax. I removed the script and the page is still laggy.



Heres my My AJAX script



$(document).ready(function(){
InfinitiScroll = Backbone.View.extend(
el: 'body',
initialize : function()
var view = this;

$(window).scroll(function()
if($(window).scrollTop() >= ($(document).height() - $(window).height()) - 1000 && $("#post_loading").attr('data-fetch') == 1 )
view.ajaxData(query_default);


);

var loading = $('body').find('#post_loading'),
fetch = $(loading).data('fetch'),
type = $(loading).data('type'),
term = $(loading).data('term'),
taxonomy = $(loading).data('taxonomy'),
posts_per_page = $(loading).data('current-page'),
sort = $(loading).data('sort'),
keyword = $(loading).data('keyword'),
query_default =
action : 'et_post_sync',
method : 'scroll',
data :
posts_per_page : posts_per_page,
type : type,
term : term,
taxonomy : taxonomy,
sort : sort,
page : 1,
keyword : keyword

;
setInterval(function()
if($('ul#main_questions_list li.question-item').length < 6 && $("#post_loading").attr('data-fetch') == 1 )
view.ajaxData(query_default);

, 3000);

,
ajaxData : function(query_default)
var loading = $('body').find('#post_loading');
query_default['data']['page'] += 1;

$.ajax(
url : ae_globals.ajaxURL,
type : 'post',
data : query_default,
beforeSend : function()
$(loading).removeClass('hide');
$(loading).attr('data-fetch',0);
,
error : function()
$(loading).addClass('hide');
$(loading).attr('data-fetch',1);
,
success : function (response)
setTimeout(function()
if(response.success)
var container = $('body').find('#main_questions_list'),
questions = response.data.questions;
for (key in questions)
$(container).append(questions[key]);

$(loading).addClass('hide');
$(loading).attr('data-fetch',1);
else
$(loading).addClass('hide');


,1500);

);

);









share|improve this question















closed as too broad by Alon Eitan, sideshowbarker, ekad, Machavity, Makyen Nov 11 '18 at 23:13


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


















  • w3schools.com/howto/howto_css_smooth_scroll.asp. hope this solves. unless you show your ajax script, we really can't help u

    – magpie
    Nov 11 '18 at 16:29











  • @magpie I added the code

    – PicturePerfect366
    Nov 11 '18 at 16:31






  • 1





    I did some performance profiling while scrolling your non-ajax page: prnt.sc/lh0s2d. Note how fps drops to ~10 while scrolling and 95% of the time is consumed by requestAnimationFrame() calls. Looks like it all boils down to this function that gets called on each frame: prnt.sc/lh0s5f. I suspect that document.querySelectorAll() and setAttribute() are very expensive and calling them like that on each frame is what contributes to the lagginess

    – shkaper
    Nov 11 '18 at 16:45











  • @shkaper Thanks you so much! You were right. Turns out, it was an issue with Swift Performance. since I had lazy load enabled, Swift was checking every frame whether the image was loaded. I disable lazy load and its super smooth now. Problem solved!

    – PicturePerfect366
    Nov 11 '18 at 17:55











  • @PicturePerfect366 This is great! I'll add this as an answer so you can close the question.

    – shkaper
    Nov 11 '18 at 18:07













1












1








1








My website (https://whatifhq.com) loads fine, and quite quickly. However, when I try to scroll down, it starts getting laggy and isn't smooth anymore. I've only encountered this problem in Chrome. (tested on chrome, edge, ie). I'm using Chrome V 70, WordPress for my website, and PHP 7.1



I read some other SO posts, most recommended removing some scripts, images, animations. So, I removed animate.css, Adsense, and some other images. However, it still isn't working.



This issue occurs only on the desktop. The mobile version of my site works fine on the same computer. (the mobile and desktop have basically the same content.)



One thing that may be causing the problem is my AJAX infinite scroll script. It checks what position the window is in and then decides whether to load the new content. however, this feature is also on my mobile site, which works fine. Also, the scrolling issue is also present on pages without AJAX, like this https://whatifhq.com/question/where-can-one-find-some-good-resume-cv-templates/



I've also done some speed testing and gotten really good scores. 85%+ Pagespeed, All 'A' WebPageTest.



Can someone please help?



Edit: Not Ajax. I removed the script and the page is still laggy.



Heres my My AJAX script



$(document).ready(function(){
InfinitiScroll = Backbone.View.extend(
el: 'body',
initialize : function()
var view = this;

$(window).scroll(function()
if($(window).scrollTop() >= ($(document).height() - $(window).height()) - 1000 && $("#post_loading").attr('data-fetch') == 1 )
view.ajaxData(query_default);


);

var loading = $('body').find('#post_loading'),
fetch = $(loading).data('fetch'),
type = $(loading).data('type'),
term = $(loading).data('term'),
taxonomy = $(loading).data('taxonomy'),
posts_per_page = $(loading).data('current-page'),
sort = $(loading).data('sort'),
keyword = $(loading).data('keyword'),
query_default =
action : 'et_post_sync',
method : 'scroll',
data :
posts_per_page : posts_per_page,
type : type,
term : term,
taxonomy : taxonomy,
sort : sort,
page : 1,
keyword : keyword

;
setInterval(function()
if($('ul#main_questions_list li.question-item').length < 6 && $("#post_loading").attr('data-fetch') == 1 )
view.ajaxData(query_default);

, 3000);

,
ajaxData : function(query_default)
var loading = $('body').find('#post_loading');
query_default['data']['page'] += 1;

$.ajax(
url : ae_globals.ajaxURL,
type : 'post',
data : query_default,
beforeSend : function()
$(loading).removeClass('hide');
$(loading).attr('data-fetch',0);
,
error : function()
$(loading).addClass('hide');
$(loading).attr('data-fetch',1);
,
success : function (response)
setTimeout(function()
if(response.success)
var container = $('body').find('#main_questions_list'),
questions = response.data.questions;
for (key in questions)
$(container).append(questions[key]);

$(loading).addClass('hide');
$(loading).attr('data-fetch',1);
else
$(loading).addClass('hide');


,1500);

);

);









share|improve this question
















My website (https://whatifhq.com) loads fine, and quite quickly. However, when I try to scroll down, it starts getting laggy and isn't smooth anymore. I've only encountered this problem in Chrome. (tested on chrome, edge, ie). I'm using Chrome V 70, WordPress for my website, and PHP 7.1



I read some other SO posts, most recommended removing some scripts, images, animations. So, I removed animate.css, Adsense, and some other images. However, it still isn't working.



This issue occurs only on the desktop. The mobile version of my site works fine on the same computer. (the mobile and desktop have basically the same content.)



One thing that may be causing the problem is my AJAX infinite scroll script. It checks what position the window is in and then decides whether to load the new content. however, this feature is also on my mobile site, which works fine. Also, the scrolling issue is also present on pages without AJAX, like this https://whatifhq.com/question/where-can-one-find-some-good-resume-cv-templates/



I've also done some speed testing and gotten really good scores. 85%+ Pagespeed, All 'A' WebPageTest.



Can someone please help?



Edit: Not Ajax. I removed the script and the page is still laggy.



Heres my My AJAX script



$(document).ready(function(){
InfinitiScroll = Backbone.View.extend(
el: 'body',
initialize : function()
var view = this;

$(window).scroll(function()
if($(window).scrollTop() >= ($(document).height() - $(window).height()) - 1000 && $("#post_loading").attr('data-fetch') == 1 )
view.ajaxData(query_default);


);

var loading = $('body').find('#post_loading'),
fetch = $(loading).data('fetch'),
type = $(loading).data('type'),
term = $(loading).data('term'),
taxonomy = $(loading).data('taxonomy'),
posts_per_page = $(loading).data('current-page'),
sort = $(loading).data('sort'),
keyword = $(loading).data('keyword'),
query_default =
action : 'et_post_sync',
method : 'scroll',
data :
posts_per_page : posts_per_page,
type : type,
term : term,
taxonomy : taxonomy,
sort : sort,
page : 1,
keyword : keyword

;
setInterval(function()
if($('ul#main_questions_list li.question-item').length < 6 && $("#post_loading").attr('data-fetch') == 1 )
view.ajaxData(query_default);

, 3000);

,
ajaxData : function(query_default)
var loading = $('body').find('#post_loading');
query_default['data']['page'] += 1;

$.ajax(
url : ae_globals.ajaxURL,
type : 'post',
data : query_default,
beforeSend : function()
$(loading).removeClass('hide');
$(loading).attr('data-fetch',0);
,
error : function()
$(loading).addClass('hide');
$(loading).attr('data-fetch',1);
,
success : function (response)
setTimeout(function()
if(response.success)
var container = $('body').find('#main_questions_list'),
questions = response.data.questions;
for (key in questions)
$(container).append(questions[key]);

$(loading).addClass('hide');
$(loading).attr('data-fetch',1);
else
$(loading).addClass('hide');


,1500);

);

);






javascript html scroll infinite-scroll






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 '18 at 16:29







PicturePerfect366

















asked Nov 11 '18 at 16:22









PicturePerfect366PicturePerfect366

167




167




closed as too broad by Alon Eitan, sideshowbarker, ekad, Machavity, Makyen Nov 11 '18 at 23:13


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









closed as too broad by Alon Eitan, sideshowbarker, ekad, Machavity, Makyen Nov 11 '18 at 23:13


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • w3schools.com/howto/howto_css_smooth_scroll.asp. hope this solves. unless you show your ajax script, we really can't help u

    – magpie
    Nov 11 '18 at 16:29











  • @magpie I added the code

    – PicturePerfect366
    Nov 11 '18 at 16:31






  • 1





    I did some performance profiling while scrolling your non-ajax page: prnt.sc/lh0s2d. Note how fps drops to ~10 while scrolling and 95% of the time is consumed by requestAnimationFrame() calls. Looks like it all boils down to this function that gets called on each frame: prnt.sc/lh0s5f. I suspect that document.querySelectorAll() and setAttribute() are very expensive and calling them like that on each frame is what contributes to the lagginess

    – shkaper
    Nov 11 '18 at 16:45











  • @shkaper Thanks you so much! You were right. Turns out, it was an issue with Swift Performance. since I had lazy load enabled, Swift was checking every frame whether the image was loaded. I disable lazy load and its super smooth now. Problem solved!

    – PicturePerfect366
    Nov 11 '18 at 17:55











  • @PicturePerfect366 This is great! I'll add this as an answer so you can close the question.

    – shkaper
    Nov 11 '18 at 18:07

















  • w3schools.com/howto/howto_css_smooth_scroll.asp. hope this solves. unless you show your ajax script, we really can't help u

    – magpie
    Nov 11 '18 at 16:29











  • @magpie I added the code

    – PicturePerfect366
    Nov 11 '18 at 16:31






  • 1





    I did some performance profiling while scrolling your non-ajax page: prnt.sc/lh0s2d. Note how fps drops to ~10 while scrolling and 95% of the time is consumed by requestAnimationFrame() calls. Looks like it all boils down to this function that gets called on each frame: prnt.sc/lh0s5f. I suspect that document.querySelectorAll() and setAttribute() are very expensive and calling them like that on each frame is what contributes to the lagginess

    – shkaper
    Nov 11 '18 at 16:45











  • @shkaper Thanks you so much! You were right. Turns out, it was an issue with Swift Performance. since I had lazy load enabled, Swift was checking every frame whether the image was loaded. I disable lazy load and its super smooth now. Problem solved!

    – PicturePerfect366
    Nov 11 '18 at 17:55











  • @PicturePerfect366 This is great! I'll add this as an answer so you can close the question.

    – shkaper
    Nov 11 '18 at 18:07
















w3schools.com/howto/howto_css_smooth_scroll.asp. hope this solves. unless you show your ajax script, we really can't help u

– magpie
Nov 11 '18 at 16:29





w3schools.com/howto/howto_css_smooth_scroll.asp. hope this solves. unless you show your ajax script, we really can't help u

– magpie
Nov 11 '18 at 16:29













@magpie I added the code

– PicturePerfect366
Nov 11 '18 at 16:31





@magpie I added the code

– PicturePerfect366
Nov 11 '18 at 16:31




1




1





I did some performance profiling while scrolling your non-ajax page: prnt.sc/lh0s2d. Note how fps drops to ~10 while scrolling and 95% of the time is consumed by requestAnimationFrame() calls. Looks like it all boils down to this function that gets called on each frame: prnt.sc/lh0s5f. I suspect that document.querySelectorAll() and setAttribute() are very expensive and calling them like that on each frame is what contributes to the lagginess

– shkaper
Nov 11 '18 at 16:45





I did some performance profiling while scrolling your non-ajax page: prnt.sc/lh0s2d. Note how fps drops to ~10 while scrolling and 95% of the time is consumed by requestAnimationFrame() calls. Looks like it all boils down to this function that gets called on each frame: prnt.sc/lh0s5f. I suspect that document.querySelectorAll() and setAttribute() are very expensive and calling them like that on each frame is what contributes to the lagginess

– shkaper
Nov 11 '18 at 16:45













@shkaper Thanks you so much! You were right. Turns out, it was an issue with Swift Performance. since I had lazy load enabled, Swift was checking every frame whether the image was loaded. I disable lazy load and its super smooth now. Problem solved!

– PicturePerfect366
Nov 11 '18 at 17:55





@shkaper Thanks you so much! You were right. Turns out, it was an issue with Swift Performance. since I had lazy load enabled, Swift was checking every frame whether the image was loaded. I disable lazy load and its super smooth now. Problem solved!

– PicturePerfect366
Nov 11 '18 at 17:55













@PicturePerfect366 This is great! I'll add this as an answer so you can close the question.

– shkaper
Nov 11 '18 at 18:07





@PicturePerfect366 This is great! I'll add this as an answer so you can close the question.

– shkaper
Nov 11 '18 at 18:07












1 Answer
1






active

oldest

votes


















1














I did some performance profiling while scrolling your non-ajax page: https://prnt.sc/lh0s2d. Note how fps drops to ~10 while scrolling, and 95% of the time is consumed by requestAnimationFrame() calls. Looks like it all boils down to this function that gets called on each frame: https://prnt.sc/lh0s5f. I suspect that document.querySelectorAll() and setAttribute() are very expensive and calling them like that on each frame is what contributes to the lagginess.






share|improve this answer





























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    I did some performance profiling while scrolling your non-ajax page: https://prnt.sc/lh0s2d. Note how fps drops to ~10 while scrolling, and 95% of the time is consumed by requestAnimationFrame() calls. Looks like it all boils down to this function that gets called on each frame: https://prnt.sc/lh0s5f. I suspect that document.querySelectorAll() and setAttribute() are very expensive and calling them like that on each frame is what contributes to the lagginess.






    share|improve this answer



























      1














      I did some performance profiling while scrolling your non-ajax page: https://prnt.sc/lh0s2d. Note how fps drops to ~10 while scrolling, and 95% of the time is consumed by requestAnimationFrame() calls. Looks like it all boils down to this function that gets called on each frame: https://prnt.sc/lh0s5f. I suspect that document.querySelectorAll() and setAttribute() are very expensive and calling them like that on each frame is what contributes to the lagginess.






      share|improve this answer

























        1












        1








        1







        I did some performance profiling while scrolling your non-ajax page: https://prnt.sc/lh0s2d. Note how fps drops to ~10 while scrolling, and 95% of the time is consumed by requestAnimationFrame() calls. Looks like it all boils down to this function that gets called on each frame: https://prnt.sc/lh0s5f. I suspect that document.querySelectorAll() and setAttribute() are very expensive and calling them like that on each frame is what contributes to the lagginess.






        share|improve this answer













        I did some performance profiling while scrolling your non-ajax page: https://prnt.sc/lh0s2d. Note how fps drops to ~10 while scrolling, and 95% of the time is consumed by requestAnimationFrame() calls. Looks like it all boils down to this function that gets called on each frame: https://prnt.sc/lh0s5f. I suspect that document.querySelectorAll() and setAttribute() are very expensive and calling them like that on each frame is what contributes to the lagginess.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 11 '18 at 18:08









        shkapershkaper

        1,196714




        1,196714













            Popular posts from this blog

            𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

            Crossroads (UK TV series)

            ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế