The characteristics of FancyBox are as follows:
- Support for images, HTML text, Flash animations, iframe, and Ajax
- You can customize the CSS style of the player
- Can be played as a group
- If the mouse scroll plug-in (mouse wheel plugin) included, FancyBox can also support the mouse wheel scroll to flip through the picture
- FancyBox Player supports projection, more stereoscopic feel
How to use:
1. Introduction of jquery Core library and FancyBox plugin library
12 |
<
script
type
=
"text/javascript"
src
=
"http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"
></
script
>
<
script
type
=
"text/javascript"
src
=
"/fancybox/jquery.fancybox-1.3.4.pack.js"
></
script
>
|
Optional-If you need to use fancy transition (some animation effects) You also need to introduce the following script
1 |
< script type = "text/javascript" src = "/fancybox/jquery.easing-1.4.pack.js" ></ script > |
Optional-if you need to support the mouse wheel scrolling effect you also need to introduce the following script
1 |
< script type = "text/javascript" src = "/fancybox/jquery.mousewheel-3.0.4.pack.js" ></ script > |
2. Add Style sheet file
1 |
< link rel = "stylesheet" href = "/fancybox/jquery.fancybox-1.3.4.css" type = "text/css" media = "screen" /> |
Here is an example of a small scale effect:
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<meta http-equiv= "Imagetoolbar" content= "no"/>
<title>fancybox 1.3.1 | Demonstration</title>
<script type= "Text/javascript" src= "Js/jquery-1.4.min.js" ></script> <!--call the jquery core Library----->
<script type= "Text/javascript" src= "js/jquery.mousewheel-3.0.2.pack.js" ></script><!--call the available mouse-controlled libraries-- >
<script type= "Text/javascript" src= "Js/jquery.fancybox-1.3.1.js" ></script>
<script type= "Text/javascript" src= "Js/pngobject.js" ></script> <!--correctly handle PNG Transparency in Win IE 5.5 & 6.-->
<link rel= "stylesheet" href= "Style/style.css" type= "Text/css"/>
<link rel= "stylesheet" href= "Style/jquery.fancybox-1.3.1.css" type= "Text/css"/>
<script type= "Text/javascript" >
$ (document). Ready (function () {
/**
Code to run
*/
$ ("A[rel=example_group]"). FancyBox ({
' Transitionin ': ' fade ',//Set animation effect. can be set to ' elastic ', ' fade ' or ' none '
' Transitionout ': ' fade ',//Ibid.
' Titleposition ': ' over ',//sets the position of the caption display. Can be set to ' outside ', ' inside ' or ' over '
' TitleFormat ': function (title, CurrentArray, Currentindex, currentopts) {//can customize the format of the caption
Return ' <span id= ' fancybox-title-over ' >image ' + (Currentindex + 1) + '/' + Currentarray.length + (title.length? ' ' + title: ') + ' </span> ';
}
});
<!-------------------------------------The following are test code, not within the code implemented in this example------------------------------------>
/*
* Individually set the effect of each picture or file
*/
$ ("A#example1"). FancyBox ({
' Titleshow ': true//Whether the caption is displayed
});
$ ("A#example2"). FancyBox ({
' Titleshow ': true,
' Transitionin ': ' Elastic ',
' Transitionout ': ' Elastic '
});
$ ("A#example3"). FancyBox ({
' Titleshow ': true,
' Transitionin ': ' None ',
' Transitionout ': ' None '
});
$ ("A#example4"). FancyBox ();
$ ("A#example5"). FancyBox ({
' Titleposition ': ' Outside '
});
$ ("A#example6"). FancyBox ({
' Titleposition ': ' Outside '
});
/*
* Set ID number to various effect
*/
$ ("#various1"). FancyBox ({
' Titleposition ': ' over ',//location of title display
' Transitionin ': ' None ',
' Transitionout ': ' None '
});
$ ("#various2"). FancyBox ();
$ ("#various3"). FancyBox ({
' Width ': ' 75% ',
' Height ': ' 75% ',
' Autoscale ': false,
' Transitionin ': ' fade ',
' Transitionout ': ' fade ',
' type ': ' iframe '
});
$ ("#various4"). FancyBox ({
' padding ': 0,
' Autoscale ': false,//if the browser window size can be adaptive for True,fancybox
' Transitionin ': ' None ',
' Transitionout ': ' None '
});
});
</script>
<body>
<div id= "Content" >
<p>
<a rel= "Example_group" href= "example/4_b.jpg" title= "Lorem ipsum dolor sit amet" >
<a rel= "Example_group" href= "example/5_b.jpg" title= "" ></a>
<a rel= "Example_group" href= "example/6_b.jpg" title= "" ></a>
</p>
<p>
<a rel= "Example_group" href= "example/7_b.jpg" title= "Lorem ipsum dolor sit amet" >
<a rel= "Example_group" href= "example/8_b.jpg" title= "" ></a>
<a rel= "Example_group" href= "example/9_b.jpg" title= "" ></a>
</p>
</div>
<div><p> </p></div>
</body>
Another absolutely awesome dialog box plugin FancyBox v1.3.4