Created
February 7, 2018 11:13
-
-
Save jigewxy/2d962f057395e919badabf6392915bfa to your computer and use it in GitHub Desktop.
resizeable window using jquery.draggable
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
$(document).ready(function () { | |
setCurrentTabHeaderText(); | |
// $("#ownedTaskSection").resizable(); | |
var prevY = 0, | |
nextY =0, | |
offset = 0; | |
setTimeout(function(){ | |
var ownedTaskHeight = $('#ownedTaskSection').height(); | |
var assignedTaskHeight = $('#assignedTaskSection').height(); | |
var assignedTaskPos = $('#assignedTaskSection').offset(); | |
$('hr.hr-split').draggable({ | |
start: function(){ | |
prevY = $("hr.hr-split").offset().top; | |
console.log("drag started"); | |
}, | |
drag: function(){ | |
$('hr.hr-split').css('background-color', "white"); | |
}, | |
stop: function(){ | |
nextX=$("hr.hr-split").offset().left; | |
nextY = $("hr.hr-split").offset().top; | |
offset = nextY-prevY; | |
ownedTaskHeight +=offset; | |
$('#ownedTaskSection').height(ownedTaskHeight); | |
//reset Hr position after set height; because the the HR position will be affected. | |
$("hr.hr-split").offset({top:nextY, left:nextX}); | |
assignedTaskPos.top+=offset; | |
$('#assignedTaskSection').offset(assignedTaskPos); | |
// $('#assignedTaskSection').height(assignedTaskHeight); | |
console.log("drag ends"); | |
$('hr.hr-split').css('background-color', "transparent"); | |
} | |
}); | |
}, 2000); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment