Use the jquery FancyBox plugin to implement a picture display effect _jquery

Source: Internet
Author: User
Tags pack

FancyBox is a lightbox tool for displaying images, HTML content, and multimedia.

jquery plug-ins fancybox pop-up box effects, and widely used Lightbox plug-in comparison class, you can show a single picture, you can also display a group of pictures, it can also show the content of the custom and Ajax loaded with the contents of external files, etc., the function is very convenient and practical.

Demo effect (image gallery):

Sample Code:

<link href= "~/content/jquery.fancybox.css" rel= "stylesheet"/>
<p>
   
 
<script src= "~/scripts/jquery-2.1.4.min.js" ></script>
<script src= "~/scripts/" Jquery.fancybox.pack.js "></script>
<script type=" Text/javascript ">
    $ (document). Ready ( function () {
      $ (". Fancybox1"). FancyBox ();
</script>

Demo effect (single images):

Sample Code:

<link href= "~/content/jquery.fancybox.css" rel= "stylesheet"/> <p>  
<script src= "~/scripts/jquery-2.1.4.min.js" ></script>
<script src= "~/scripts/" Jquery.fancybox.pack.js "></script>
<script type=" Text/javascript ">
    $ (document). Ready ( function () {
      $ ("#single_1"). FancyBox ({
        helpers: {
          title: {
            type: ' Float '}}}
      );

      $ ("#single_2"). FancyBox ({
        openeffect: ' Elastic ',
        closeeffect: ' Elastic ',

        helpers: {
          title: {
            Type: ' Inside '}}}
      );

      $ ("#single_3"). FancyBox ({
        openeffect: ' None ',
        closeeffect: ' None ',
        helpers: {
          title: {
            Type: ' Outside '}}}
      );

      $ ("#single_4"). FancyBox ({
        helpers: {
          title: {
            type: ' Over '
  }}}); </script>

Demo effect (thumbnail):

Sample Code:

<link href= "~/content/jquery.fancybox.css" rel= "stylesheet"/> <link href= "~/content/" Jquery.fancybox-thumbs.css "rel=" stylesheet "/> <p>  
<script src= "~/scripts/jquery-2.1.4.min.js" ></script>
<script src= "~/scripts/" Jquery.fancybox.pack.js "></script>
  <script src=" ~/scripts/jquery.fancybox-thumbs.js "></ script>
  <script type= "Text/javascript" >
    $ (document). Ready (function () {
      $ (". Fancybox-thumb") . FancyBox ({
        preveffect: ' Elastic ',
        nexteffect: ' Elastic ',
        helpers: {
          title: {
            type: ' Inside ')
          },
          thumbs: {
            width:50,
            height:50
          }
  }}); </script>

The above is the 3 jquery plug-ins FancyBox image Amplification Display effect of the Web page effects, the application of simple, compatible IE6 old version level browser. Picture magnification only fits the size and automatically centers the window. (Compatibility test: IE6 and above, Firefox, Chrome, Opera, Safari, 360 and other mainstream browsers)

Related Article

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.