DHTML: Examples of 3 different heights of three-dimensional drag layer

xiaoxiao2021-03-06  42

->

_xwin </ title></p> <p><style type = 'text / css'></p> <p><! -</p> <p>A: visited {text-decoration: none; color: slategray;</p> <p>A: Hover {text-decoration: underline; color: slategray;</p> <p>A: Link {text-decoration: none; color: slategray;</p> <p>-></p> <p></ style></p> <p><script language = jscript></p> <p><! -</p> <p>/ / Can be packaged as JS file;</p> <p>VAR X0 = 0, Y0 = 0, X1 = 0, Y1 = 0;</p> <p>VAR OFFX = 6, OFFY = 6;</p> <p>Var moveable = false;</p> <p>Var Hover = 'Orange', Normal = 'Slate'; // Color;</p> <p>Var index = 10000; // z-index;</p> <p>// Start drag;</p> <p>Function StartDrag (OBJ)</p> <p>{</p> <p>// Lock the title bar;</p> <p>Obj.setcapture ();</p> <p>// Define objects;</p> <p>Var win = obj.parentnode;</p> <p>Var sha = win.nextsibling;</p> <p>// Record the mouse and layer position;</p> <p>X0 = Event.ClientX;</p> <p>Y0 = Event.clienty;</p> <p>X1 = parseint (win.style.left);</p> <p>Y1 = parseint (win.style.top);</p> <p>// Record the color;</p> <p>Normal = Obj.Style.BackgroundColor;</p> <p>// Change the style;</p> <p>Obj.Style.BackgroundColor = HOVER;</p> <p>Win.Style.BorderColor = Hover;</p> <p>Obj.nextsibling.style.color = Hover;</p> <p>Sha.Style.Left = x1 offx;</p> <p>Sha.Style.top = Y1 OFFY;</p> <p>Moveable = true;</p> <p>}</p> <p>//drag;</p> <p>Function Drag (OBJ)</p> <p>{</p> <p>Var win = obj.parentnode;</p> <p>Var sha = win.nextsibling;</p> <p>IF (moveable)</p> <p>{</p> <p>Win.Style.LEFT = x1 Event.ClientX - X0;</p> <p>Win.Style.top = Y1 Event.Clienty - Y0;</p> <p>Sha.Style.Left = PARSEINT (WIN.Style.Left) OFFX;</p> <p>Sha.style.top = parseint (win.style.top) OFFY;</p> <p>}</p> <p>}</p> <p>// Stop dragging;</p> <p>Function Stopdrag (OBJ)</p> <p>{</p> <p>Var win = obj.parentnode;</p> <p>Var sha = win.nextsibling;</p> <p>Win.Style.BorderColor = Normal;</p> <p>Obj.Style.BackgroundColor = NORMAL;</p> <p>Obj.nextsibling.style.color = normal;</p> <p>Sha.Style.Left = obj.parentnode.style.Left; Sha.Style.top = Obj.parentNode.Style.top;</p> <p>// release the title bar;</p> <p>Obj.releaseCapture ();</p> <p>Moveable = false;</p> <p>}</p> <p>// Get the focus;</p> <p>Function GetFocus (OBJ)</p> <p>{</p> <p>INDEX = INDEX 2;</p> <p>VAR idx = index;</p> <p>Obj.Style.zindex = IDX;</p> <p>Obj.nextsibling.style.zindex = IDX-1;</p> <p>}</p> <p>Function min (OBJ)</p> <p>{</p> <p>Var win = obj.parentnode.parentNode;</p> <p>Var sha = win.nextsibling;</p> <p>VAR TIT = Obj.ParentNode;</p> <p>Var msg = tit.nextsibling;</p> <p>Var flg = msg.style.display == "none";</p> <p>IF (flg)</p> <p>{</p> <p>Win.style.height = parseint (msg.style.Height) PARSEINT (TIT.Style.Height) 2 * 2;</p> <p>Sha.Style.height = win.style.height;</p> <p>Msg.style.display = "block";</p> <p>Obj.innerhtml = "0";</p> <p>}</p> <p>Else</p> <p>{</p> <p>Win.Style.height = parseint (tit.style.height) 2 * 2;</p> <p>Sha.Style.height = win.style.height;</p> <p>Obj.innerhtml = "2";</p> <p>Msg.style.display = "none";</p> <p>}</p> <p>}</p> <p>Function CLS (OBJ)</p> <p>{</p> <p>Var win = obj.parentnode.parentNode;</p> <p>Var sha = win.nextsibling;</p> <p>Win.Style.visibility = "hidden";</p> <p>Sha.style.visibility = "hidden";</p> <p>}</p> <p>// Create an object;</p> <p>Function XWIN (ID, W, H, L, T, TIT, MSG)</p> <p>{</p> <p>INDEX = INDEX 2;</p> <p>THIS.ID = ID;</p> <p>THIS.WIDTH = W;</p> <p>THIS.HEIGHT = H;</p> <p>THIS.LEFT = L;</p> <p>THIS.TOP = T;</p> <p>THIS.ZINDEX = INDEX;</p> <p>THIS.TITLE = TIT;</p> <p>THIS.MESSAGE = MSG;</p> <p>THIS.OBJ = NULL;</p> <p>THIS.BULID = BULID;</p> <p>this.bulid ();</p> <p>}</p> <p>//initialization;</p> <p>Function Bulid ()</p> <p>{</p> <p>Var str = ""</p> <p> "<div id = xmsg" this.id ""</p> <p> "Style = '"</p> <p> "z-index:" this.zindex ";"</p> <p> "Width:" this.width ";"</p> <p> "Height:" this.Height ";" "Left:" this.Left ";"</p> <p> "Top:" this.top ";"</p> <p> "Background-Color:" Normal ";"</p> <p> "Color:" NORMAL ";"</p> <p> "font-size: 10px;"</p> <p> "font-family: verdana;"</p> <p> "Position: absolute;"</p> <p> "CURSOR: Default;"</p> <p> "Border: 2px solid" Normal ";"</p> <p> "'"</p> <p> "οnmοusedοwn = 'getfocus (this)'>"</p> <p> "<div"</p> <p> "Style = '"</p> <p> "Background-Color:" Normal ";"</p> <p> "Width:" (this.width-2 * 2) ";"</p> <p> "HEIGHT: 20;"</p> <p> "Color: White;"</p> <p> "'"</p> <p> "οnmοusedοwn = 'startdrag (this)'"</p> <p> "οnmοuseup = 'stopdrag (this)'"</p> <p> "οNMοUSEMοVE = 'DRAG (this)'"</p> <p> ">"</p> <p> "<span style = 'width:" (this.width-2 * 12-4) "; padding-left: 3px;'>" this.title </ span> "</p> <p> "<span style = 'width: 12; border-width: 0px; color: white; font-family: webdings;' οnclick = 'min (this)'> 0 </ span>"</p> <p> <span style = 'width: 12; border-width: 0px; color: white; font-family: webdings;' οnclick = 'CLS (this)'> r </ span> "</p> <p> "</ div>"</p> <p> "<div style = '"</p> <p> "Width: 100%;"</p> <p> "Height:" (this.Height-20-4) ";"</p> <p> "Background-Color: White;"</p> <p> "line-height: 14px;" "Word-break: Break-all;"</p> <p> "Padding: 3px;"</p> <p> "'> this.Message " </ div> "</p> <p> "</ div>"</p> <p> "<div style = '"</p> <p> "Width:" this.width ";"</p> <p> "Height:" THISHEIGHT ";"</p> <p> "Top:" this.top ";"</p> <p> "Left:" this.Left ";"</p> <p> "z-index:" (this.zindex-1) ";"</p> <p> "Position: absolute;"</p> <p> "Background-Color: Black;"</p> <p> "filter: alpha (opacity = 40);"</p> <p> "'> </ div>";</p> <p>// Alert (STR);</p> <p>Document.body.insertadjacenthtml ("BeForend", STR);</p> <p>}</p> <p>// -></p> <p></ script></p> <p><script language = 'jscript'></p> <p><! -</p> <p>Function initialize ()</p> <p>{</p> <p>VAR A = New XWIN ("1", 160, 200, 200, 200, "Message", "XWIN <br> A Cool Pop Div WINDOW <BR> VERSION: 1.0 <br> 2002-8-13");</p> <p>VAR B = New XWIN ("2", 240, 200, 100, 100, "Wildwind's Msgbox", "Welcome to Visited My Personal Website: <br> <a href=http://www14.brinkster.com/wildcity target=_blank> http: / / Wildcity.126.com </a> <br> and u can also sign my guestbook at: <br> <a href=http://www14.brinkster.com/wildcity/gBook target=_blank> http: // wildcity.126.com/gbook </a> <br> <br> thx !!! =) ... ");</p> <p>VAR C = New XWIN ("3", 200, 160, 250, 50, "Copyright", "Copyright by <a href='mailto: flom'> Wildwind </a>);</p> <p>}</p> <p>Window.onload = Initialize;</p> <p>// -></p> <p></ script></p> <p></ hEAD></p> <p><body overselectstart = 'return false' οncοntextMenu = 'Return False'></p> <p></ body></p> <p></ html></p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-74001.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="74001" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.033</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'MVEZhETd806Ro29pM6iZ5qLaUQUTErh6GSVE_2FOp0Bj9Or67mXVWTFz8xamLKVzMYj6IoJYjByqQC1guziODg_2BQ_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>