Results 1 to 3 of 3

Thread: Floating Bar Javascript: Only display once per visitor

  1. #1
    Join Date
    Nov 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Floating Bar Javascript: Only display once per visitor

    RE: http://www.dynamicdrive.com/dynamicindex17/floatbar.htm

    First of all, thank you so much for providing these great scripts for us all to use.

    I just started using the floatbar script and it's working great. I was just wondering if there were some way to prevent the box from reappearing to the same visitor after they've clicked the "close" button but later revisit or reload the page, possibly by using their IP address or a cookie.

    Also, if I add "position: center;" in the style section, the script will not work. Is there a way we can align the div bar to display in the middle of the page? If you use the x offset, it may not align properly if the window is sized differently.

    Thanks again.
    Last edited by ccsconcrete; 11-27-2008 at 03:30 AM.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,926
    Thanks
    43
    Thanked 3,192 Times in 3,155 Posts
    Blog Entries
    12

    Default

    Set persistclose to 1 in the script as shown below:

    Code:
    /***********************************************
    * Floating Top Bar script-  Dynamic Drive (www.dynamicdrive.com)
    * Sliding routine by Roy Whittle (http://www.javascript-fx.com/)
    * This notice must stay intact for legal use.
    * Visit http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    
    var persistclose=1 //set to 0 or 1. 1 means once the bar is manually closed, it will remain closed for browser session
    var startX = 30 //set x offset of bar in pixels
    var startY = 5 //set y offset of bar in pixels
    var verticalpos="fromtop" //enter "fromtop" or "frombottom"
    To center the bar, set its left to 50%, and its margin left to a negative value half it's width. The !important directive should be used with the left property, ex:

    Code:
    #topbar{
    position:absolute;
    border: 1px solid black;
    padding: 2px;
    background-color: lightyellow;
    width: 620px;
    left: 50%!important;
    margin-left: -310px;
    visibility: hidden;
    z-index: 100;
    }
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Nov 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks a ton! Worked like a charm.

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
  •