Home Javascript - resizable DIV
Reply: 0

Javascript - resizable DIV

user2068
1#
user2068 Published in June 20, 2018, 7:42 am
  • i try to create movable and resizable div using pure javascript
  • the resizable div have 4 handler in corner to control it e.g :
    • northeast : a div located in y=0, x=0;
    • northwest : a div located in y=0,x = max parent width;
    • southwest : a div located in y=max parent height, x = max parent width
    • southeast : a div located in y=max parent height,x = 0

(note: the handler location is relative to parent, the parent is the resizable div)

i'm getting difficulties with the logic to resizable..

here's what i try

  • when user click the div, i insert it 4 div (use as handler) (this happen at event onmousedown)
  • now the handler will do the job

    • northeast:

      i dont know the logic

    • north west

      i dont know the logic

      my suggest : when user move this handler towards

      • y axis : the parent y position will equal to y position of this handler(but the height is weird)

      • x axis : the parent width will equal to x position of this handler

    • south west:

      when user move this handler towards

      • y axis : the parent height will equal to y position of this handler

      • x axis : the parent width will equal to x position of this handler

    • south east:

      i dont know the logic

      my suggest : when user move this handler,

      • y axis : the parent height will equal to y positon of handler.
      • x axis : the parent x position will equal to x position of handler. (but the width is weird, this is that bug me out)

(Note : the handler position = absolute)

i already goggle but i still can't solve it

what to do?

apologize can't post a code because in actual i have 8 handler. and my code is untidy.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.338498 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO