Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
#43 Callback and Chaining in JQuery Effects
Play lesson

JavaScript Tutorial for Beginners - #43 Callback and Chaining in JQuery Effects

5.0 (3)
31 learners

What you'll learn

This course includes

  • 9.3 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

Callback - A callback function is executed after the current effect is 100% finished. JavaScript statements are executed line by line. However, with effects, the next line of code can be run even though the effect is not finished. This can create errors. To prevent this, you can create a callback function. A callback function is executed after the current effect is finished. Typical syntax: $(selector).hide(speed,callback); Chaining - With jQuery, you can chain together actions/methods. Chaining allows us to run multiple jQuery methods (on the same element) within a single statement. Until now we have been writing jQuery statements one at a time (one after the other). However, there is a technique called chaining, that allows us to run multiple jQuery commands, one after the other, on the same element(s). Tip: This way, browsers do not have to find the same element(s) more than once. To chain an action, you simply append the action to the previous action. Example - $("#p1").css("color", "red").slideUp(2000).slideDown(2000); Some more inbuilt effects - https://www.w3schools.com/jquery/jquery_ref_effects.asp Video by - Tanmay Sakpal Simple Snippets Channel link - https://www.youtube.com/simplesnippets

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere