954,595 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

iframe content locking?

hello I would like the first 200 dots of iframe content to be skipped (so the iframe content top is 200 dots from the real top). it should not be able to scroll up those 200 dots. how can that be done?

coat
Newbie Poster
10 posts since Sep 2007
Reputation Points: 10
Solved Threads: 0
 

What do you mean by dots. But if its pixels and you want it 200pixels down from top then its as simple as that

<iframe src="#" style="position:absolute; top:200px; width:70px; height:100px;"></iframe>
vishesh
Nearly a Posting Virtuoso
1,381 posts since Oct 2006
Reputation Points: 85
Solved Threads: 42
 

I meant the content page needs to be skipped 200 pixels of. not the position of the frame it self. thank you.

coat
Newbie Poster
10 posts since Sep 2007
Reputation Points: 10
Solved Threads: 0
 

Do you mean you want the "content of the frame" to be 200 from the top?

Sorry, it is obvious that it is important to you - but we are not quite sure what you mean.
Please forgive us, and if possible, supply a link or a quick iamge of what you have and what you would like... even if it's done in paint!

As soon as we understand what you need, I'm sure we can help you do it.

autocrat
Posting Pro in Training
431 posts since Feb 2005
Reputation Points: 63
Solved Threads: 12
 

hope fully this makes it clear

Attachments page.jpg 23.3KB
coat
Newbie Poster
10 posts since Sep 2007
Reputation Points: 10
Solved Threads: 0
 

Perfect.

So, If I understand correctly.... you want a page that loads the frame.
Inside the frame youw ill oad a second page.
It is the second page that you wish to be 200 from the top.

Now, I assume that when you say "200" you mean downwards (so the pagethat loads in the frame is pushed towards the bottom of the frame // moved downwards from the top).
So instead of it being...

______________________________________
HERE
|
|
200
|
|
v
It would be here

???

Also, by "dots", do you Pixels or Lines?
(Meaning, do you want it moved by 200px or by 200 lines of text?)

autocrat
Posting Pro in Training
431 posts since Feb 2005
Reputation Points: 63
Solved Threads: 12
 

no the 200 should be in visible hiding behind the top edgde of the frame so up.

and dots is pixel

coat
Newbie Poster
10 posts since Sep 2007
Reputation Points: 10
Solved Threads: 0
 

Hmmm...

Well, I'm not sure if it is possibly to apply a styli to the Fram itself...
If it is... something along the lines of
#myframe
{margin-top: -200px;}

The alternative is to code a Container with the frame... so you would have...

And then apply the above CSS suggestion to #framecontentwrap.

Of course, this would mean that the top 200px would not be visible... at all - users would not beable to scroll-up to see, as the contents would basically be "dragged out of view".

If you jsut want it positioned 200px down (so the scrollbar doesn't start at the top), then I believe with a little JS you can apply focus and position the scroller).

autocrat
Posting Pro in Training
431 posts since Feb 2005
Reputation Points: 63
Solved Threads: 12
 
And then apply the above CSS suggestion to #framecontentwrap.


how do I do this?

coat
Newbie Poster
10 posts since Sep 2007
Reputation Points: 10
Solved Threads: 0
 
autocrat
Posting Pro in Training
431 posts since Feb 2005
Reputation Points: 63
Solved Threads: 12
 
#myframe
{margin-top: -200px;}

The alternative is to code a Container with the frame... so you would have...
<frame>
<div id="framecontentwrap">
</div>
</frame>

got confused because of 2 different names here

will try thanks

coat
Newbie Poster
10 posts since Sep 2007
Reputation Points: 10
Solved Threads: 0
 

situation now is like in attachment. I put this:

#framemove {
margin-top: -200px;
}

in tabstyles.css.

it is not skipping the 200? what is wrong?

Attachments thispage.php (3.71KB)
coat
Newbie Poster
10 posts since Sep 2007
Reputation Points: 10
Solved Threads: 0
 

AS I dsaid, no idea if it would work.... I don't sue frames...

that said, did you try the other methd of putting in a div within the frame and applying the style to that?



#frameddiv{
margin-top: -200px;
}

???

The only tother things I can think of is to use JS - which is something else I avoid as much as possible.

autocrat
Posting Pro in Training
431 posts since Feb 2005
Reputation Points: 63
Solved Threads: 12
 

tried all sorts of those com binations but it wouldn't work. below is other suggestion with a remark.

function hideIframeTop(ifrId) {
    var oIframe = document.getElementById(ifrId);
    var oDoc = oIframe.contentWindow || oIframe.contentDocument;
    if (oDoc.document) {
        oDoc = oDoc.document;
    }
    oDoc.body.style.marginTop = '-200px';
    return false;
}

<iframe id="ifr" src="/" onload="hideIframeTop('ifr')" />

this will only work for relative paths on the same server


page calling the frame is in domain.com/folder1/page.php. the page called is in domain.com/folder2/page.php.

how can it work if like that?

coat
Newbie Poster
10 posts since Sep 2007
Reputation Points: 10
Solved Threads: 0
 

No idea...

I can see that it is applying the style of margin top -200px... but it seems to be applying it to the contents of the frame (the body of the pagethat loads).

autocrat
Posting Pro in Training
431 posts since Feb 2005
Reputation Points: 63
Solved Threads: 12
 

Well, I cannot get it to work (then again, I'm naff with scripts :) )

autocrat
Posting Pro in Training
431 posts since Feb 2005
Reputation Points: 63
Solved Threads: 12
 

Nope - it will only draw the Body up to the very top, not beyond it....

Frustrating!

autocrat
Posting Pro in Training
431 posts since Feb 2005
Reputation Points: 63
Solved Threads: 12
 

I give up -sorry.

I've tried applying Psotion Abs/Rel - that makes the gframe itself move.
I've tried applying margin/marginTop etc. with negatives - nothing happens after the body shifts to the frame edge.
I've tried using Clip-rect/overflow etc... nothing!

I'm out of ideas :(

autocrat
Posting Pro in Training
431 posts since Feb 2005
Reputation Points: 63
Solved Threads: 12
 

I suggest they reduce computer science exams to 1 ques tion: how can content be placed higher than an iframe itself? this isn't rocket science is it? thank you for try ing. anyone?

coat
Newbie Poster
10 posts since Sep 2007
Reputation Points: 10
Solved Threads: 0
 

The solution is to generate new content with those pixels removed.

MidiMagic
Nearly a Senior Poster
3,319 posts since Jan 2007
Reputation Points: 730
Solved Threads: 182
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You