This article mainly introduces the JavaScript simulated Dialog pop-up floating box effect code, involving the creation and layout of JavaScript drag windows, which has some reference value, you can refer to the examples in this article to describe the Javascript simulated Dialog pop-up floating box effect code. Share it with you for your reference. The details are as follows:
Here, we will demonstrate the JS simulated Dialog pop-up floating box. In the Blue classic style, you can create a new layer, set the title and content of the pop-up layer, and use it to implement a login box, or used in background management.
The running effect is as follows:
The Online Demo address is as follows:
Http://demo.jb51.net/js/2015/js-mn-dialog-float-dlg-style-demo/
The Code is as follows:
Dialog floating windowScript var z = 1, I = 1, left = 10var isIE = (document. all )? True: false; var $ = function (id) {return document. getElementById (id) ;}; var Extend = function (destination, source) {for (var property in source) {destination [property] = source [property] ;}} var Bind = function (object, fun, args) {return function () {return fun. apply (object, args | []) ;}} var BindAsEventListener = function (object, fun) {var args = Array. prototype. slice. call (arguments ). slice (2 ); Return function (event) {return fun. apply (object, [event | window. event]. concat (args); }}var CurrentStyle = function (element) {return element. currentStyle | document. defaultView. getComputedStyle (element, null);} function create (elm, parent, fn) {var element = document. createElement (elm); fn & fn (element); parent & parent. appendChild (element); return element}; function addListener (element, e, fn) {elemen T. addEventListener? Element. addEventListener (e, fn, false): element. attachEvent ("on" + e, fn)}; function removeListener (element, e, fn) {element. removeEventListener? Element. removeEventListener (e, fn, false): element. detachEvent ("on" + e, fn)}; var Class = function (properties) {var _ class = function () {return (arguments [0]! = Null & this. initialize & typeof (this. initialize) = 'function ')? This. initialize. apply (this, arguments): this ;}; _ class. prototype = properties; return _ class;}; var Dialog = new Class ({options: {Width: 400, Height: 400, Left: 100, Top: 100, Titleheight: 26, minwidth: 200, Minheight: 200, CancelIco: true, ResizeIco: false, Info: "news title", Content: "No Content", Zindex: 2}, initialize: function (options) {this. _ dragobj = null; this. _ resize = null; this. _ cancel = null; this. _ body = null; this. _ x = 0; this. _ y = 0; this. _ fM = BindAsEventListener (this, this. move); this. _ fS = Bind (this, this. stop); this. _ isdrag = null; this. _ Css = null; this. width = this. options. width; this. height = this. options. height; this. left = this. options. left; this. top = this. options. top; this. cancelIco = this. options. cancelIco; this. info = this. options. info; this. content = this. options. content; this. minwidth = this. options. minwidth; this. minheight = this. options. minheight; this. titleheight = this. options. titleheight; this. zindex = this. options. zindex; Extend (this, options); Dialog. zindex = this. zindex // construct dialog var obj = ['dialogcontainter ', 'dialogtitle', 'dialogtitleinfo', 'dialogtitleico', 'dialogbody', 'dialogbottom']; for (var I = 0; I
I hope this article will help you design JavaScript programs.