I have an issue where I need to have this carousel saving the users preference.
So when user clicks the bar to hide it - it will then remain hidden sitewide - currently it resets every page.
Cannot use jquery.cookie.js as it's not working and comes up as malicious attack on server.
Need a solution that works.
http://depositcasino.info/
<script>			
            var visible = false
                
                $("#bonuses-container #bonuses").slideDown("slow", function(){
                    $("#bonuses-container #bonuses .carousel").jcarousel({
                        auto:8,
                        scroll:1,
                        animation:500,
                        wrap:"circular",
                        initCallback:initCarousel
                    });
                    visible = true;
                });
           
        function initCarousel(carousel){
            $("#bonuses-container .bonuses-btn a").click(function(){
                if(visible)
                    carousel.startAuto();
                else
                visible = !(visible);
                $("#bonuses-container #bonuses").slideToggle("slow");
                return false;
            });
        }    
																																							
        </script>
Pippin Williamson answers:
You could do it really easily with a PHP SESSION. Let me know if this is an acceptable method and I will get you the code.
pandragon comments:
Hey Pippin yeah that would work :) It's wordpress site so pretty much everything is php
Pippin Williamson comments:
										Start a PHP SESSION in your header.php like this:
//Start a session if one isn't already started
if(!session_id()){
    session_start();
    session_regenerate_id();
}
if (!isset($_SESSION['created'])) {
    $_SESSION['created'] = time();
} else if (time() - $_SESSION['created'] > 1800 ) {
    // session started more than 30 minutes ago
    $_SESSION = array();
    session_regenerate_id(true);    // change session ID for the current session an invalidate old session ID
    $_SESSION['created'] = time();  // update creation time
}
Then use an IF statement to determine whether the user has just visited the site or not:
if ( $_SESSION['views'] == 1 )
{
   put your code here that activates the jquery
}
This will set up a session every time someone visits the site, then will reset the session after 30 minutes.									
pandragon comments:
Ok then how does it work for bonus bar? To save the toggle etc. Sorry really novice lol
Pippin Williamson comments:
jQuery is not my strength, but you could set it up such that if ( $_SESSION['views'] == 1 ), set the bonus bar to "up", else set it to "down" as the default state.