Results 1 to 3 of 3

Thread: Floating Top Bar Keep Last Position Help

  1. #1
    Join Date
    Feb 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Floating Top Bar Keep Last Position Help

    Floating Top Bar
    http://www.dynamicdrive.com/dynamicindex17/floatbar.htm

    Link to the page I am working on
    http://worshipfilms.mine.nu:8008/col...php?coll_id=18

    I setup the floating top bar on my site to display flash videos dynamically when a user clicks on the video link. Currently the only video I have encoded into flash is Scene #002 - Chase. So if you click on the image of the second video you can see the script work. Unfortunately my test server is on a cable connection so streaming video is kind of choppy but you can still see it work.

    I added a function openbar() to the script so I can call closebar() on the page load and then have the bar open when a user clicks on a link. Everything works great except when you scroll down on the page and click a video link then openbar() is called and the page jumps to the top and opens the video.

    Here is the openbar() function.

    function openbar(){
    document.getElementById("topbar").style.visibility="visible"
    }

    I tried setting
    startY = (document.all)?iecompattest().scrollTop:window.pageYOffset + 5;
    at the beginning of the staticbar() function and it causes the window to open in the correct place but then it scrolls to the top which is what I want it not to do.

    If anyone can help me I will give you the swf file that I created to stream external flash encoded video (.flv) and a copy of the script that sends the variables to the swf.

    Also if you're interested my live site is http://www.worshipfilms.com

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The reason the page is jumping to the top is not because something is being made visible, that should never cause a page to change its scroll position. The reason is the link itself for 'Close' on the video pop-up:

    http://worshipfilms.mine.nu:8008/collections.php?coll_id=18#

    When the last thing on the address is '#' it means to jump to the top of the page. I have a feeling (though I couldn't easily locate it in the code) that what that link's href actually is in the code is:

    href="#"

    If I am right about that, simply change it to:

    href="javascript:void(0);"

    and it should be fine. You may also want to get rid of some of that added code you mention in your post as it wasn't helping and didn't address the real problem.

    One other thing, if the link is something like so:

    Code:
    <a href="#" onclick="closeVid();">Close</a>
    You can also fix it by adding:

    Code:
    <a href="#" onclick="closeVid();return false;">Close</a>
    - John
    ________________________

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

  3. #3
    Join Date
    Feb 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the info. I had already fixed it by adding the id of the div after the # but then every time I clicked on a different video the page would jump about 5 pixels down which is the amount of the y offset in the original floating top bar code. I was going to live with it but putting javascript:void(0); for the href works perfectly.

    As promised you can download my source files including the fla here.

    Please note that I started out with the flash video tutorial and added the external interface class to it so you will see some code in the fla written by Macromedia.

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
  •