The .resize() method in jQuery is used to detect changes in the viewport size, allowing for responsive adjustments.
4.
What does the following jQuery code do: $(window).resize(function() { if($(window).width() < 768) { $('.menu').hide(); } else { $('.menu').show(); } });
Handling touch events in responsive web design enhances the user experience on touch devices by providing touch-friendly interactions like swiping and tapping.
6.
Which jQuery event is useful for creating swipe gestures on touch devices?
jQuery can dynamically change the image src attribute based on the viewport size to load different image sizes, optimizing performance for different devices.
8.
Which jQuery method can be used to animate smooth scrolling for anchor links?
jQuery is commonly used in responsive web forms to dynamically validate form fields based on viewport size, ensuring form validation is appropriate for different devices.
10.
How does jQuery help in optimizing images for responsive design?
jQuery helps in optimizing images for responsive design by dynamically loading different images based on viewport size, ensuring faster load times and better performance on various devices.