Q
What is the purpose of using $(window).resize() in jQuery?

Answer & Solution

Answer: Option A
Solution:
The $(window).resize() method in jQuery detects when the window is resized and executes a specified function, useful for responsive adjustments.
Related Questions on Average

How can jQuery be used to toggle a navigation menu on small screens?

A). By using .hide() and .show() methods

B). By using .toggleClass() method

C). By using .slideToggle() method

D). By using .fadeIn() method

How does a fluid grid layout help in responsive design?

A). Provides a fixed layout

B). Uses relative units like percentages to adapt to different screen sizes

C). Limits the content to a fixed width

D). Hides content on smaller screens

Which CSS unit is commonly used in fluid grid layouts?

A). Pixels

B). Points

C). Percentages

D). Inches

Why is it important to use $(document).ready(function() { ... }); in jQuery?

A). To ensure the DOM is fully loaded before executing scripts

B). To increase script execution speed

C). To prevent scripts from running

D). To hide content until the user interacts with the page

What does the @media (max-width: 768px) CSS rule indicate?

A). Styles will be applied when the device width is exactly 768px

B). Styles will be applied when the device width is less than or equal to 768px

C). Styles will be applied when the device width is greater than 768px

D). Styles will be applied when the device height is 768px or more

Which jQuery method is used to change the source of an image dynamically?

A). .attr()

B). .html()

C). .css()

D). .val()

What is the benefit of using smooth scrolling in responsive design?

A). Enhances user experience by providing smoother transitions

B). Increases website load times

C). Prevents users from scrolling

D). Limits the amount of content visible at one time

How does display: none; help in responsive design?

A). It hides elements from the page completely

B). It makes elements visible only on small screens

C). It resizes elements

D). It changes the background color of elements

What does the $('.menu-toggle').click(function() { $('.menu').slideToggle(); }); code do?

A). Hides the menu permanently

B). Toggles the visibility of the menu with a sliding effect

C). Fixes the menu position

D). Changes the menu color

What does the .on('click', function) method in jQuery do?

A). Attaches a click event handler to selected elements

B). Hides selected elements

C). Changes the background color of selected elements

D). Resizes selected elements