Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    ubh
    ubh is offline
    Regular Coder ubh's Avatar
    Join Date
    Apr 2008
    Location
    Portland, Oregon U.S.A.
    Posts
    443
    Thanks
    108
    Thanked 15 Times in 14 Posts

    Only on first visit to site

    Hi, been working on my portfolio page:
    CLICK HERE

    When the page first loads I am using some javascript to create a loading slash screen inorder to make sure that the pages content is compleatly loaded before I call the splash page to fadeout and the rest of the page to fade is. This way my fades are not as choppy while trying to load the page content simultaneously.

    My questions is how would I go about making this loading splash screen only happen to a visitor when they first arrive, and not if they hit refresh in the browser?

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,862
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    You could use cookies
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    ubh (10-09-2008)

  • #3
    ubh
    ubh is offline
    Regular Coder ubh's Avatar
    Join Date
    Apr 2008
    Location
    Portland, Oregon U.S.A.
    Posts
    443
    Thanks
    108
    Thanked 15 Times in 14 Posts
    hmm cookies huh, darn. I don't know, I always have had a bad impression of the cookie use. I mean relying on the client side to:

    A)Accept Cookies
    B)Have a browsers that handles cookies
    C)Hope the client has not removed my cookie

    Are there any statistics that can show the ups and downs of using cookies, or maybe some of you have an opinion and/or first hand account with using cookies on your site?

  • #4
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    To put things into perspective, you are depending on javascript to remove the splash screen. So users with JS disabled see only a gray screen and never any content.

    So I'd suggest, first defaulting to no splash screen. Then if JS is enabled, load the spash screen with javascript. Prior to though, check if cookies are enabled by setting one and trying to read it. If it is readable set the cookie that prevents the splash screen from reloading, then load it. If they don't have cookies you can either skip the splash screen all together or just have the splash screen load every time.

    Most important though is the fact that in it's current state, any user with javascript disabled will never see your content.
    Last edited by Basscyst; 10-08-2008 at 11:26 PM.
    Helping to build a bigger box. - Adam Matthews

  • Users who have thanked Basscyst for this post:

    ubh (10-09-2008)

  • #5
    ubh
    ubh is offline
    Regular Coder ubh's Avatar
    Join Date
    Apr 2008
    Location
    Portland, Oregon U.S.A.
    Posts
    443
    Thanks
    108
    Thanked 15 Times in 14 Posts
    duhh I completely forgot about JS enabled haha wow.

    Ok so I removed all the opacity CSS rules from my style sheet and have DOM setting the opacity rules inline to avoid the JS enabled problem.

    Now I am trying to run with the cookies (still a bit nervous about using cookies but realize I have no choice), I am trying to following this tutorial begins I have never worked with cookies and expand it onto my needs but so far no go.
    Cookies enabled test

    BTW my domain has moved to:
    http://www.devinrolsen.com

    Here is my code.
    Code:
    Set_Cookie( 'test', 'none', '', '/', '', '' );
    	if ( Get_Cookie( 'test' ) )
    	{
    		cookie_set = true;
    		Delete_Cookie('test', '/', '');
    		
    		Set_Cookie( 'devinrolsen', '1', '', '/', '', '' );
    		
    		if( Get_Cookie( 'devinrolsen' ))
    			cookie_set = true;
    			window.scrollBy(0,-120);
    			window.scrollBy(0,121);
    		else
    		{
    			cookie_set = false;
    			//SET OPACITY FOR ELEMENTS
    			var getHeader = document.getElementById("header");
    			getHeader.style.opacity="0";
    			getHeader.style.filter="Alpha(opacity=0)";
    			
    			var getLogo = document.getElementById("logo");
    			getLogo.style.opacity="0";
    			getLogo.style.filter="Alpha(opacity=0)";
    			
    			var getNav = document.getElementById("navigation");
    			getNav.style.opacity="0";
    			getNav.style.filter="Alpha(opacity=0)";
    			
    			var getMain = document.getElementById("main");
    			getMain.style.opacity="0";
    			getMain.style.filter="Alpha(opacity=0)";
    			
    			var getContent = document.getElementById("content");
    			getContent.style.opacity="0";
    			getContent.style.filter="Alpha(opacity=0)";
    			
    			var getBgDeco = document.getElementById("bg_deco");
    			getBgDeco.style.opacity="0";
    			getBgDeco.style.filter="Alpha(opacity=0)";
    			
    			var getNavArrow = document.getElementById("nav_arrow");
    			getBgDeco.style.opacity="0";
    			getBgDeco.style.filter="Alpha(opacity=0)";
    			
    			
    			window.scrollBy(0,-120);
    			window.scrollBy(0,121);
    			var docBody = document.getElementsByTagName('body')[0];
    			docBody.style.background="url(images/loading.gif)";
    			docBody.style.backgroundColor="#797979";
    			docBody.style.backgroundPosition="center center";
    			docBody.style.backgroundRepeat="no-repeat";
    			
    			setTimeout('opacityLoad()',4000);		
    		}
    		
    	}
    	// if the Get_Cookie test fails, cookies 
    	//are not enabled for this session.
    	else
    	{
    		cookie_set = false;
    	}
    Any Ideas?

  • #6
    ubh
    ubh is offline
    Regular Coder ubh's Avatar
    Join Date
    Apr 2008
    Location
    Portland, Oregon U.S.A.
    Posts
    443
    Thanks
    108
    Thanked 15 Times in 14 Posts
    Wow I got it to work.

    I really recommend this cookie lib to anyone who is working with them for the first time. Javascrip Cookie Lib

    Check the site out now:
    My Site

    Only problem is that its got a tiny flicker on when the page loads and when the opacity's are set with DOM so you see the page and then the "loading splash screen" for a split second.

    I dont quite know what it is thats doing it but if there is a way to make it stop that would be the best x-max present a person could ever have

    here is my js code now.

    Code:
    function startLoading()
    {
    Set_Cookie( 'test', 'it works', '', '/', '', '' );
    if ( Get_Cookie( 'test' ) )
    {
    Delete_Cookie('test', '/', '');
    
    	if ( Get_Cookie( 'devinrolsen' ) ){
    		window.scrollBy(0,-120);
    		window.scrollBy(0,121);	
    	}
    	else
    	{
    		Set_Cookie( 'devinrolsen', 'devinrolsen', '1', '/', '', '' );
    		//SET OPACITY FOR ELEMENTS
    		var getHeader = document.getElementById("header");
    		getHeader.style.opacity="0";
    		getHeader.style.filter="Alpha(opacity=0)";
    		
    		var getLogo = document.getElementById("logo");
    		getLogo.style.opacity="0";
    		getLogo.style.filter="Alpha(opacity=0)";
    		
    		var getNav = document.getElementById("navigation");
    		getNav.style.opacity="0";
    		getNav.style.filter="Alpha(opacity=0)";
    		
    		var getMain = document.getElementById("main");
    		getMain.style.opacity="0";
    		getMain.style.filter="Alpha(opacity=0)";
    		
    		var getContent = document.getElementById("content");
    		getContent.style.opacity="0";
    		getContent.style.filter="Alpha(opacity=0)";
    		
    		var getBgDeco = document.getElementById("bg_deco");
    		getBgDeco.style.opacity="0";
    		getBgDeco.style.filter="Alpha(opacity=0)";
    		
    		var getNavArrow = document.getElementById("nav_arrow");
    		getBgDeco.style.opacity="0";
    		getBgDeco.style.filter="Alpha(opacity=0)";
    		
    		
    		window.scrollBy(0,-120);
    		window.scrollBy(0,121);
    		var docBody = document.getElementsByTagName('body')[0];
    		docBody.style.background="url(images/loading.gif)";
    		docBody.style.backgroundColor="#797979";
    		docBody.style.backgroundPosition="center center";
    		docBody.style.backgroundRepeat="no-repeat";
    		
    		setTimeout('opacityLoad()',4000);		
    	}
    }
    }

  • #7
    ubh
    ubh is offline
    Regular Coder ubh's Avatar
    Join Date
    Apr 2008
    Location
    Portland, Oregon U.S.A.
    Posts
    443
    Thanks
    108
    Thanked 15 Times in 14 Posts
    What the heck is this crap? Why are you spamming in my topic? I have question up in the air and you come along with this crap?

    Thanks.

  • #8
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,862
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Quote Originally Posted by ubh View Post
    What the heck is this crap? Why are you spamming in my topic? I have question up in the air and you come along with this crap?
    What happened to you?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #9
    ubh
    ubh is offline
    Regular Coder ubh's Avatar
    Join Date
    Apr 2008
    Location
    Portland, Oregon U.S.A.
    Posts
    443
    Thanks
    108
    Thanked 15 Times in 14 Posts
    oh nothing its been removed, someone came in and was spamming an advertisement.. I was just a little perplexed at the whole thing


  •  

    Posting Permissions

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