Tactical Panda Websites - Animated Window Opening Script
 
  Home Page •  About Us •  Search •  Contact Us •  Bookmark  
"Helping you to help yourself to the internet!"  
 
Contents
Colour
Forms
Free Stuff
Graphics
HTML
Javascripts
Cascading Style Sheets
Tables
Website Templates
 
In Brief...
 
Javascripts (8)

Animated Window Opening Script

For this script, make sure that your ultra-keen anti-virus software allows pop-ups and new windows to open - some of them are very vigilant and won't allow mini-windows to open, even when you want them to!

This script is more for those who are bored with the usual mini-window opening 'onclick' and want something a little different. Useful examples could be your Privacy Statement or additional information files that don't require a 'full' window.

I have used my corporate Privacy Statement in these examples, but it could be virtually anything! Click either (or both) link to see what happens first:

Text Link

That was different wasn't it! The script is easy to use as well, here's the script for the <HEAD> section:

<SCRIPT language=JavaScript>
<!-- Begin
function expandingWindow(website) {
var windowprops='width=100,height=100,scrollbars=yes,status=yes,resizable=yes'
var heightspeed = 2; // vertical scrolling speed (higher = slower)
var widthspeed = 7; // horizontal scrolling speed (higher = slower)
var leftdist = 10; // distance to left edge of window
var topdist = 10; // distance to top edge of window
if (window.resizeTo&&navigator.userAgent.indexOf("Opera")==-1) {
var winwidth = window.screen.availWidth - leftdist;
var winheight = window.screen.availHeight - topdist;
var sizer = window.open("","","left=" + leftdist + ",top=" + topdist +","+ windowprops);
for (sizeheight = 1; sizeheight < winheight; sizeheight += heightspeed)
sizer.resizeTo("1", sizeheight);
for (sizewidth = 1; sizewidth < winwidth; sizewidth += widthspeed)
sizer.resizeTo(sizewidth, sizeheight);
sizer.location = website;
}
else
window.open(website,'mywindow');
}
// End -->
</SCRIPT>

The part for the body depends on what you want for your site, text or button. Here's both versions:

Text:
<a href="#" onClick="expandingWindow('privacy.html');return false" onfocus="this.blur()">Text Link</a>

Button:
<form><input type="button" value="Button Link" onClick="expandingWindow('privacy.html')" onfocus="this.blur()"></form>

That's it! As usual I have highlighted the variables in red.

[1] [2] [3] [4] [5] [6] [7] [8]

Top

<<< Previous page
 
Home Page •  About Us •  Search •  Contact Us •  Bookmark
© Copyright 2004 Tactical Panda