Created
January 20, 2015 17:05
-
-
Save shershen08/7b8aad951230267b14e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Movable grid line | |
// ------------------ | |
// remove on dblclick, several lines possible | |
jQuery('<div/>').prependTo('body') | |
.css({"position":"absolute","width": 1,"height":jQuery('body').css('height'),"background":"#f00","left":30,"z-index":10000, 'cursor':'pointer'}) | |
.dblclick(function() {jQuery(this).remove();}) | |
.hover(function(){ | |
var lineId = (new Date()).getTime().toString().substr(8); | |
jQuery(this).addClass('grid-line').attr('id', 'grid'+lineId).css({"width": 2}); | |
},function(){ jQuery(this).css({"width": 1}); }) | |
.mousedown(function(e) { | |
var gridLine = jQuery(this); gridLine.css({"cursor": "col-resize"}); | |
jQuery(document).one('mouseup', function(e) {gridLine.css({"cursor": "pointer"}).css({"left": e.clientX});}); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment