468,509 Members | 1,430 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,509 developers. It's quick & easy.

Change the div position when certain event triggers (Using pure JavaScript)

Amendachase
Change the div position when certain event triggers (Using pure JavaScript) Hi everyone, I hope you are all doing well. I am looking forward to achieving a vibration effect for a div that is relatively positioned, dynamically on click event in pure javascript without any typescript injections, Is there any optimum way to achieve said milestone with pure javascript. I have some solutions which are typescript based, but I want it in pure javascript. The closest solution I have come across is this code.
Expand|Select|Wrap|Line Numbers
  1. $('.button').css('transform', 'translate3d(0px, -8px, 0px)');
  2.  
First, itís in typescript, and secondly, it generates a one-dimensional effect as depicted in this tool, but I want the outcome to be multidimensional and smoother(more natural looking).
2 Weeks Ago #1
1 2154
Banfa
9,056 Expert Mod 8TB
Not really my area of expertise so maybe not the answer you are looking for but you can access any element directly to change it's style directly through the HTML DOM e.g.

Expand|Select|Wrap|Line Numbers
  1. document.getElementById("YourDiv").style.<property> = "new style";
More info at https://www.w3schools.com/js/js_htmldom_css.asp
2 Weeks Ago #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by josh | last post: by
1 post views Thread by Fan Zhang | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.