dip vyas

dip vyas

  • NA
  • 227
  • 38.9k

how to automatic generate transform translate in jquery??

May 10 2019 3:50 AM
when i click to automatic change...and take translate perticular width

Answers (2)

0
Sivakumar Koneti

Sivakumar Koneti

  • 560
  • 1.9k
  • 14k
May 13 2019 12:29 AM
https://stackoverflow.com/questions/14012105/how-to-animate-css-translate
0
Bikash Sahu

Bikash Sahu

  • 0
  • 852
  • 81.7k
May 10 2019 11:05 PM
html :
  1. <h2>translation on click by using jQuery</h2>  
  2. <div id="box-two"></div>  
  3. <button id="button-two">AutoMatic Change</button>  
  4. <br/>  
  5. <button id="button-three">reset</button>  
css:
  1. #box-two  
  2. {  
  3. width100px;  
  4. height100px;  
  5. background-colorblue;  
  6. }  
  7. #box-two  
  8. {  
  9. transition: transform 0.6s ease;  
  10. }  
  11. #button-three  
  12. {  
  13. positionrelative;  
  14. left: 200px;  
  15. }  
  16. body  
  17. {  
  18. background-color#E1E7E8;  
  19. }  
jquery:
  1. $(document).ready(function(){  
  2. $('#button-two').click(function(){  
  3. $('#box-two').css("transform","translate(250px,0)");  
  4. });  
  5. $('#button-three').click(function(){  
  6. $('#box-one, #box-two').css("transform","translate(0px,0)");  
  7. });  
  8. });