SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Set Cookie on jQuery WOAHbar (Hello Bar alternative) to Remember Previous State

    Hello everyone,

    I've installed the WOAHbar on a new site which is an awesome free alternative
    to the Hello Bar, found here:

    http://blog.jobdeals.com/2011/12/fre...e-source-code/

    The only thing I want to change is for it to remember the previous state the visitor
    chooses when they navigate to a different page or post. I'm trying to use the
    jQuery Cookie plugin. I'm new to jQuery, so I'm having trouble figuring it out.

    Here's the jQuery for WOAHbar:

    Code:
    <script type="text/javascript">
        var stub_showing = false;
     
        function woahbar_show() { 
            if(stub_showing) {
              $('.woahbar-stub').slideUp('fast', function() {
                $('.woahbar').show('bounce', { times:3, distance:15 }, 100); 
                $('body').animate({"marginTop": "2.4em"}, 250);
              }); 
            }
            else {
              $('.woahbar').show('bounce', { times:3, distance:15 }, 100); 
              $('body').animate({"marginTop": "2.4em"}, 250);
            }
        }
    
     
        function woahbar_hide() { 
            $('.woahbar').slideUp('fast', function() {
              $('.woahbar-stub').show('bounce', { times:3, distance:15 }, 100);  
              stub_showing = true;
            }); 
     
            if( $(window).width() > 1024 ) {
              $('body').animate({"marginTop": "0px"}, 250); // if width greater than 1024 pull up the body
            }
        }
     
        $().ready(function() {
            window.setTimeout(function() {
            woahbar_show();
         }, 5000);
    
    
        });
    	</script>
    Any help would be appreciated!

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by kennyk3 View Post
    The only thing I want to change is for it to remember the previous state the visitor
    chooses when they navigate to a different page or post. I'm trying to use the
    jQuery Cookie plugin.
    That would involve doing two things.

    1. When a tab is opened, set a cookie that records information about which tab has been opened.
    2. When the page loads, use that cookie information (if it exists) to set the current tab.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Zealot
    Join Date
    May 2002
    Location
    Montreal
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Adding Cookies to a WOAHBar

    I read your question the other day and did not find the response very helpful. I was able to figure it out and I wrote about it on my blog: Adding Cookies to a WOAHBar.

    Hope it helps.

    Mark
    Mark Dixon
    Freelance Web Designer and Developer
    www.markdixon.ca
    Montreal, Quebec, Canada



Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •