fancyBox
========
fancyBox is a tool that offers a nice and elegant way to add zooming functionality for images, html content and multi-media on your webpages.
More information and examples: http://www.fancyapps.com/fancybox/
License: http://www.fancyapps.com/fancybox/#license
Copyright (c) 2012 Janis Skarnelis - janis@fancyapps.com
How to use
----------
To get started, download the plugin, unzip it and copy files to your website/application directory.
Load files in the <head> section of your HTML document. Make sure you also add the jQuery library.
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<link rel="stylesheet" href="/fancybox/jquery.fancybox.css" type="text/css" media="screen" />
<script type="text/javascript" src="/fancybox/jquery.fancybox.pack.js"></script>
</head>
Create your links with a `title` if you want a title to be shown, and add a class:
<a href="large_image.jpg" class="fancybox" title="Sample title"><img src="small_image.jpg" /></a>
If you have a set of related items that you would like to group,
additionally include a group name in the `rel` (or `data-fancybox-group`) attribute:
<a href="large_1.jpg" class="fancybox" rel="gallery" title="Sample title 1"><img src="small_1.jpg" /></a>
<a href="large_2.jpg" class="fancybox" rel="gallery" title="Sample title 1"><img src="small_2.jpg" /></a>
Initialise the script like this:
<script>
$(document).ready(function() {
$('.fancybox').fancybox();
});
</script>
May also be passed an optional options object which will extend the default values. Example:
<script>
$(document).ready(function() {
$('.fancybox').fancybox({
padding : 0,
openEffect : 'elastic'
});
});
</script>
Tip: Automatically group and apply fancyBox to all images:
$("a[href$='.jpg'],a[href$='.jpeg'],a[href$='.png'],a[href$='.gif']").attr('rel', 'gallery').fancybox();
Script uses the `href` attribute of the matched elements to obtain the location of the content and to figure out content type you want to display.
You can specify type directly by adding classname (fancybox.image, fancybox.iframe, etc) or `data-fancybox-type` attribute:
//Ajax:
<a href="/example.html" class="fancybox fancybox.ajax">Example</a>
//or
<a href="/example.html" class="fancybox" data-fancybox-type="ajax">Example</a>
//Iframe:
<a href="example.html" class="fancybox fancybox.iframe">Example</a>
//Inline (will display an element with `id="example"`)
<a href="#example" class="fancybox">Example</a>
//SWF:
<a href="example.swf" class="fancybox">Example</a>
//Image:
<a href="example.jpg" class="fancybox">Example</a>
Note, ajax requests are subject to the [same origin policy](http://en.wikipedia.org/wiki/Same_origin_policy).
If fancyBox will not be able to get content type, it will try to guess based on 'href' and will quit silently if would not succeed.
(this is different from previsous versions where 'ajax' was used as default type or an error message was displayed).
Advanced
--------
### Helpers
Helpers provide a simple mechanism to extend the capabilities of fancyBox. There are two built-in helpers - 'overlay' and 'title'.
You can disable them, set custom options or enable other helpers. Examples:
//Disable title helper
$(".fancybox").fancybox({
helpers: {
title: null
}
});
//Disable overlay helper
$(".fancybox").fancybox({
helpers: {
overlay : null
}
});
//Change title position and overlay color
$(".fancybox").fancybox({
helpers: {
title : {
type : 'inside'
},
overlay : {
css : {
'background' : 'rgba(255,255,255,0.5)'
}
}
}
});
//Enable thumbnail helper and set custom options
$(".fancybox").fancybox({
helpers: {
thumbs : {
width: 50,
height: 50
}
}
});
### API
Also available are event driven callback methods. The `this` keyword refers to the current or upcoming object (depends on callback method). Here is how you can change title:
$(".fancybox").fancybox({
beforeLoad : function() {
this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
/*
"this.element" refers to current element, so you can, for example, use the "alt" attribute of the image to store the title:
this.title = $(this.element).find('img').attr('alt');
*/
}
});
It`s possible to open fancyBox programmatically in various ways:
//HTML content:
$.fancybox( '<div><h1>Lorem Lipsum</h1><p>Lorem lipsum</p></div>', {
title : 'Custom Title'
});
//DOM element:
$.fancybox( $("#inline"), {
title : 'Custom Title'
});
//Custom object:
$.fancybox({
href: 'example.jpg',
title : 'Custom Title'
});
//Array of objects:
$.fancybox([
{
href: 'example1.jpg',
title : 'Custom Title 1'
},
{
href: 'example2.jpg',
title : 'Custom Title 2'
}
], {
padding: 0
});
There are several methods that allow you to interact with and manipulate fancyBox, example:
//Close fancybox:
$.fancybox.close();
There is a simply way to access wrapping elements using JS:
$.fancybox.wrap
$.fancybox.skin
$.fancybox.outer
$.fancybox.inner
You can override CSS to customize the look. For example, make navigation arrows always visible,
change width and move them outside of area (use this snippet after including fancybox.css):
.fancybox-nav span {
visibility: visible;
}
.fancybox-nav {
width: 80px;
}
.fancybox-prev {
left: -80px;
}
.fancybox-next {
right: -80px;
}
In that case, you might want to increase space around box:
$(".fancybox").fancybox({
margin : [20, 60, 20, 60]
});
Bug tracker
-----------
Have a bug? Please create an issue on GitHub at https://github.com/fancyapps/fancyBox/issues
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【项目资源】:包含前端、后端、移动开发、操作系统、人工智能、物联网、信息化管理、数据库、硬件开发、大数据、课程资源、音视频、网站开发等各种技术项目的源码。包括STM32、ESP8266、PHP、QT、Linux、iOS、C++、Java、python、web、C#、EDA、proteus、RTOS等项目的源码。【项目质量】:所有源码都经过严格测试,可以直接运行。功能在确认正常工作后才上传。【适用人群】:适用于希望学习不同技术领域的小白或进阶学习者。可作为毕设项目、课程设计、大作业、工程实训或初期项目立项。【附加价值】:项目具有较高的学习借鉴价值,也可直接拿来修改复刻。对于有一定基础或热衷于研究的人来说,可以在这些基础代码上进行修改和扩展,实现其他功能。【沟通交流】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。鼓励下载和使用,并欢迎大家互相学习,共同进步。
资源推荐
资源详情
资源评论
收起资源包目录
基于HTML实现的FLAT商务宽屏响应式css3动画Bootstrap(含HTML源代码+使用说明).zip (241个子文件)
bootstrap.css 117KB
bootstrap.min.css 95KB
font-awesome-ie7.css 40KB
font-awesome-ie7.min.css 37KB
style.css 35KB
font-awesome.css 27KB
settings (In Konflikt stehende Kopie von Flash Horvath 2013-02-13).css 24KB
settings.css 24KB
font-awesome.min.css 22KB
bootstrap-theme.css 16KB
bootstrap-theme.min.css 15KB
preview.css 9KB
jquery.bxslider.css 6KB
bootstrap-reset.css 5KB
jquery.fancybox.css 4KB
flexslider.css 4KB
style-responsive.css 3KB
jquery.fancybox-buttons.css 2KB
rs-style.css 2KB
superfish.css 2KB
jquery.fancybox-thumbs.css 717B
superfish-vertical.css 583B
theme.css 199B
.DS_Store 15KB
.DS_Store 12KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
fontawesome-webfont.eot 37KB
glyphicons-halflings-regular.eot 14KB
bx_loader.gif 8KB
fancybox_loading.gif 4KB
loader2.gif 3KB
loader.gif 2KB
blank.gif 43B
.gitattributes 174B
index.html 35KB
index-static.html 29KB
index.html 29KB
services.html 27KB
blog.html 26KB
button.html 21KB
blog_detail.html 21KB
typography.html 20KB
about.html 19KB
portfolio.html 16KB
index-fullwidth.html 13KB
price.html 10KB
index.html 9KB
contact.html 9KB
iframe.html 2KB
red-bg.jpg 263KB
img4.jpg 150KB
flat_parallax.jpg 141KB
about_1.jpg 140KB
img1.jpg 132KB
img2.jpg 128KB
img3.jpg 124KB
img7.jpg 114KB
about_2.jpg 106KB
img5.jpg 99KB
4_b.jpg 82KB
1_b.jpg 80KB
img6.jpg 75KB
5_b.jpg 74KB
3_b.jpg 54KB
2_b.jpg 50KB
banner_bg.jpg 41KB
img4.jpg 37KB
team_img3.jpg 37KB
team_img2.jpg 34KB
team_img1.jpg 33KB
img2.jpg 20KB
img1.jpg 18KB
img3.jpg 15KB
avatar2.jpg 14KB
product1.jpg 12KB
testimonial-img-1.jpg 10KB
avatar1.jpg 10KB
blog-thumb-1.jpg 9KB
1_s.jpg 8KB
blog-thumb-3.jpg 6KB
4_s.jpg 5KB
divider.jpg 5KB
5_s.jpg 4KB
blog-thumb-2.jpg 4KB
3_s.jpg 2KB
bgtile.jpg 2KB
2_s.jpg 1KB
search-icon.jpg 548B
transparent.jpg 287B
jquery-ui-1.9.2.custom.min.js 232KB
jquery.themepunch.revolution.js 115KB
jquery-1.8.3.min.js 91KB
jquery-1.8.2.min.js 91KB
共 241 条
- 1
- 2
- 3
资源评论
CrMylive.
- 粉丝: 1w+
- 资源: 4万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于CSS与JavaScript的积分系统设计源码
- 生物化学作业_1_生物化学作业资料.pdf
- 基于libgdx引擎的Java开发连连看游戏设计源码
- 基于MobileNetV3的SSD目标检测算法PyTorch实现设计源码
- 基于Java JDK的全面框架设计源码学习项目
- 基于Python黑魔法原理的Python编程技巧设计源码
- 基于Python的EducationCRM管理系统前端设计源码
- 基于Django4.0+Python3.10的在线学习系统Scss设计源码
- 基于activiti6和jeesite4的dreamFlow工作流管理设计源码
- 基于Python实现的简单植物大战僵尸脚本设计源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功