Fork me on GitHub

PopUpWindow

License

Popupwindow is using the MIT license.

Special Thanks

Jason Holden (jasonholden.com) - getting onUnload events working

Examples

Takes a link and will create a popupwindow based on the href of the link. You can over ride the default setting by passing your own settings or profile name in the REL attribute of the link.

Default settings:
Example 1
Custom settings:
Example 1 - height:400,width:400
Example 2 - height:550,width:750,toolbar:1,scrollbars:1,status:1,resizable:0,left:50,top:100
Using profiles:
Example 1 - window800
Example 2 - window200
Example 3 - windowCenter
Same window:
Example 1 - windowNotNew
Example 2 - windowNotNew
onUnload event:
Example 1 - windowCallUnload

Settings available:

height:600, // sets the height in pixels of the window.
width:600, // sets the width in pixels of the window.
toolbar:0, // determines whether a toolbar (includes the forward and back buttons) is displayed {1 (YES) or 0 (NO)}.
scrollbars:0, // determines whether scrollbars appear on the window {1 (YES) or 0 (NO)}.
status:0, // whether a status line appears at the bottom of the window {1 (YES) or 0 (NO)}.
resizable:1, // whether the window can be resized {1 (YES) or 0 (NO)}. Can also be overloaded using resizable.
left:0, // left position when the window appears.
top:0, // top position when the window appears.
center:0, // should we center the window? {1 (YES) or 0 (NO)}. overrides top and left
createnew:1, // should we create a new window for each occurance {1 (YES) or 0 (NO)}.
location:0, // determines whether the address bar is displayed {1 (YES) or 0 (NO)}.
menubar:0, // determines whether the menu bar is displayed {1 (YES) or 0 (NO)}.
onUnload:null // function to call when the window is closed

jQuery code and profiles used in the examples above:

var profiles =
{

	window800:
	{
		height:800,
		width:800,
		status:1
	},

	window200:
	{
		height:200,
		width:200,
		status:1,
		resizable:0
	},

	windowCenter:
	{
		height:300,
		width:400,
		center:1
	},

	windowNotNew:
	{
		height:300,
		width:400,
		center:1,
		createnew:0
	},

	windowCallUnload:
	{
		height:300,
		width:400,
		center:1,
		onUnload:unloadcallback
	},

};

function unloadcallback(){
	alert("unloaded");
};


$(function()
{
  		$(".popupwindow").popupwindow(profiles);
});