Joined: Mar 2009 Gender: Male Posts: 2,594 Location: MI, USA Karma: 102
Full Window Splash Portal « Thread Started on Mar 7, 2011, 11:45am »
Full Window Splash Portal by SubDevo Tested in IE, FF, Opera, Safari and Chrome.
This code allows you to create your own custom splash/portal page for your main page. This code doesn't care if you use a custom domain or if the user enters with (or without) "index.cgi" in the URL (like other portal codes). You choose how often the splash page is shown. You have an option to keep the page always in view or have it scroll with the page. This code uses cookies. So, if a user has cookies disabled or deletes them, they will see the splash page again.
Enjoy!!! SubDevo
The code is in three parts. The CSS (style), the mySplashPage div (contains your HTML for the splash page) and the script itself.
For the CSS, do not modify (or remove) anything above and including z-index. They are needed for proper operation of the splash page.
The mySplashPage div is where you put all your HTML for your splash page. Replace the Yellow part with your own HTML.
<div id="mySplashPage" style="display:none;"> <center> <!-- Splash Content BELOW here -->
<!-- Splash Content ABOVE here --> </center> </div>
The link to close the splash is this: <a href="javascript:closeSplash()">ENTER</a> You can change the text in this or even use an image link, like so: <a href="javascript:closeSplash()"><img src="URL TO IMAGE" /></a> You can also have it so the user can just click anywhere on the screen to close the page, by adding the Yellow to this line: <div id="mySplashPage" onclick="closeSplash()" style="display:none;">
Variables:
var keepInView=1; // Keep top of splash page always in view? 1=Yes, 0=No If this is set to 0, your page will scroll when the user scrolls the page. If set to 1, your page will always stay in view.
var mExp=-1; // Days before expires. Enter the amount of days before the user will see the splash page again. There are a couple "special" values here. 0 days will show the splash page one time for the user, while browsing your forum. When they exit their browser (not tab), they will see the splash page again. If this is set to a negative number (code default), the user will see the splash page EVERY TIME they go to the main page. This is great for testing. Other than that, it could get annoying. So, make sure you change this once you are done testing.
<!-- Splash Content ABOVE here --> </center> </div>
<script type="text/javascript"> /* Full Window Splash Portal by SubDevo */ /* Global Header - Please leave this header intact. Do not repost. */ /* [url]http://interoceandesigns.com[/url] or [url]http://lsdp.proboards.com[/url] */
var keepInView=1; // Keep top of splash page always in view? 1=Yes, 0=No var mExp=-1; // Days before expires.
function splashHeight(a){ var m=document.body,b=m.scrollTop; (keepInView)?mY_s.style.top=b:mY_s.style.height=m.clientHeight+b; } function splashCook(){ var ex="",d=new Date(); if(mExp!=0){ d.setTime(d.getTime()+(mExp*86400000)); ex=" expires="+d.toUTCString()+";"; } document.cookie="mySplashPage=1;"+ex+" path=/"; } var gotCook=/mySplashPage=1/i.test(document.cookie); splashCook(); if(pb_action=="home"&&!gotCook){ var mY_s=document.getElementById("mySplashPage"); mY_s.style.display=""; splashCook(); if(document.uniqueID){window.attachEvent("onscroll", splashHeight);} else{(keepInView)?mY_s.style.position="fixed":window.addEventListener("scroll", splashHeight, false);} } function closeSplash(){ mY_s.innerHTML=""; mY_s.style.display="none"; (window.detachEvent)?window.detachEvent("onscroll", splashHeight):window.removeEventListener("scroll", splashHeight, false); } </script>
Joined: Nov 2010 Gender: Male Posts: 976 Location: California Karma: 53
Re: Full Window Splash Portal « Reply #2 on Mar 11, 2011, 11:19am »
Umm Sub, I got a question. I'm trying to put my flash in the background through the CSS, is this possible? If so how? I already tried using the 'background-image: url(URL HERE);' and it doesn't work. Any suggestions?
EDIT:
Ok if the above isn't possible, would it be possible to move the 'Enter' button on TOP of the flash? Not above the flash, but on top. Catch my drift?
Joined: Mar 2009 Gender: Male Posts: 2,594 Location: MI, USA Karma: 102
Re: Full Window Splash Portal « Reply #3 on Mar 11, 2011, 12:46pm »
You can't set a flash file as a background image in CSS. But, you can easily move the "Enter" button (and any other HTML) on TOP of the flash. Notice our menu buttons are on top of our flash banner? Do you have a test site with your splash page that I can look at?
Joined: Nov 2010 Gender: Male Posts: 976 Location: California Karma: 53
Re: Full Window Splash Portal « Reply #7 on Mar 13, 2011, 7:08am »
Ok so Sub, I got the images done (thanks to RAD ) for my splash. Now there's only one more thing I want to add. Would it be possible to add some music to the splash? I already got the link to the song I want, all I need is the html code or something to add it. I just want the music to play in the background. I don't want a button for it, since people probably won't stay very long looking at the splash lol Is this possible?
EDIT:
Ok, I just found out something odd about the splash. Whenever I first go to my forum, and I close the splash, for some reason I'm not able to scroll anywhere using my mouse scroll. I have to click on the scroll button to actually go down or use the down/up arrows. But once I refresh, everything is normal again. I can scroll down with my mouse and/or by clicking on the arrows, or scroll buttons.
Joined: Mar 2009 Gender: Male Posts: 2,594 Location: MI, USA Karma: 102
Re: Full Window Splash Portal « Reply #8 on Mar 13, 2011, 10:51am »
You want to add MORE to download on that page? mp3 file size will be larger than the flash banner. Unless it is a very small clip and/or midi file. In this case, it might be best to add it into the flash itself, otherwise, I would have to make code to embed it then shut it off when you click off the splash. PM me the link to your music file please.
Hmmm... You are right the scroll doesn't work in FF like you said. Strange thing is, on YOUR site, if you click anywhere in your banner (after closing the splash), the scroll magically works again. After tearing apart my code, I found out the issue is not in the code, but the flash itself. And it must have something to do with the flash button code because if I use your site banner for the flash splash or if I click outside the flash to close it (without clicking the button), I do not get the scroll issue. So, Rad, we may have to play with the events of that button on the banner. I don't know how you have that button set up. Maybe change the "target" attribute? Maybe, instead of setting it up as a link, is there a way to give the button an "onclick" event instead of a URL with an href? If so, the onclick event would be closeSplash(). I'll have to get with you on this...
Joined: Mar 2009 Gender: Male Posts: 2,594 Location: MI, USA Karma: 102
Re: Full Window Splash Portal « Reply #10 on Mar 13, 2011, 2:04pm »
Yup. I have the same problem at your test site with FF. The issue doesn't arise unless you actually wait and click the button to remove the splash page. Clicking outside the flash to remove it, everything is peachy!
Joined: Nov 2010 Gender: Male Posts: 976 Location: California Karma: 53
Re: Full Window Splash Portal « Reply #13 on Mar 13, 2011, 6:13pm »
Well, now that I think of it better, lets just forget about the music shall we? lol
Now, regarding the scrolling problem, yes it happens to me on your test site too RAD, but like you guys said, if I click outside the image, then everything is cool. I mean its no biggie for me, its just something that I noticed, and wanted to bring to your attention just in case it bothered anyone else using your code Sub.
Joined: Mar 2009 Gender: Male Posts: 2,594 Location: MI, USA Karma: 102
Re: Full Window Splash Portal « Reply #14 on Mar 13, 2011, 6:36pm »
Well, like I said, it isn't the code. It has something to do with the way FF handles the link in the flash file. Since Rad isn't getting the issue with an older version, it seems to me that SOMETHING has changed in the newest version of FF. But it IS bugging me...