Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 10 of 10
  1. #1
    Junior Member
    Join Date
    Mar 2006
    Posts
    7
    Member #
    12779
    Hi,
    I have a problem.
    I have a page that i have intergrated into one of my sites. This page is intergrated using an iframe so it looks like its part of the site. The trouble i'm having is:
    I have some pictures on the iframe page that when they are clicked they take you to a bigger pic and some more info. The trouble is when i keep scrolling down the main page(the one that isn't in the iframe) and i click on a pic near the bottom of the page it loads the bigger pic and info but the main page doesn't scroll back to the top so it looks like nothing has loaded!
    Is there a piece of script that when i click the picture link in the iframe page it will load the pic but also make the main page(the one that isn't in the iframe) return to the top?
    Thanks:nervous:
    Joe

  2.  

  3. #2
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326

  4. #3
    Junior Member
    Join Date
    Mar 2006
    Posts
    7
    Member #
    12779
    Hi

    Quote Originally Posted by bfsog
    Javascript, window.scrollto ?

    Does this code take the page that isn't in the iframe to the top when the pic is clicked? Where would i stick this so i can test it?

    Thanks for the quick reply

    Joe

  5. #4
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    It will scroll whichever window you tell it to.

    If the link is in the iframe and you have a code like window.scrollto(0,0) it will scroll the current window, you would want to use the parent of the frame.

    You would add a event handler to the link,

    HTML Code:
    <a href="#" onclick="scrollWin();">link text</a>
    The function would look like
    Code:
    function scrollWin()
        {
            parent.scrollto(0,0);
        }

  6. #5
    Junior Member
    Join Date
    Mar 2006
    Posts
    7
    Member #
    12779
    Hi again!

    Thanks for the reply i have tried this but A) im not sure if i put the:
    Code:
    function scrollWin()
        {
            parent.scrollto(0,0);
        }
    

    In the proper place. I wraped it in <script></script> tags
    and placed it in between the <head></head> tags and
    it still didn't work. If this is any help heres a link to a test
    site that its on. If you scroll down to one of the bottom
    pictures and click on it you should see what happens.

    Thanks again!
    Joe

  7. #6
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    No link?

    Oops, try parent.window.scrollto

  8. #7
    Junior Member
    Join Date
    Mar 2006
    Posts
    7
    Member #
    12779
    Sorry that still doesn't work :cry:

  9. #8
    Junior Member
    Join Date
    Mar 2006
    Posts
    7
    Member #
    12779
    Hi again,

    I did a bit of tinkering with that script that you gave me and i now works! Thankyou very much

    Joe

  10. #9
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    No worries, if you could post your finalised code so if this thread is found via a search, other users have the answer?

  11. #10
    Junior Member
    Join Date
    Mar 2006
    Posts
    7
    Member #
    12779
    Yeah sure it was

    Code:
    <A href="yourpage.htm" onClick="parent.window.scrollTo(0,0)">Your link name</A>
    It was basicly yours but without calling the function etc

    Thanks again

    Joe


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 01:22 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com