JQuery backstretch Dynamic Set background image plugin

Source: Internet
Author: User
Tags set background

Example diagram:



The example diagram is the login interface for bootstrap3.0, and the background image behind it is a switchable dynamic background.


Backstretch is a simple jquery plugin that can help you to add a dynamic background image to the page, you can automatically adjust the size to fit the screen size, of course, the disadvantage is that when the image size is smaller than the screen, the image will be distorted because of the automatic extension, So we can use high-resolution large-size images to do the background, and more importantly, to support automatic image switching.

: Https://github.com/srobbin/jquery-backstretch


Set the body's background (without specifying any elements) code as follows:

<script src= "Scripts/jquery-1.8.2.min.js" ></script><script src= "scripts/jquery.backstretch.min.js "></script><script type=" Text/javascript ">        $.backstretch (" bg.jpg ");</script>

Specify the element to implement the background switch, set the switch between the picture and the picture switch interval time duration, the code is as follows:

<script src= "Scripts/jquery-1.8.2.min.js" ></script><script src= "scripts/jquery.backstretch.min.js "></script>$ (function () {            $ (". Container "). CSS ({opacity:. 8});   Set the transparency            $.backstretch ([                  "images/backgrounds/101_1.jpg",                  "Images/backgrounds/44_1.jpg"            ], { duration:3000, fade:750});        </script>














JQuery backstretch Dynamic Set background image plugin

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.