SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Feb 2006
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Maintaining iframe scroll position

    I am developing verison 2 of my site
    http://guitarvideos.org/version2/

    My problem is whenever someone clicks play on a video in the list (the iframe on the right) it reloads the page and they loose thier place in the list. Is there any way to maintain that position?

    Thanks guys,
    Jordan

  2. #2
    SitePoint Guru
    Join Date
    Apr 2006
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Option2-
    Use the search string in the tail of the link's href-
    index.php?video=21
    when the page opens, look for the link that matches
    and call linkelement.scrollIntoView(true)
    (you need the true for Opera- firefox and IE assume it.)

  3. #3
    SitePoint Member
    Join Date
    Feb 2006
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    awsome man thanks for the speedy response.

    When you say "call" what do you mean. I have barely any experience with javascript.

    Where in the <a>would you put that linkelement.scrollIntoView(true) string ?

  4. #4
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Those links on the right of the page do this:
    <a href="#">

    How are you planning on loading the video?

  5. #5
    SitePoint Member
    Join Date
    Feb 2006
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    those were just there because I hadn't edited them yet. I just finished the whole script aside from this. If you refresh you will see the links point toward

    <a href="./video6.html">

    Also I just realized that its not an iframe I have them in, its a div with scrolling enabled. I can switch it to an iframe though if you can't do what I want with the div.

  6. #6
    SitePoint Member
    Join Date
    Feb 2006
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    alright what I have done is make it so each video has an anchor in front of it.

    Now onload I have this function exucted

    function goToAnchor() {
    document.getElementById("morevideos").location.href = "#video11";
    }

    my problem is in this line "document.getElementById("morevideos").location.href = "#video11";"

    What is the proper JS terminology to say div "morevideos" go to anchor video11


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
  •