Welcome Loading … Page with Jquery

前端 未结 5 1555
北荒
北荒 2021-01-03 03:23

How can I implement a welcome screen for 5 seconds giving information like Loading application ... + some application infos...while the main page loads in background.

相关标签:
5条回答
  • 2021-01-03 03:30

    Although I agree with @TheTXI, the best way to do it is to have the "loading..." screen visible by default using CSS, and then hide it once everything is loaded using jQuery (instead of waiting for a fixed amount of time).

    See jQuery.load()... ex:

      $(document).ready(function(){
        $("body img:last").load($("#welcome-screen").fadeOut());
      });
    
    0 讨论(0)
  • 2021-01-03 03:37

    Unless you are actually using that time in the background to actually do some sort of preloading, I would highly suggest against this coming from an end-user perspective. I personally would find it annoying that when going to a website, I would have to sit through some sort of introduction before actually getting to the content I want.

    This is why I tend to hate websites designed in Flash or those that simply incorporate a Flash splash page.

    Edit: I don't necessarily think the main page's load should qualify for much on the "preloading" scale, unless it is resource intensive. Again, these are just my opinions.

    Edit #2: It could also be argued that visitors to your website will make their decision on whether to stay or go based on as little as five seconds. Remember that those using the internet tend to have the attention spans of fruit flies, and putting them into a holding pattern before they actually get to the content is a good way to lose those users.

    0 讨论(0)
  • 2021-01-03 03:45

    just for anyone in the future who finds this, i found a more elegant solution that works.

    http://www.jnorton.co.uk/blog/jquery-check-if-all-content-has-been-loaded

    here is how i used it:

    $(document).ready(function(){
        $(window).load(function() {$("#welcome").fadeOut('fast'); })
    });
    
    0 讨论(0)
  • 2021-01-03 03:48

    I think it is acceptable to have a 'loading ...' page in some cases - for example, after a user to a business application logs in (think TurboTax online ... it says something like 'establishing a secure connection', which is probably not exactly true, but loading interface stuff). Showing the page every time an anonymous user goes to your site is probably not the best idea.

    Take a look at jQuery BlockUI. It is flexible and can do what you are talking about.

    0 讨论(0)
  • 2021-01-03 03:48

    You would show your welcome message as the page loads (theoretically as an absolutely positioned overlay). You could then use jQuery to kick off a timer:

    $(document).ready(function(){
        setTimeout(function(){
            $('div#overlay').fadeOut();
        }, 5000);
    });
    
    0 讨论(0)
提交回复
热议问题