Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-25-2009, 08:35 AM   PM User | #1
imoen
New Coder

 
Join Date: Jul 2009
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
imoen is an unknown quantity at this point
Shrink page content to screen size

I need to make an inline pop-up on my site "zoom out" so that the contents of the pop-up are scaled to the screen size instead of having scroll bars.

This is my code to make the in-line pop-up:
Code:
<html>
<head>
<title></title>
</head>
<body>
<script>
var dragapproved=true
var minrestore=0
var initialwidth,initialheight
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all
function drag_drop(e){
if (ie5&&dragapproved&&event.button==1){
document.getElementById("dwindow").style.left=tempx+event.clientX-offsetx
document.getElementById("dwindow").style.top=tempy+event.clientY-offsety
}
else if (ns6&&dragapproved){
document.getElementById("dwindow").style.left=tempx+e.clientX-offsetx
document.getElementById("dwindow").style.top=tempy+e.clientY-offsety
}
}
function initializedrag(e){
offsetx=ie5? event.clientX : e.clientX
offsety=ie5? event.clientY : e.clientY
if (ie5)
document.getElementById("saver").style.display=''
tempx=parseInt(document.getElementById("dwindow").style.left)
tempy=parseInt(document.getElementById("dwindow").style.top)
dragapproved=true
document.onmousemove=drag_drop
}
function loadwindow2(url){
width = screen.width;
height = screen.height;
if (!ie5&&!ns6)
window.open(url,"","width=width,height=height,scrollbars=1")
else{
document.getElementById("dwindow").style.display=''
document.getElementById("dwindow").style.width=initialwidth=width/1
document.getElementById("dwindow").style.height=initialheight=height/1
document.getElementById("dwindow").style.left=5
document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+30 : document.body.scrollTop*1+30
document.getElementById("cframe").src=url
}
}
function maximize(){
if (minrestore==0){
minrestore=1 //maximize window
document.getElementById("maxname").setAttribute("src","http://site_link/restore.gif")
document.getElementById("dwindow").style.width=ns6? window.innerWidth-30 : document.body.clientWidth
document.getElementById("dwindow").style.height=ns6? window.innerHeight-30 : document.body.clientHeight
}
else{
minrestore=0 //restore window
document.getElementById("maxname").setAttribute("src","http://ka-w3.tw-family.us/js/img/max.gif")
document.getElementById("dwindow").style.width=initialwidth
document.getElementById("dwindow").style.height=initialheight
}
document.getElementById("dwindow").style.left=ns6? window.pageXOffset : document.body.scrollLeft
document.getElementById("dwindow").style.top=ns6? window.pageYOffset : document.body.scrollTop
}
function closeit(){
document.getElementById("dwindow").style.display="none"
}
if (ie5||ns6)
document.onmouseup=new Function("dragapproved=true;document.onmousemove=null;document.getElementById('saver').style.display='none'")
</script>
<div id="dwindow" style="position:absolute;background-color:#black; cursor:hand; left:0px;top:0px; display:none" onMousedown="initializedrag(event)" onMouseup="stopdrag()" onSelectStart="return false">
<div align="right" style="background-color:black color:white">
<img src="http://site_link/max.gif" id="maxname" onClick="maximize()">
<img src="http://site_link/close.gif" onClick="closeit()">
</div>
<div id="dwindowcontent" style="height:100%">
<iframe id="cframe" src="" width=width height=height></iframe>
</div>
</div>
<form><input type="button" onClick="loadwindow2('http://site_link.html')" value="Load Map"></form>
</body>
</html>
The pop-up has content from some of my other sites in iframes.
imoen is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:54 AM.


Advertisement
Log in to turn off these ads.