Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jonas Gunnarsson 44 posts 194 karma points
    May 04, 2014 @ 10:51
    Jonas Gunnarsson
    0

    Faster website

    Hi, I'm not sure I'm posting in the right place now, but then maybe someone can move the thread.

    I have a pretty heavy loaded homepage with large images that take up the entire page. Although I have reduced the quality of the pictures the front page take some time to load, especially on mobile devices.

    As it is now the menu loads when all the images have been loaded, so the first step would be that the menu loads first. How can I do that?

    I'm not sure if I should post all the code here to show how I've done, it gone be a lot. But if you need some code, just let me know and I will post it.

    You can find my website here: www.jonasfotograf.se

    Thanks, Jonas

    (Sorry for my bad English.)

  • Garðar Þorsteinsson 114 posts 536 karma points
    May 04, 2014 @ 19:18
    Garðar Þorsteinsson
    0

    Hi Jonas,

    If you f.ex check the network request you have on the homepage you can see its running 36 http request that are in total 8.6mb.

    Thats way over the top for mobile phones (and desktop if you think about it). I would try to get it to max 1mb and under 30 requests.

    Most of the images are loaded right away but are then just shown randomly with a timer, I would think that probably 1% of your visitors will wait on the homepage and look at all the images.

    If you want this function I would load ony 1 image first and then use somekind of an lazyload to load the others.

    Hope this helps you, I would try to go deeper on this but at the moment I dont have time, will take a look at this thread when I can.

    Best regards

    Gardar

     

     

     

  • Jonas Gunnarsson 44 posts 194 karma points
    May 04, 2014 @ 19:59
    Jonas Gunnarsson
    0

    Hi Gardar,

    thanks it help a lot. I know that my pictures are too big and too many. Reduce the number of images on the first page, to begin with. Then I keep on googling and trying to find how to solve the problem of load first image, and then load the rest of the pictures. But I have not found a suitable solution yet.

    But I will continue and see if I can find some solution to this.

    Thanks,
    Jonas 

  • Jonas Gunnarsson 44 posts 194 karma points
    May 05, 2014 @ 12:10
    Jonas Gunnarsson
    100

    I added a new field in umbraco where I upload pictures with max width 400px and I only have 5 images there, which I load when the width is less than 400px. However, I probably have reduced the quality of the images a bit too much, but what else do you think about this solution?

    <script type="text/javascript">
    if (window.matchMedia("(max-width: 460px)").matches)
    {
        @{
    
    
          var mediaID5 = Model.Content.GetProperty("mobileimages").Value.ToString().Split(',');
        @:jQuery(function($){
                    @:$.supersized({
                            @:slideshow         :   1,          // Slideshow on/off
                            @:autoplay          :   1,          // Slideshow starts playing automatically
                            @:start_slide       :   0,          // Start slide (0 is random)
                            @:slide_interval    : 3000,              // Length between transitions
                            @:fit_always        :0,
                            @: slides: [
                                         foreach (var mediaID in mediaID5){
                var media = umbraco.uQuery.GetMedia(mediaID);
    
        @:{ image: '@media.GetImageUrl()'},
                                 }
    @:],
                                          @:});
                 @:});
                     }
    }
    else
    @{
    
    
        var mediaID1 = Model.Content.GetProperty("images").Value.ToString().Split(',');
        @:jQuery(function($){
            @:$.supersized({
                @:slideshow         :   1,          // Slideshow on/off
            @:autoplay          :   1,          // Slideshow starts playing automatically
            @:start_slide       :   0,          // Start slide (0 is random)
            @:slide_interval    : 3000,              // Length between transitions
            @:fit_always        :0,
            @: slides: [
                         foreach (var mediaID in mediaID1){
                var media = umbraco.uQuery.GetMedia(mediaID);
    
            @:{ image: '@media.GetImageUrl()'},
            }
    @:],
        @:});
     @:});
    }
    

  • John Churchley 27 posts 172 karma points
    May 05, 2014 @ 22:41
    John Churchley
    1

    You could run all the images through an image file compression tool to reduce the file size of your images further.

    FileOptimizer works well

    http://nikkhokkho.sourceforge.net/static.php?page=FileOptimizer

  • Jonas Gunnarsson 44 posts 194 karma points
    May 06, 2014 @ 21:41
    Jonas Gunnarsson
    0

    Thanks John, I will look into it.

Please Sign in or register to post replies

Write your reply to:

Draft