How to change the position of background image using jQuery ?
In this article, we will see how to change the position of the background image using jQuery. To change the position of the background image, we will use css() method with float property.
The css() method is used to change the style property of the selected element. The float property is used to change the normal flow of an element. It defines how an element should float and place an element on its container’s right or left side.
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML course.
Return value: It will return the value of the property for the selected element.
In the below example, we have created an image element and a button. When the user clicks on the button, the jQuery css() method is called and applies float property on the image to change its position.