Answer the question
In order to leave comments, you need to log in
How to show div on click and remember in cookies?
Hello
There is a script that, when you click on a link, hides a div and writes it to cookies
. Everything works.
<div class="col" id="box1">
<a id="url1" href="#" target="_blank">ССЫЛКА1</a>
</div>
<script type="text/JavaScript">
$(document).ready(function (){
var box1 = $.cookie('box1')//Получаем значение куки
if(box1 =='none'){//Делаем проверку
$('#box1').remove();//И закрываем блок если куки есть
}
$('#url1').click(function() {//При клике на id кнопки закрытия
$('#box1').slideUp(1000);//Закрываем сам id блока
$.cookie('box1', 'none', { expires: 7});//И создаём куку
});
});
</script>
<div class="col" id="box1" style="display: none">
<a id="url1" href="#" target="_blank">ССЫЛКА1</a>
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question