jquery - How do I change my background image after a certain amount of time -


This is my current HTML code:

I need to make it So that the background image automatically changes on a few pages after a few seconds:

Image 1 = 3 seconds after 3 seconds image 1 image 2 shows for 2 seconds 3 seconds etc ... .

How can this be done? JQuery? Ajax?

Perhaps this could be a solution

  & lt; script type = "text / javascript" & gt; $ (Document) .ready (function () {var arr = ['http://s14.postimg.org/p6ds42qb5/foto22.jpg','http://s17.postimg.org/or0zqcqov/foto33.jpg' ] var count = -1 function change image () {count ++ if (calculation> = arr.length) {count = 0} $ ('# head'). attr ('style', 'background-image: Url ('+ arr [count] +') '}} Set interval (function () {changeImage ()}, 1000)}) & lt; / Script & gt;   

If you need to add other images, then you have to enter their location within the array.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -