Colorbox弹出层插件

所属分类:UI-弹出层

 97622  414  查看评论 (13)
分享到微信朋友圈
X
Colorbox弹出层插件 ie兼容6

使用说明

1、引入jquery核心库和ColorBox脚本文件 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> 
<script src="../colorbox/jquery.colorbox.js"></script>


2、引入ColorBox样式表文件,注意引入不同皮肤的css文件将实现不同的皮肤 

<link media="screen" rel="stylesheet" href="colorbox.css" />

3、html代码 

<h2>弹性效果</h2>
<p>
  <a href="../content/ohoopee1.jpg"rel="example1" title="Me and my">GroupedPhoto1</a>
</p>
<p>
  <a href="../content/ohoopee2.jpg"rel="example1" title="On the Ohoopee">Grouped Photo 2</a>
</p>
<p>
  <a href="../content/ohoopee3.jpg"rel="example1" title="On the Ohoopee">Grouped Photo 3</a>
</p>
<h2>淡入淡出效果</h2>
<p>
  <a href="../content/ohoopee1.jpg"rel="example2" title="Me and my">Grouped Photo 1</a>
</p>
<p>
  <a href="../content/ohoopee2.jpg"rel="example2" title="On the">Grouped Photo 2</a>
</p>
<p>
  <a href="../content/ohoopee3.jpg"rel="example2" title="On the Ohoopee">Grouped Photo 3</a>
</p>
<h2>没有动画效果,高度固定(屏幕大小的75%)</h2>
<p>
  <a href="../content/ohoopee1.jpg"rel="example3" title="Me and my">Grouped Photo 1</a>
</p>
<p>
  <a href="../content/ohoopee2.jpg"rel="example3" title="On the">Grouped Photo 2</a>
</p>
<p>
  <a href="../content/ohoopee3.jpg"rel="example3" title="On the Ohoopee">Grouped Photo 3</a>
</p>
<h2>自动播放</h2>
<p>
  <a href="../content/ohoopee1.jpg"rel="example4" title="Me">Grouped Photo 1</a>
</p>
<p>
  <a href="../content/ohoopee2.jpg"rel="example4" title="On the Ohoopee">Grouped Photo 2</a>
</p>
<p>
  <a href="../content/ohoopee3.jpg"rel="example4" title="On">Grouped Photo 3</a>
</p>

4、jquery初始化代码 

$(document).ready(function() {
	//Examples of how to assign the Colorbox event to elements
	$(".group1").colorbox({
		rel: 'group1'
	});
	$(".group2").colorbox({
		rel: 'group2',
		transition: "fade"
	});
	$(".group3").colorbox({
		rel: 'group3',
		transition: "none",
		width: "75%",
		height: "75%"
	});
	$(".group4").colorbox({
		rel: 'group4',
		slideshow: true
	});
	$(".ajax").colorbox();
	$(".youtube").colorbox({
		iframe: true,
		innerWidth: 640,
		innerHeight: 390
	});
	$(".vimeo").colorbox({
		iframe: true,
		innerWidth: 500,
		innerHeight: 409
	});
	$(".iframe").colorbox({
		iframe: true,
		width: "80%",
		height: "80%"
	});
	$(".inline").colorbox({
		inline: true,
		width: "50%"
	});
	$(".callbacks").colorbox({
		onOpen: function() {
			alert('onOpen: colorbox is about to open');
		},
		onLoad: function() {
			alert('onLoad: colorbox has started to load the targeted content');
		},
		onComplete: function() {
			alert('onComplete: colorbox has displayed the loaded content');
		},
		onCleanup: function() {
			alert('onCleanup: colorbox has begun the close process');
		},
		onClosed: function() {
			alert('onClosed: colorbox has completely closed');
		}
	});
	$('.non-retina').colorbox({
		rel: 'group5',
		transition: 'none'
	}) $('.retina').colorbox({
		rel: 'group5',
		transition: 'none',
		retinaImage: true,
		retinaUrl: true
	});
	//Example of preserving a JavaScript event for inline calls.
	$("#click").click(function() {
		$('#click').css({
			"background-color": "#f00",
			"color": "#fff",
			"cursor": "inherit"
		}).text("Open this window again and this message will still be here.");
		return false;
	});
});


相关插件-弹出层

flavr―超级漂亮的jQuery扁平弹出对话框

flavr是一个时尚的扁平弹出对话框为您的下一个网站。flavr是响应设计布局,能够适应任何屏幕大小。得到最好的用户体验,使用流行的animate.css动画,最重要的是,flavr可以运行在任何新的浏览器IE8(+),任何设备和屏幕大小。
  弹出层
 143176  1131

CSS3地图热点文字标注提示

当点击地图上的某一位置时,会弹出提示。
  弹出层
 41141  413

各种弹窗alert

jquery弹窗
  弹出层
 66226  374

漂亮实用的提示框插件SweetAlert

漂亮实用的提示框插件SweetAlert
  弹出层
 63803  714

讨论这个项目(13)回答他人问题或分享插件使用方法奖励jQ币 评论用户自律公约

    ★夕阳の刻痕☆ 0
    2018/4/24 16:42:28
    把colorbox.css放到css文件夹中,里面的背景图片的url会莫名其妙的加上css/,从而导致路径问题,想问下路径需要怎样设置? 回复
    错过了就再也回不来了? 0
    2016/10/28 17:10:25
    静静的 0
    2016/10/20 9:10:35
    想问一下,这个怎弹出两层。
        静静的0
        2016/10/20 9:10:24
        比如点击第一层的按钮弹出第二层,点击第二层的按钮关闭第二层,但是第一层不关闭。
    回复
    Mr.Elegant 0
    2016/8/26 11:08:46
    src为图片流url不行的 回复
    ? 好心情自己造 0
    2016/8/8 16:08:59
    金楼家Kening 0
    2015/9/22 9:09:15

    先下载看看~我只要来弹出优酷视


    回复
    Legend 0
    2014/12/8 18:14:13
    咚咚丶尛破孩 0
    2014/12/2 3:25:26
    为什么我弹出的窗口没有边框呢 回复
    WEB小妞 0
    2014/5/14 9:51:00

    跨域问题网上有很多js跨域的解决方法,添加后就可解决。

    回复
    WEB小妞 0
    2014/5/13 17:28:00

    Grouped Photo 3只能是这样吗?,若href是http:...之类的,会跨域,会报错啊,该怎么办

    回复
😃
  • 😀
  • 😉
  • 😥
  • 😵
  • 😫
  • 😘
  • 😡
  • 👍
  • 🌹
  • 👏
  • 🍺
  • 🍉
  • 🌙
  • 💖
  • 💔
😃
  • 😀
  • 😉
  • 😥
  • 😵
  • 😫
  • 😘
  • 😡
  • 👍
  • 🌹
  • 👏
  • 🍺
  • 🍉
  • 🌙
  • 💖
  • 💔
取消回复