How to hide an element for a certain user forever if clicked
I am trying to figure out how to hide an element to not show again if a
user clicks the dismiss button. Basically it is just a drop down with
promotional information. If the user clicks dismiss, I do not want this
element to show to that user ever again.
I would like it to function like the banner seen here http://codecanyon.net/
Is there a way to do this? I tried Googling this answer but could not
really find this example. I am assuming this needs to be achieved with
cookies. Also, if that is the case, would that cause any issues with SSL
Encrypted pages?
Here is my code:
<div id="promotional-banner">
<div id="promotional-wrapper">
<div id="promotional-container">
<p class="left"><img src="<?php echo
Mage::getStoreConfig(Mage_Core_Model_Store::XML_PATH_SECURE_BASE_URL);
?>media/wysiwyg/infortis/fortis/custom/rewards.png"
alt="Earn Rewards" title="Earn Rewards" /> Earn reward
points every time you shop at WeePumpkin.com</p>
<div class="right close-button"><span>X</span> Dismiss</div>
<div class="clear"></div>
</div>
</div>
</div>
<script type="text/javascript">
$$ = jQuery;
$$(document).ready( function() {
if ($$("#promotional-banner").is(":hidden")) {
$$("#promotional-banner").delay("1000").fadeIn();
}
$$("div.close-button").click(function(){
$$("#promotional-banner").delay("slow").fadeOut();
});
});
</script>
No comments:
Post a Comment