MyBB Community Forums

Full Version: Close div and show it again after period of time (cookies)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I wanna ask you if you can help me with this
https://community.mybb.com/thread-150668...pid1060286


I would like to have a <div> in index which will be hideable (click on it) but after 24 hours it will pop up again.

Thank you very much, I am not good at JS. Sad
Do you just need the code Destroy666 provided converted to jQuery?
I have a div with class="index_info" located above my forum content. I would like to hide it after click on it for 24 hours. However my JS knowledge is really poor so any advise would be really appreciated Smile Thank you in advance
EDIT:

<div class="index_info" style="display: none;">
	<span id="closeButton" style="float: right; cursor: pointer;">[X]</span>
	CONTENT HERE
</div>

you should be able to use this code:

<script type="text/javascript">
!function($) {
    var myDiv,
		closeButton;

    function init() {
        myDiv = $(".index_info");
		closeButon = $("#closeButton");

        if (Cookie.get("sitenote") != "X") {
            myDiv.show();
        }

        closeButon.click(onClose);
    }

    function onClose(e) {
        Cookie.set("sitenote", "X", 86400);
        myDiv.hide();
    }

    $(init);
}(jQuery);
</script>
Without success Sad anyway thank you for your input and code
I've PMed you updated code.
@Wildcard - thank you for your time and help! +1

I will post there the working code for everybody whose will need it someday.
I've updated my answer with the final code.