jQuery Cookie issue and changing a div based on specific page visit

jQuery Cookie issue and changing a div based on specific page visit

Hi everyone, I have a slight issue where I need to change a div based on a user visiting a specific page which triggers and sets a cookie then switches a div and its content to display different content (a sticky bar).

BUT if any normal visitor DOES NOT visit this specific page the div content (in this case a sticky bar) then the bar does not change.

I have asked on StackOverflow http://t.co/nyxQY9LH and had little response that would help as i’m new to jQuery and use of jQuery cookies especially.

Can anybody help? I’m in desperate need!

<div id="sticky-bar">
   <a href="#"></a>
</div>
<div id="sticky-private">
   <a href="#"></a>
</div>

<script type="text/javascript">
     $(function() {
if(!$.cookie('repeatVisitor')) {
    // if the user is not a repeat visitor, set the cookie
    $.cookie("repeatVisitor", "true", { expires: 3 }); //expires in 3 days
}

if ($.cookie('repeatVisitor')) {
    // if the cookie exists, show the custom div
    setTimeout('showDivTwo();', 3000);
    
}
})

function showDivTwo() {
$('#sticky-bar').fadeOut();
$('#sticky-private').fadeIn();
}

</script>