I have a background image set in HTML, using CSS, the image is a full size background image, covering all of the web page. What I'd like to do is have the image zoom in and out automatically in the backround without any user interaction.
Here's a gif explaining what I'd like to achieve;
Any ideas on how I would do this? I'm imagining it would be some sort of JQuery Plugin, I'm not the greatest at JQuery though so any and all help would be greatly appreciated!
Thanks!
First of all, please don't do this, it's a sure fire way of driving people away from your site!
Having said that, you can achieve what you're looking to do with CSS alone, without any JavaScript, by applying an
animation
to thebackground-size
property of yourbody
tag (or whichever element you're using), like so:You can tweak the animation settings to suit your needs and you may also need to use more vendor prefixes than I've provided, depending on the level of browser support you're aiming for. See caniuse.com for browser compatibility tables.