Current time: 12-11-2019, 09:59 PM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with load times
09-11-2014, 11:22 AM (This post was last modified: 09-11-2014 02:13 PM by Enduring Epilepsy.)
Post: #11
RE: Help with load times
(09-11-2014 01:59 AM)pmeenan Wrote:  Looking at the panels, it looks like each one has this chunk of script embedded:

Code:
jQuery(window).load(function(){
    Shadowbox.init();
    jQuery(".cx-featuredimage a").hover(function(){
        jQuery(this).parent().addClass("highlight",{duration:500});
        jQuery(this).find("img").stop().css("opacity",0.5);
        jQuery(this).closest("div").find(".zoomin").stop().css("opacity","1");
        jQuery(this).closest("div").find(".zoomin").css("margin-right",-1*(jQuery(this).find("img").width()/2));
        jQuery(this).closest("div").find(".zoomin").css("margin-top",jQuery(this).find("img").height()/2);
        jQuery(this).closest("div").find(".zoomin").css("margin-left",jQuery(this).find("img").width()/2);
    },function(){
        jQuery(this).closest("div").find(".zoomin").stop().css("opacity",0);
        jQuery(this).parent().removeClass("highlight",{duration:500});
        jQuery(this).find("img").stop().css("opacity",1);
    });
});

It looks like most of that code is handling the zoom-on-hover but the Shadowbox.init() might be the code that is triggering the actual display.

For starters, that chunk of code looks like it is generic and should not be attached to every single one of the posts. You probably only need it once. You also don't want to attch it to the window load event. If you change the jQuery(window).load to jQuery(document).ready it should display the panels a lot sooner.

I see the script in the page source. But I cannot find it in my files. Angry When I look at the page with Developer Tools, I'm seeing it as text Huh

I found the masonry code here: http://masonry.desandro.com/ I'm going to look more tonight.
Find all posts by this user
Quote this message in a reply
09-11-2014, 02:11 PM (This post was last modified: 09-11-2014 09:16 PM by Enduring Epilepsy.)
Post: #12
RE: Help with load times
(09-11-2014 01:59 AM)pmeenan Wrote:  Looking at the panels, it looks like each one has this chunk of script embedded:

Code:
jQuery(window).load(function(){
    Shadowbox.init();
    jQuery(".cx-featuredimage a").hover(function(){
        jQuery(this).parent().addClass("highlight",{duration:500});
        jQuery(this).find("img").stop().css("opacity",0.5);
        jQuery(this).closest("div").find(".zoomin").stop().css("opacity","1");
        jQuery(this).closest("div").find(".zoomin").css("margin-right",-1*(jQuery(this).find("img").width()/2));
        jQuery(this).closest("div").find(".zoomin").css("margin-top",jQuery(this).find("img").height()/2);
        jQuery(this).closest("div").find(".zoomin").css("margin-left",jQuery(this).find("img").width()/2);
    },function(){
        jQuery(this).closest("div").find(".zoomin").stop().css("opacity",0);
        jQuery(this).parent().removeClass("highlight",{duration:500});
        jQuery(this).find("img").stop().css("opacity",1);
    });
});

It looks like most of that code is handling the zoom-on-hover but the Shadowbox.init() might be the code that is triggering the actual display.

For starters, that chunk of code looks like it is generic and should not be attached to every single one of the posts. You probably only need it once. You also don't want to attch it to the window load event. If you change the jQuery(window).load to jQuery(document).ready it should display the panels a lot sooner.

Ok - I finally found it but I'm not sure how to edit the JS...

JS code

Here is the masonry file MasonryGrid.php

Masonry CSS

The JS was buried in my Minify Cache file. I recognized the Shadowbox in the code, but am not sure how it's written Huh If I edit the Masonry code with document or container, it works, but I lose the CSS styling. Can you advise on how to properly edit this? Or do I need to shut off my minify to do so? Thank you for all the help Smile
Find all posts by this user
Quote this message in a reply
09-11-2014, 10:18 PM
Post: #13
RE: Help with load times
I don't see the ShadowBox.init call in any of the code. That said, there are a couple of chunks of code in the masony php that are attached to window.load. The first one looks like it fades the visible boxes into view. You may have to touch a few other pieces of code but my first attempt would be to just change (window).load to (document).ready for that first chunk of code and see if it has any impact.

Unfortunately you're reverse-engineering the dev work on the theme and changing the bahavior and it's entirely possible something is going to break. From the looks of it, the original author focused a lot more on "pretty" than performance.
Visit this user's website Find all posts by this user
Quote this message in a reply
09-11-2014, 10:50 PM
Post: #14
RE: Help with load times
(09-11-2014 10:18 PM)pmeenan Wrote:  I don't see the ShadowBox.init call in any of the code. That said, there are a couple of chunks of code in the masony php that are attached to window.load. The first one looks like it fades the visible boxes into view. You may have to touch a few other pieces of code but my first attempt would be to just change (window).load to (document).ready for that first chunk of code and see if it has any impact.

Unfortunately you're reverse-engineering the dev work on the theme and changing the bahavior and it's entirely possible something is going to break. From the looks of it, the original author focused a lot more on "pretty" than performance.

I may file a ticket with pagespeed then. See if they can help me with this, because I don't want to mess up the site and don't have the budget for another theme. Undecided
Find all posts by this user
Quote this message in a reply
09-12-2014, 12:09 AM
Post: #15
RE: Help with load times
PageSpeed isn't going to be able to help. It requires knowledge of the application-level javascript that is part of the theme because the theme code itself is choosing to not display any of the modules until all of the page content has loaded. Unfortunately it is working exactly like the original theme author intended it to and PageSpeed can't go in and change the logical behavior of the code like that.

Some of the filters for prioritizing visible content and lazy loading images might be able to help if the delay load the images in the modules but that's really the only chance that PageSpeed has to help.
Visit this user's website Find all posts by this user
Quote this message in a reply
09-12-2014, 03:24 AM (This post was last modified: 09-12-2014 03:26 AM by ajm_76.)
Post: #16
RE: Help with load times
(09-11-2014 10:18 PM)pmeenan Wrote:  [...] the theme [...] the original author focused a lot more on "pretty" than performance.

^ This really is the bottom line, Enduring Epilepsy. Further, a good chunk of the things that can be done with the theme to improve its technical shortcomings aren't likely to make much of an impact due to the theme's aesthetic dependencies. The site, with this theme, is almost entirely dependent (again, aesthetically) on JavaScript that -- in all likelihood -- has to be blocking, and style sheets, that even if in-lining only 'critical' CSS and deferring the rest, will issue an increase in HTML so large as to get you right back to square one. Further, the problem is compounded by many of the plugins that have been added to an already poorly-coded, and bloated theme (Slider Revolution and the VC Add-Ons, as but two examples).

It's the last thing anyone wants to hear, but your site will never be fast with this theme, even if you were to trim-back on the plugins you've added. It can be made relatively faster, but will never, ever, (...not ever...) be fast.

I just don't want to see you tear your hair out trying to 'polish this turd,' as they say.

Best,
AJ

Make your WordPress website or blog not just faster & not merely fast, but one of the fastest sites in the ENTIRE WORLD.

Performance. Speed. Get Some. WpFASTER!
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 2 Guest(s)