document.referrer for a splash effect
Hi, I'm trying to create a splash page effect on my index page by adding some full screen images with jquery. I got that to work, but I only want to call the script if a person is arriving at the homepage after coming from an external site. I think I can use document.referrer in something like this:
- <script type="text/javascript">
- $(document).ready(function() {
- var url = document.referrer;
- var match = url.indexOf("sitename");
- if (match != -1) {
- $('#wrapper').hide();
- $('#imgContainer').npFullBgImg("images/leisurestuff.jpg", {fadeInSpeed: 2000, center: true});
- $('#logoContainer').fullLogoImg("images/splash_logo.png", {fadeInSpeed: 2000, center: true});
- $('#logoContainer').click(function(){
- $('#wrapper').show('fast');
- $('#splash_kill').remove();
- $(this).remove();
- });
- }
- });
- </script>
But it's not working I'm very new to javascript so any help would be much appreciated. Thanks!