Results 1 to 6 of 6

Thread: tooltip script problem: positioning a picture on the browser window

  1. #1
    Join Date
    Apr 2007
    Posts
    59
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default tooltip script problem: positioning a picture on the browser window

    On your webpage I've discovered a nice tooltip script:
    http://www.dynamicdrive.com/dynamici...agetooltip.htm

    I have some pictures to display. The pictures should pop-up at the far right of the browser window.
    I changed the CSS script as follow:

    .ddimgtooltip{
    box-shadow: 3px 3px 5px #818181; /*shadow for CSS3 capable browsers.*/
    -webkit-box-shadow: 3px 3px 5px #818181;
    -moz-box-shadow: 3px 3px 5px #818181;
    display:none;
    position:absolute;
    right:10px;
    top:50px;


    border:1px solid black;
    background:white;
    color: black;
    z-index:2000;
    padding: 4px;
    }


    where I've added right:10px; top:50px;
    The pop-up picture is still positioned near the link and not 10px from the right corner of the browser window.
    Any suggestions?
    Last edited by ddadmin; 05-31-2010 at 08:08 AM.

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    The position of the tooltips is controlled by the script, not the CSS, so you'll need to edit the former to get the result you want. Try finding the below line inside the .js file:

    Code:
    x=(x+tipw>$(document).scrollLeft()+$(window).width())? x-tipw-(ddimgtooltip.tooltipoffsets[0]*2) : x

    and change that to:

    Code:
    x=($(document).scrollLeft()+$(window).width()-tipw-5
    DD Admin

  3. #3
    Join Date
    Apr 2007
    Posts
    59
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    Dear ddadmin, thanks for your help. Unfortunately with the changes you suggest the image does not pop up. Most probably there are more changes to do.

  4. #4
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Ah yes there was a slight error in my syntax, and upon testing, in logic as well actually. Try replacing the original line with this instead:

    Code:
    x=(x+tipw>$(document).scrollLeft()+$(window).width())? x-tipw-(ddimgtooltip.tooltipoffsets[0]*2) : $(document).scrollLeft()+$(window).width()-tipw-10
    DD Admin

  5. The Following User Says Thank You to ddadmin For This Useful Post:

    paldo (06-02-2010)

  6. #5
    Join Date
    Apr 2007
    Posts
    59
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    Dear ddadmin

    you are a genius ! It works fine on all browsers.

    It would be nice if you can add this improvement to the script to the tutorial here:
    http://www.dynamicdrive.com/dynamici...agetooltip.htm

    Thank you for your help

  7. #6
    Join Date
    Jan 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I am trying to accomplish the same thing as Paldo. I replaced the js code that you wrote, but nothing happens. The tooltip still loads offset from the cursor based on

    tooltipoffsets: [100, 100].

    Am I missing something? I would like the tooltip to appear in the same exact position no matter where the cursor is. Any help is appreciated. Thanks!

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
  •