Core code:
Copy codeThe Code is as follows: // obtain the window height
Var success wheight;
// Obtain the window width
Var implements wwidth;
// Obtain the pop-up window width
Var popWidth;
// Obtain the pop-up window height
Var popHeight;
Function init (){
Optional wheight = $ (window). height ();
Required wwidth = $ (window). width ();
PopHeight = $ (". window"). height ();
PopWidth = $ (". window"). width ();
}
// Close the window
Function closeWindow (){
$ (". Title img"). click (function (){
$ (This). parent (). parent (). hide ("slow ");
});
}
// Define the method for displaying the center window
Function popCenterWindow (){
Init ();
// Calculate the offset of Y in the upper left corner of the pop-up window.
Var popY = (windowHeight-popHeight)/2;
Var popX = (required wwidth-popWidth)/2;
// Alert ('www .jb51.net ');
// Set the window position
$ ("# Center" ).css ("top", popy).css ("left", popX). slideToggle ("slow ");
CloseWindow ();
}
Function popLeftWindow (){
Init ();
// Calculate the offset of Y in the upper left corner of the pop-up window.
Var popY = shadowwheight-popHeight;
// Var popX =-(required wwidth-popWidth );
// Alert (popY );
// Set the window position
$ ("# Left" ).css ("top", popy-50..css ("left", 50). slideToggle ("slow ");
CloseWindow ();
}
Function popRightWindow (){
Init ();
// Calculate the offset of Y in the upper left corner of the pop-up window.
Var popY = shadowwheight-popHeight;
Var popX = required wwidth-popWidth;
// Alert (www.cnblogs.com/jihua );
// Set the window position
$ ("# Right" ).css ("top", popy-50).css ("left", popX-50). slideToggle ("slow ");
CloseWindow ();
}
Complete code:Xmlns = "http://www.w3.org/1999/xhtml">
Script home-center window www.jb51.net script home-Left window www.jb51.net script home-Right window www.jb51.net