Window Factory
Download Window Factory v0.9
24-Mar-2011 [11KB, Min, Gzip]
Implementation
<script type="text/javascript" src="window-factory-0.9.js"></script>

Note: Do not forget to include jQuery script.

Creating a window
var win=windowFactory.create(options);

Options

var win=windowFactory.create({standard:true,width:100,height:100});
OptionTypeDescription
winContentA jQuery collection of DOM elementsSet content of the window.
showtrue/falseShow/hide the window.
widthnumber/stringSet width of the client area. Default value - "auto"
heightnumber/stringSet height of the client area. Default value - "auto"
thickFrametrue/falseSet border which can be used for resizing. See the sizable option.
colorstringSet color of the window.
For example: #aabbccdd or #aabbcc
aa: Red, bb: Green, cc: Blue, dd: Opacity
Empty string to set no color.
captiontrue/falseSet caption for the window.
textstringSet text of the caption.
textShadowtrue/falseSet shadow for text of the caption of the window.
innerBorderstringSet border for the client area of the window.
For example: "#aabbcc" or empty string.
clientColorstringSet color for the client area.
The same format as for the color option.
If not set, clientColor=color
sizabletrue/falseSet sizing ability. Works only if thickFrame=true
modaltrue/falseSet the modality of the window.
modalColorstringSet color for area around the modal.
The same format as for the color option.
standardtrueIf you set standart:true you set
show, thickFrame, caption, textShadow=true and color="#fcfcfc99"
Events

var win=windowFactory.create({standard:true,width:100,height:100});
win.hover=function(e){but.show(e.type=="mouseenter")};
EventDescription
hoverOccurs when the mouse pointer enters or leaves the window.
Methods

var win=windowFactory.create({standard:true,width:100,height:100});
win.move(300,200);
MethodDescription
show(true/false)Show/hide window.
option(optionName,value)Set option for the window. Ex: win.option("text","Hello!");
option(map)A map of option-value pairs to set. Ex: win.option({text:"Hello!",textShadow:false});
move(x,y)Move window. x,y can be undefined.
center()Move the window to the center of page.
dragBy(element,deep)By default window can be moved only by caption.
element - an element to drag by
deep - true/false - not include children / include
Example:
win.dragBy($("#elem :not(input)"),true); //selects all elements except input
addButton(name,click,hover)Creates standard button.
The paramenter name can be only "closeButton" so far.
Returns the Button Object.
About other parameters see below.
addButton(width,height,image,style,
click,hover,shadowColor)
Creates a button using an image.
width,height - size of button in pixels
image - url for image "img.png"
style - extra styles for button "top:3px;right:3px;"
click - function for the onlick event - function(){win.show(false)}
hover - function for the hover events
shadowColor - color for the shadow of the button
Example of Image:

Returns the Button Object.
The button object

var win=windowFactory.create({standard:true,width:100,height:100});
var but=win.addButton("closeButton",function(){win.show(false)});
but.show(false);
MethodDescription
show(true/false)Show/hide the button.
enable(true/false)Enable/disable the button.


Comments
Guest1321679168510#0
Don't waste your time with components that offer no source code. There are too many out there that come with full source.