Link to home
Start Free TrialLog in
Avatar of swaggrK
swaggrK

asked on

Javascript delay when

On my website the following javascript successfully hides the <div> within my page BUT there seems to be a delay and so the image flashes for a brief second. Can someone assist me with rewriting this script so that the image does not appear at all.

A little more information. The reason for this div is so that an image I have on my blog only appears on the home page and NOT when
the user clicks page 2, 3, etc.


Script in header.


    <script type="text/javascript">
    $(function () {
        if (document.location.href.indexOf('PageID') > -1) {
            $('#hideme').hide();
			$('#hideme2').hide();
			$('#hideme3').hide();
			$('#showme').show();
            /*
			alert("Hey, you have selected to hide a div based on the URL parameters. Way to go!");
			*/
        } else {
          /*  
		  alert("You haven't done anything cool yet. Check out the text on this page to see some nifty changes.");
            $('#hideme').show();
			*/
        }
    });
</script>

Open in new window


Code  within page that hides div.

<div id="hideme2">
<image>
</div>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Rainer Jeschor
Rainer Jeschor
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of swaggrK
swaggrK

ASKER

I tried.  The image still flashes for a brief second.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial