I'm trying to hide a dropdown div above a header when the no button is clicked and I'm not sure where the problem lies because I'm still learning JQuery.
Not sure what $.cookie("cookies_ok", 1,... does, the rest of the line uses Shopify's language to check the expiration date.
I'm not sure where the problem lies within the code.
(function($) {
$(document).ready(function(){
if ($.cookie("cookies_ok") != 1) {
$(".cookies_container").show();
if ($(".cookie_ok").click(function () ){
$.cookie("cookies_ok", 1, { expires : });
$(this).parent().parent().slideUp("slow");
return false;
});
else if($(".cookie_no").click(function () ){
$(this).parent().parent().slideUp("slow");
return false;
});
else{
$(".cookies_container").hide();
return false;
};
};
};
);
})(jQuery);
<div class="cookies_container">
<div class="container">
<p><b> </b></p>
<a href="" class="cookie_btn cookie_ok">OK, I don't mind using cookies</a>
<a href="" class="cookie_btn cookie_no">No thanks</a>
Aucun commentaire:
Enregistrer un commentaire