PDA

View Full Version : [TUT] Auto-Expanding Iframes.



Florx
06-04-2007, 04:29 AM
Hello! Thanks for attempting to read this load of mashed up html code and random speeches! So lets start.

1) You need to put this code into your <head> tags:


<script type="text/javascript">
var iframeids=["content"]
var iframehide="yes"
var getFFVersion=navigator.userAgent.substring(navigat or.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 47 : 0
/*
Internet explorer seems to think it can make it's own rules about the internet.
*/
function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextr aHeight;
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller

</script>

2) You need to have an iframe with an id of content e.g.


<iframe id="content"></iframe>

Thats about it really. Any problems POST \/ :eusa_whis

Thanks for reading.

FlorX

Robbie
06-04-2007, 08:30 AM
You forgot to credit DynamicDrive.

F32
06-04-2007, 08:39 AM
Indeed.

That code is illegal unless you include the DD copyright comments in the JS file.

Hardly a tutorial anyway - c&p isn't a tutorial?

alexxxxx
06-04-2007, 08:41 AM
he's c&p a tutorial. so? give this guy some credit.

and it's a code that could be used by anyone.

hybride
06-04-2007, 08:41 AM
This tutorial is available from DynamicDrive, thanks for putting it up but you should have left the credits.

I highly recommend to any webmasters that you do NOT use this script as users with without Javascript will experience difficulty viewing your website!

F32
06-04-2007, 08:43 AM
;3371577']he's c&p a tutorial. so? give this guy some credit.

and it's a code that could be used by anyone.
He's breaching copyright - a lawyer wouldn't "give the guy some credit".

Frog!
06-04-2007, 08:51 AM
As i have said many a time.

"Respect4U = 0"

:Edzy
06-04-2007, 09:11 AM
Hello! Thanks for attempting to read this load of mashed up html code and random speeches! So lets start.

1) You need to put this code into your <head> tags:


<script type="text/javascript">
var iframeids=["content"]
var iframehide="yes"
var getFFVersion=navigator.userAgent.substring(navigat or.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 47 : 0
/*
Internet explorer seems to think it can make it's own rules about the internet.
*/
function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextr aHeight;
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller

</script>

2) You need to have an iframe with an id of content e.g.


<iframe id="content"></iframe>

Thats about it really. Any problems POST \/ :eusa_whis

Thanks for reading.

FlorX

it would be nice to know how to slice a compatible one also

ScottDiamond
06-04-2007, 10:43 AM
Hello! Thanks for attempting to read this load of mashed up html code and random speeches! So lets start.

1) You need to put this code into your <head> tags:


<script type="text/javascript">
var iframeids=["content"]
var iframehide="yes"
var getFFVersion=navigator.userAgent.substring(navigat or.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 47 : 0
/*
Internet explorer seems to think it can make it's own rules about the internet.
*/
function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextr aHeight;
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller

</script>

2) You need to have an iframe with an id of content e.g.


<iframe id="content"></iframe>

Thats about it really. Any problems POST \/ :eusa_whis

Thanks for reading.

FlorX

Let me get started with my cup of tea. :)

1) It's Javascript, not 'mashed up HTML'.
2) The iFrame wont work as you have not included src="link" to display the content.
3) Most important, it's DD's. :)
4) Lol.

PinkFM
06-04-2007, 01:02 PM
Thats not auto expanding ifram
The ifram code does not say "expanding"
its just a load of JS making it expand.

Florx
06-04-2007, 04:27 PM
Umm well it was off club habbos site if im being totally honest. So flame clubhabbo (who also have no official status left LMAO!)

EDIT: And next time I find a script I think will benefit the Habbo Community I wont bother posting it! If thats all you do to people who are trying to help the new users or the ones unfamiliar to HTML or whatever then I wont post it again.

sBosma
06-04-2007, 05:19 PM
Umm well it was off club habbos site if im being totally honest. So flame clubhabbo (who also have no official status left LMAO!)

EDIT: And next time I find a script I think will benefit the Habbo Community I wont bother posting it! If thats all you do to people who are trying to help the new users or the ones unfamiliar to HTML or whatever then I wont post it again.


You should still credit who ever made it, as you can't take credit for something you didn't make.

:Edzy
06-04-2007, 05:20 PM
You should still credit who ever made it, as you can't take credit for something you didn't make.

Okay everyone give the person a break

Blob
06-04-2007, 05:49 PM
Okay everyone give the person a break

The person.. Thats nice.:rolleyes:

Anyway, just check where its from before posting

Florx
06-04-2007, 06:04 PM
You should still credit who ever made it, as you can't take credit for something you didn't make.
Sorry i forgot.

CREDIT TO CLUBHABBO.net!

Happy now lol and thanks :Edzy it is my first tutorial ;)

Thread Closed

Want to hide these adverts? Register an account for free!