Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge defunkt's branch.

Conflicts:
	facebox.js
  • Loading branch information...
commit 774129a63b5b3f87526a80a7c5f8c3981500b04d 2 parents 570038f + 365b84e
@chuyeow authored
View
4 facebox.css
@@ -65,6 +65,10 @@
text-align: right;
}
+#facebox .footer img {
+ vertical-align: middle;
+}
+
#facebox .tl, #facebox .tr, #facebox .bl, #facebox .br {
height: 10px;
width: 10px;
View
20 facebox.js
@@ -2,7 +2,7 @@
* Created by Chris Wanstrath, with modifications by Cheah Chu Yeow.
*
* Facebox (for jQuery)
- * version: 1.1 (03/13/2008)
+ * version: 1.2 (05/05/2008)
* @requires jQuery v1.2 or later
*
* Examples at http://famspam.com/facebox/
@@ -31,6 +31,7 @@
* You can also use it programmatically:
*
* jQuery.facebox('some html')
+ * jQuery.facebox('some html', 'my-groovy-style')
*
* The above will open a facebox with "some html" as the content.
*
@@ -41,10 +42,14 @@
* The above will show a loading screen before the passed function is called,
* allowing for a better ajaxy experience.
*
- * The facebox function can also display an ajax page or image:
+ * The facebox function can also display an ajax page, an image, or the contents of a div:
*
* jQuery.facebox({ ajax: 'remote.html' })
- * jQuery.facebox({ image: 'dude.jpg' })
+ * jQuery.facebox({ ajax: 'remote.html' }, 'my-groovy-style')
+ * jQuery.facebox({ image: 'stairs.jpg' })
+ * jQuery.facebox({ image: 'stairs.jpg' }, 'my-groovy-style')
+ * jQuery.facebox({ div: '#box' })
+ * jQuery.facebox({ div: '#box' }, 'my-groovy-style')
*
* Want to close the facebox? Trigger the 'close.facebox' document event:
*
@@ -185,7 +190,7 @@
return false;
}
- return this.click(clickHandler);
+ return this.bind('click.facebox', clickHandler);
};
/*
@@ -201,7 +206,7 @@
makeCompatible();
var imageTypes = $.facebox.settings.imageTypes.join('|');
- $.facebox.settings.imageTypesRegexp = new RegExp('\.' + imageTypes + '$', 'i');
+ $.facebox.settings.imageTypesRegexp = new RegExp('\.(' + imageTypes + ')$', 'i');
if (settings) $.extend($.facebox.settings, settings);
$('body').append($.facebox.settings.faceboxHtml);
@@ -268,7 +273,7 @@
if (href.match(/#/)) {
var url = window.location.href.split('#')[0];
var target = href.replace(url,'');
- $.facebox.reveal($(target).clone().show(), klass);
+ $.facebox.reveal($(target).show().replaceWith("<div id='facebox_moved'></div>"), klass);
// image
} else if (href.match($.facebox.settings.imageTypesRegexp)) {
@@ -327,7 +332,8 @@
$(document).bind('close.facebox', function() {
$(document).unbind('keydown.facebox');
$('#facebox').fadeOut(function() {
- $('#facebox .content').removeClass().addClass('content');
+ if ($('#facebox_moved').length == 0) $('#facebox .content').removeClass().addClass('content');
+ else $('#facebox_moved').replaceWith($('#facebox .content').children().hide());
hideOverlay();
$('#facebox .loading').remove();
});
View
20 index.html
@@ -163,7 +163,25 @@
<div class="code">
<h3>Arbitrary Text</h3>
- <code>jQuery.facebox('something cool')</code>
+ <code>
+ jQuery.facebox('something cool');<br/>
+ jQuery.facebox('something cool', 'my-groovy-style');
+ </code>
+ <h3>Remote files</h3>
+ <code>
+ jQuery.facebox({ ajax: 'remote.html' });<br/>
+ jQuery.facebox({ ajax: 'remote.html' }, 'my-groovy-style');
+ </code>
+ <h3>Image</h3>
+ <code>
+ jQuery.facebox({ image: 'stairs.jpg' });<br/>
+ jQuery.facebox({ image: 'stairs.jpg' }, 'my-groovy-style');
+ </code>
+ <h3>A Page Element</h3>
+ <code>
+ jQuery.facebox({ div: '#box' });<br/>
+ jQuery.facebox({ div: '#box' }, 'my-groovy-style');
+ </code>
</div>
<p>
View
2  test.html
@@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
- <title>Facebox 1.0</title>
+ <title>Facebox 1.2</title>
<link href="facebox.css" media="screen" rel="stylesheet" type="text/css" />
<style>
#facebox {
View
54 test_programmatic.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>Facebox 1.2 Programmatic Tests</title>
+ <link href="facebox.css" media="screen" rel="stylesheet" type="text/css" />
+ <link href="faceplant.css" media="screen" rel="stylesheet" type="text/css" />
+ <script src="jquery.js" type="text/javascript"></script>
+ <script src="facebox.js" type="text/javascript"></script>
+ <script type="text/javascript">
+ jQuery(document).ready(function($) {
+ $('a[rel*=facebox]').facebox({
+ loading_image : 'loading.gif',
+ close_image : 'closelabel.gif'
+ })
+ })
+ </script>
+ <style type="text/css">
+ .my-groovy-style {
+ color: yellow;
+ background-color: purple;
+ }
+
+ .my-groovy-style img {
+ width: 100px;
+ height: 100px;
+ }
+ </style>
+</head>
+
+<body>
+ <h1>Programmatic Tests</h1>
+ <a href="javascript: jQuery.facebox('something cool');">Programmatic text.</a><br/>
+ <a href="javascript: jQuery.facebox('something cool', 'my-groovy-style');">Programmatic text with a style.</a><br/>
+
+ <a href="javascript: jQuery.facebox({image:'stairs.jpg'});">Programmatic image.</a><br/>
+ <a href="javascript: jQuery.facebox({image:'stairs.jpg'}, 'my-groovy-style');">Programmatic image with a style.</a><br/>
+
+ <a href="javascript: jQuery.facebox({ajax:'remote.html'});">Programmatic ajax.</a><br/>
+ <a href="javascript: jQuery.facebox({ajax:'remote.html'}, 'my-groovy-style');">Programmatic ajax with a style.</a><br/>
+
+ <a href="javascript: jQuery.facebox({div:'#box'});">Programmatic div.</a><br/>
+ <a href="javascript: jQuery.facebox({div:'#box'}, 'my-groovy-style');">Programmatic div with a style.</a><br/>
+
+ <br/>
+
+ <div id="box" style="border: solid; width: 150px;">
+ Watch me go into a facebox!
+ </div>
+
+</body>
+</html>
Please sign in to comment.
Something went wrong with that request. Please try again.