Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js resize div with mouse

bottom-right:  new_width = element_original_width + (mouseX - original_mouseX)  new_height = element_original_height + (mouseY - original_mouseY)bottom-left:  new_width = element_original_width - (mouseX - original_mouseX)  new_height = element_original_height + (mouseY - original_mouseY)  new_x = element_original_x - (mouseX - original_mouseX)top-right:  new_width = element_original_width + (mouseX - original_mouseX)  new_height = element_original_height - (mouseY - original_mouseY)  new_y = element_original_y + (mouseY - original_mouseY)top-left:  new_width = element_original_width - (mouseX - original_mouseX)  new_height = element_original_height - (mouseY - original_mouseY)  new_x = element_original_x + (mouseX - original_mouseX)  new_y = element_original_y + (mouseY - original_mouseY)
Source by medium.com #
 
PREVIOUS NEXT
Tagged: #js #resize #div #mouse
ADD COMMENT
Topic
Name
9+5 =