经典语录:一切就像滑滑梯、一路上放肆张扬的笑了下来、最终重重的摔在下面、头破血流。 一、那些离开你的人,无论当初是出于什么原因离开的,也许他犹豫过挣扎过不舍过,但至少在他决定要走的那一瞬间,他觉得没有你,他会过得更好。 二、煮一壶茶折一枝白梅花 撑一把青伞泠泠雨落下 香桃木开满坟前惹风沙 谁的思念在石碑上发芽梦一场她城下作画 描一幅山水人家 雪纷纷下 葬了千层塔 生死隔断寂寞天涯梦一场她起弦风雅 奏一段白头韶华 雪纷纷下 葬了千层塔 似镜中月华他不知真假长安的誓言啊史书未写下。 三、我们单枪匹马闯入这世间,只为活出属于自己的所有可能。愿你这一生既有随处可栖的江湖,也有追风逐梦的骁勇。 四、 当你的才华还撑不起你的野心时,那你就应该静下心来学习;当你的经济还撑不起你的梦想时,那你就应该踏实的去工作;当你的能力还驾驭不了你的目标时,就应该沉下心来,历练;梦想,不是浮躁,而是沉淀和积累,只有拼出来的美丽,没有等出来的辉煌。 五、走错了记得回头,爱错了记得放手。 六、时间最会骗人,但也能让你明白,这个世界没有什么不能失去的。离去的都是风景,留下的才是人生。留到最后的人,就是对的人。 七、在青山绿水之间,我想牵着你的手,走过这座桥,桥上是绿叶红花,桥下是流水人家,桥的那头是青丝,桥的这头是白发。 八、让时间忘记我,让记忆忘记我,让思念忽略这一切。我汹涌或者平和的情绪,如水如梦。当人即使在梦中,仍不知幸福的所在,那才是最深的悲伤。一路的荒野,我们万水千山。 九、当你夜晚思念万千的时候,我的爱在你枕边与你细语,象哈哈哈催眠曲哄你入睡,甜甜地进入梦乡。爱是一种体会。用心体会到的爱,才是于细微深处见真情的爱,我对你的爱就是这种植入骨髓的爱。 十、好像每次都是这样,没有例外。在我们最需要有一个人去依靠的时候,往往到最后都是自己一个人挺过去。 十一、有些人,看起来好像是原谅你了,但其实,是因为你已经变得不那么重要了。 十二、活着呢,何必想那么多,何必问那么多,毕竟路是需要人走的,话是需要人说的,自己的世界,自己的沉淀,学会看人,学会看事,也要学会看自己,一辈子不容易,何必难为自己的全世界。 十三、愿意陪你的赶都赶不走,那些嘴上说说而已的,你也根本不必留。愿意比什么都重要也比什么都来得长久。 十四、不要着急,最好的总是在我们最不经意的时候出现,我们唯一能做的就是,怀揣希望去努力,静待美好的出现。 十五、世上除了生死,其他都是小事。不管遇到了什么烦心事,都不要自己为难自己;无论今天发生多么糟糕的事,都不要对生活失望,因为,还有明天。

BOX(拖拽盒子)

js画一个矩形,拖拽矩形的4个角可以将矩形缩放,在矩形上按住鼠标拖动可以移动该矩形的位置

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>BOX(拖拽盒子)</title>
    <style>
        .box{
            position:absolute;
            border:2px solid #666;
        }
        .topLeft,.topRight,.bottomLeft,.bottomRight{
            position: absolute;
            width:10px;
            height:10px;
            z-index:100;
            border:2px solid #666;
            background-color: white;
        }
        .topLeft,.topRight{
            top:-5px;
        }
        .bottomLeft,.bottomRight{
            bottom:-5px;
        }
        .topLeft,.bottomLeft{
            left:-5px;
        }
        .topRight,.bottomRight{
            right:-5px;
        }
        .topLeft{
            cursor:nw-resize;
        }
        .topRight{
            cursor:ne-resize;
        }
        .bottomLeft{
            cursor:sw-resize;
        }
        .bottomRight{
            cursor:se-resize;
        }
    </style>
</head>
<body>
<div class="box" id="box" style="width:100px;height:100px;top:100px;left:100px;">
    <div class="topLeft"></div>
    <div class="topRight"></div>
    <div class="bottomLeft"></div>
    <div class="bottomRight"></div>
</div>
<script>
    //获取公用节点
    var box = document.getElementById("box");
    var topLeft = document.getElementsByClassName("topLeft")[0];
    var topRight = document.getElementsByClassName("topRight")[0];
    var bottomLeft = document.getElementsByClassName("bottomLeft")[0];
    var bottomRight = document.getElementsByClassName("bottomRight")[0];
    var position = {x:100,y:100};//位置数据
    var minWidHeg = 25;//拖拽最小宽度
    window.onload = function() {
        //拖拽整个框体
        box.onmousedown = function(ev) {
            var disX=ev.clientX-box.offsetLeft;
            var disY=ev.clientY-box.offsetTop;
            document.onmousemove = function(ev) {
                position.x = ev.clientX-disX;
                position.y = ev.clientY-disY;
                box.style.left = position.x + "px";
                box.style.top = position.y + "px";
            };
            document.onmouseup = function() {
                document.onmousemove = null;
            };
            return false;
        };
        //拖拽左上角
        topLeft.onmousedown = function(ev) {
            position.x = ev.clientX;
            position.y = ev.clientY;
            document.onmousemove = function(ev) {
                var addHeight = position.y - ev.clientY;
                var addLength = position.x - ev.clientX;
                var height = parseInt(box.style.height) + addHeight;
                var length = parseInt(box.style.width) + addLength;
                if(height>minWidHeg){
                    position.y = ev.clientY;
                    box.style.height = height + "px";
                    box.style.top = position.y + "px";
                }
                if(length>minWidHeg){
                    position.x = ev.clientX;
                    box.style.width = length + "px";
                    box.style.left = position.x + "px";
                }
            };
            document.onmouseup = function() {
                document.onmousemove = null;//移开清除
            };
            ev.stopPropagation();//阻止事件冒泡
            return false;
        };
        //拖拽右上角
        topRight.onmousedown = function(ev) {
            position.x = ev.clientX;
            position.y = ev.clientY;
            document.onmousemove = function(ev) {
                var addHeight = position.y - ev.clientY;
                var addLength = position.x - ev.clientX;
                var height = parseInt(box.style.height) + addHeight;
                var length = parseInt(box.style.width) - addLength;
                if(height>minWidHeg){
                    position.y = ev.clientY;
                    box.style.height = height + "px";
                }
                if(length>minWidHeg){
                    position.x = ev.clientX;
                    box.style.top = position.y + "px";
                    box.style.width = length + "px";
                }

            };
            document.onmouseup = function() {
                document.onmousemove = null;
            };
            ev.stopPropagation();
            return false;
        };
        //拖拽左下角
        bottomLeft.onmousedown = function(ev) {
            position.x = ev.clientX;
            position.y = ev.clientY;
            document.onmousemove = function(ev) {
                var addHeight = position.y - ev.clientY;
                var addLength = position.x - ev.clientX;
                var height = parseInt(box.style.height) - addHeight;
                var length = parseInt(box.style.width) + addLength;
                if(height>minWidHeg){
                    position.y = ev.clientY;
                    box.style.height = height + "px";
                }
                if(length>minWidHeg){
                    position.x = ev.clientX;
                    box.style.width = length + "px";
                    box.style.left = position.x + "px";
                }
            };
            document.onmouseup = function() {
                document.onmousemove = null;
            };
            ev.stopPropagation();
            return false;
        };
        //拖拽右下角
        bottomRight.onmousedown = function(ev) {
            position.x = ev.clientX;
            position.y = ev.clientY;
            document.onmousemove = function(ev) {
                var addHeight = position.y - ev.clientY;
                var addLength = position.x - ev.clientX;
                var height = parseInt(box.style.height) - addHeight;
                var length = parseInt(box.style.width) - addLength;
                if(height>minWidHeg){
                    position.y = ev.clientY;
                    box.style.height = height + "px";
                }
                if(length>minWidHeg){
                    position.x = ev.clientX;
                    box.style.width = length + "px";
                }
            };
            document.onmouseup = function() {
                document.onmousemove = null;
            };
            ev.stopPropagation();
            return false;
        };
    };
</script>
</body>
</html>

 

posted @ 2021-04-02 14:19  赵洲web  阅读(353)  评论(0编辑  收藏  举报