Home>

Operation effect diagram:

Since it is not implemented in the source file,Need to implement the instructions themselves,The following is the instruction,Pro test can be achieved.

.directive ("draggable", ["$document", function ($document) {
        return function (scope, element, attr) {
        var startx=0, starty=0, x=0, y=0;
        element=angular.element (document.getelementsbyclassname ("modal-dialog"));
        element.css ({
          position:"relative",          cursor:"move"
        });
        element.on ("mousedown", function (event) {
          //prevent default dragging of selected content
          event.preventdefault ();
          startx=event.pagex-x;
          starty=event.pagey-y;
          $document.on ("mousemove", mousemove);
          $document.on ("mouseup", mouseup);
        });
        function mousemove (event) {
          y=event.pagey-starty;
          x=event.pagex-startx;
          element.css ({
          top:y + "px",          left:x + "px"
          });
        }
        function mouseup () {
          $document.off ("mousemove", mousemove);
          $document.off ("mouseup", mouseup);
        }
        };
  }]);
  • Previous C # implements a method of taking a screenshot based on a url in a web page and outputting it to the web page
  • Next Strnatcmp () function "natural sort algorithm" in PHP for string comparison usage analysis (compared to strcmp functio