jQuery dynamic Background image effect implementation method

  • 2020-07-21 06:41:53
  • OfStack

This paper describes the jQuery dynamic background image effect implementation method. Share to everybody for everybody reference. The details are as follows:

Here, place the background images in the directory as 1.jpg-20.jpg, and jQuery will randomly call these images as the background

  randomNumber = Math.round(Math.random()*(bgImageTotal-1))+1;
  $('h1').css('background-image', ('url("'+imgPath+'")'));

Hopefully, this article has been helpful in your jquery programming.

Related articles: