Jump to content
Stef's Coding Community

Iframe problem - Maybe a JS fix?


Recommended Posts

Iframe problem I am having. I inserted a Iframe on the main Index page and anchored the iframe so it would scroll to a certain part of page. I thought that was that but heres my problem!

 

When I enter the main index page it takes me down to the Iframe on Loading of Page/refresh and scrolls to anchored text in my iframe.

 

It makes my whole main index page scroll down to the Iframe and waits for the Iframe to scroll to the ancored text.

 

I want the main index page to stay at the top and not scroll down to the Iframe to watch it scroll itself.

 

Thanks in advance for all the generous help!

Link to post
Share on other sites

Sounds like you have a #whatever at the end of your link? But first why do you have a iframe on your index page? Can you do the same without it?

 

Yeah the # is my anchor. I am starting to like it now the fact it gets pulled down so I left like this. Thanks for the help. I can do without out it buts its a way to get attention to another page.

Link to post
Share on other sites

I can't really help you, but you can grab items inside an iframe using jQuery:

 

$('#element', $('iframe').get(0).contentDocument)

 

where #element is any selector relative to the html element inside the iframe. Try and experiment with this, maybe you will find a way. I would suggest instead of using #anchor on the iframe url, try and see if you can use jquery to scroll the iframe using jquery after page load.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...