Jumping to anchor within a iFrame - without moving parent page

Discussion in 'Javascript' started by Robert Mark Bram, Nov 8, 2005.

  1. Hi All,

    We are using a scrolling iFrame to present a list of options to the
    user within the main page with an anchor against each option. Depending
    on the user actions, we jump to an anchor in the frame with code like
    this:

    theFrameSrc = theFrame.src;
    theFrame.src = theFrameSrc + "#" + anchorName;

    The issue is that when we jump to it, the parent document moves as well
    i.e. the frame scrolls to bring the option to the top of the frame, but
    then the main document scrolls to bring that option to the top of the
    window.

    Is there a way to turn off this second behaviour, so that only the
    iFrame scrolls?

    Any help would be most appreciated!

    Rob
    :)
     
    Robert Mark Bram, Nov 8, 2005
    #1
    1. Advertising

  2. Robert Mark Bram a écrit :
    > Hi All,
    >
    > We are using a scrolling iFrame to present a list of options to the
    > user within the main page with an anchor against each option. Depending
    > on the user actions, we jump to an anchor in the frame with code like
    > this:
    >
    > theFrameSrc = theFrame.src;
    > theFrame.src = theFrameSrc + "#" + anchorName;
    >
    > The issue is that when we jump to it, the parent document moves as well
    > i.e. the frame scrolls to bring the option to the top of the frame, but
    > then the main document scrolls to bring that option to the top of the
    > window.
    >
    > Is there a way to turn off this second behaviour, so that only the
    > iFrame scrolls?
    >
    > Any help would be most appreciated!
    >
    > Rob
    > :)


    Providing the url to the actual page being developed is always a good idea.

    <a href="[IframeURL].html#anchorName" target="IframeName">Some option</a>

    There is always the possibility of using scrollIntoView(false) to
    prevent the scrolling.

    Gérard
    --
    remove blah to email me
     
    Gérard Talbot, Nov 8, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jalkadir
    Replies:
    3
    Views:
    471
    jalkadir
    Oct 5, 2005
  2. dorayme
    Replies:
    3
    Views:
    431
    dorayme
    May 3, 2008
  3. Jeff Johnson

    iFrame Call to Parent Anchor

    Jeff Johnson, Jan 22, 2004, in forum: Javascript
    Replies:
    0
    Views:
    247
    Jeff Johnson
    Jan 22, 2004
  4. PD
    Replies:
    6
    Views:
    752
  5. Replies:
    2
    Views:
    140
    Randy Webb
    Jul 21, 2006
Loading...

Share This Page