MyBB Community Forums

Full Version: Using jQuery cookies
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
just like somethings that you write .but replace my ads with "this is a box." text .
Thansk for the tutorial although i already worked this out Smile , Don't even know javascript or jquery but it was simple to understand Smile
some one help me please !!
!
i want to use this code in header template !!!!!
please some one help !

how should use it !

i write this code in header but both close and open button show !

i past this code in my header template :

<script src="jquery.js"></script>
		   
    <script>
	jQuery.noConflict();

jQuery(document).ready(function($) {
// Now use $ as you would usually with jQuery without mucking about. Far easier
}); 

$("#button_open").on('click', function(event) {
    event.preventDefault();
    $(this).hide(); //hides the open button as the box is now open
    $('#box').slideDown('fast'); //shows the box
    $('#button_close').show(); //shows the close button
    $.cookie("openclose","open", {expires: 365}); //sets cookie
}); 

    </script>
<a href="#" id="button_open">Open</a>
<a href="#" id="button_close">Close</a>
<div id="box">this is a box. </div>

whats wrong ?
here is really support site !
i answer one question some day ago !!!
thank you for this good support !
hello
Try this:

<script src="jquery.js"></script>
           
<script>
jQuery.noConflict();
jQuery(document).ready(function($) {
$("#button_open").on('click', function(event) {
    event.preventDefault();
    $(this).hide(); //hides the open button as the box is now open
    $('#box').slideDown('fast'); //shows the box
    $('#button_close').show(); //shows the close button
    $.cookie("openclose","open", {expires: 365}); //sets cookie
}); 
}); 
</script>

<a href="#" id="button_open">Open</a>
<a href="#" id="button_close">Close</a>
<div id="box">this is a box. </div> 

this isn't definitely going to work but it might Smile
thank you for your help but this code isn't work for me

i copy all of this code and past to my header but don't work yet !

i attach a pic

[attachment=26958]

another one :
[attachment=26959]
site url?
Pages: 1 2 3