clicking button to enlarge its parent in js
Table of Contents
in react.js or next.js, this could be done by:
- onClick function gets object
e
parent = e.currentTarget.parentNode
gets you the parentparent.style.position = absolute
andparent.style.left/right/top/bottom
change size with respect to their distance to closestrelative
context;parent.style.width/height
change absolute size- with
parent.classList.add/remove("class")
and a class with larger size with the above css properties, the parent would be enlarged
note:
Backlinks
javascript
javascript is an evil programming language. but apparently standard of industry, so like a terrible version of C, you has to know how it works.
- mouse drag scroll in js
- css class positioning
- clicking button to enlarge its parent in js
- getting parent of click in js
- change element style in js
- element style transition in css
- add class to element in js
- add and remove children to element in js
- duplicate element in js
- create element in js
- get children in js
- sleep in js
- getting element position in js
- getting element parent offset in js