SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Feb 2011
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post jQuery: Why does the transition blink.

    Whispering Turbines, Inc.

    This is the website that is in question. Below is the script that I think is causing the problem. Every time you navigate to a new page I want the pages to fade out/in. However, there is a brief blink in between animations. I have tried to use stop() and not, but neither seems to help. I will post both options.

    Option 1:
    Code JavaScript:
    $(document).ready(function() {
    	$('body').css('background-color', '#000');
    	$('body').css('display', 'none');
        $('body').fadeIn(1000);
    	$('a').click(function(event){
            event.preventDefault();
            linkLocation = this.href;
            window.location = linkLocation;
            });
    });

    Option 2:
    Code JavaScript:
    $(document).ready(function() {
    	$('body').stop().css('background-color', '#000');
    	$('body').css('display', 'none');
        $('body').fadeIn(1000);
    	$('a').click(function(event){
            event.preventDefault();
            linkLocation = this.href;
            window.location = linkLocation;
            });
    });
    Last edited by paul_wilkins; May 29, 2011 at 00:05.

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,195
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    There is no way to stop this from happening while using window.location, your best option would be to use jQuery's AJAX methods to pull in the content and overwrite the current body content.

  3. #3
    SitePoint Member
    Join Date
    Feb 2011
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Sarge.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •