GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — github-markdown-toc/markdown-toc-code/demo3.html at master · fullstack-tutorial/github-markdown-toc Expand file tree/ Copy pathdemo3.htmlMore file actions 107 lines (101 loc) · 3.47 KB / Copy pathdemo3.htmlFile metadata and controls107 lines (101 loc) · 3.47 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html style="height:100%;"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>div width resize</title> <!--引用jquery--> <script src="http://code.jquery.com/jquery-1.8.0.min.js" type="text/javascript"></script> <script type="text/javascript"> function bindResize(el) { //初始化参数 var els = document.getElementById('div_toc').style; //鼠标的 X 和 Y 轴坐标 x = 0; //邪恶的食指 $(el).mousedown(function (e) { //按下元素后,计算当前鼠标与对象计算后的坐标 x = e.clientX - el.offsetWidth - $("#div_toc").width(); //在支持 setCapture 做些东东 el.setCapture ? ( //捕捉焦点 el.setCapture(), //设置事件 el.onmousemove = function (ev) { mouseMove(ev || event); }, el.onmouseup = mouseUp ) : ( //绑定事件 $(document).bind("mousemove", mouseMove).bind("mouseup", mouseUp) ); //防止默认事件发生 e.preventDefault(); }); //移动事件 function mouseMove(e) { //宇宙超级无敌运算中... els.width = e.clientX - x + 'px'; } //停止事件 function mouseUp() { //在支持 releaseCapture 做些东东 el.releaseCapture ? ( //释放焦点 el.releaseCapture(), //移除事件 el.onmousemove = el.onmouseup = null ) : ( //卸载事件 $(document).unbind("mousemove", mouseMove).unbind("mouseup", mouseUp) ); } } // function divResize(){ // var totalHeight = window.screen.height; // console.log(totalHeight); // // document.getElementById("div_toc").height = totalHeight + "px"; // document.getElementById("div_toc").height = "100%"; // document.getElementById("div_right_bar").height = "100%"; // } $(function () { // divResize(); // $(window).resize(divResize); bindResize(document.getElementById('div_right_bar')); }); </script> <style type="text/css"> #toc{ position: fixed; height: 85%; } #div_toc{ float: left; width: 400px; height: 100%; min-height: 200px; z-index: 999; background-color: #fafbfc; border: 1px solid #d1d5da; padding: 20px; overflow-x: hidden; left: 10px; border-radius: 3px; overflow: auto; float: left; } #div_right_bar{ height: 100%; width: 1px; background: #cccccc; cursor: e-resize; float: left; } </style> </head> <body> <div id="toc"> <div id="div_toc">待拖拽</div> <div id="div_right_bar">bar</div> </div> </body> </html> |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |