অ্যানিমেশনে ইজিং ইফেক্ট যোগ করতে অ্যানিমেশন স্পিড সঠিকভাবে সেট করুন যাতে ওয়েব পেজের জন্য পারফেক্ট অ্যানিমেশন হয়। অ্যানিমেশন খুব দ্রুত করবেন না এবং animate() ব্যবহার করার সময় কোথায় রুকতে হবে সেটি জানুন।
আমাদের উদাহরণে একটি বাটন আছে যা টেক্সটএরিয়ায় নিয়ে যায় আন্সার যোগ করতে:
<button class="btn" id="answer"> Add answer </button>
এখন ফেড আউট প্রোপার্টি সঠিকভাবে সেট করে ইজিং ইফেক্ট তৈরি করুন।
উদাহরণ
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $('body').on('click', '#answer', function() { var container = $('.new-answer'); container.css('opacity', '0'); $(this).fadeOut('fast', function() { $(this).hide(); container.show(); container.animate({ height: "200px", opacity: 1}).animate({ height: "170px" }); }); }); }); </script> <style> .btn { width: 150px; height: 40px; color:#666666; text-decoration: none; } .new-answer { background: none repeat scroll 0 0 #00FFFF; border: 2px solid #94ACBE; border-radius: 5px 5px 5px 5px; margin-bottom: 40px; } .new-answer .middle, .top { padding: 0 10px; } .new-answer textarea { color: #000080; font: 12px; height: 120px; padding: 2px; width: 100%; } </style> </head> <body> <button class="btn" id="answer">Add answer</button> <div class="new-answer" hidden="true"> <div class="top"> <span>Add a new answer below</span> </div> <div class="middle"> <textarea id="question-content"></textarea> </div> </div> </body> </html>