Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Full commit this time. Added the argument so a css class can be passe…

…d when using facebox

programmatically. Improved the documentation around programmatic usage and
added a test file for programmatic usage.
  • Loading branch information...
commit b24c1a8d6a2a460886efd6649494d7ae3aa0ac58 1 parent 6a3115a
authored
15  facebox.js
@@ -29,6 +29,7 @@
29 29
  *  You can also use it programmatically:
30 30
  * 
31 31
  *    jQuery.facebox('some html')
  32
+ *    jQuery.facebox('some html', 'my-groovy-style')
32 33
  *
33 34
  *  The above will open a facebox with "some html" as the content.
34 35
  *    
@@ -39,10 +40,14 @@
39 40
  *  The above will show a loading screen before the passed function is called,
40 41
  *  allowing for a better ajaxy experience.
41 42
  *
42  
- *  The facebox function can also display an ajax page or image:
  43
+ *  The facebox function can also display an ajax page, an image, or the contents of a div:
43 44
  *  
44 45
  *    jQuery.facebox({ ajax: 'remote.html' })
45  
- *    jQuery.facebox({ image: 'dude.jpg' })
  46
+ *    jQuery.facebox({ ajax: 'remote.html' }, 'my-groovy-style')
  47
+ *    jQuery.facebox({ image: 'stairs.jpg' })
  48
+ *    jQuery.facebox({ image: 'stairs.jpg' }, 'my-groovy-style')
  49
+ *    jQuery.facebox({ div: '#box' })
  50
+ *    jQuery.facebox({ div: '#box' }, 'my-groovy-style')
46 51
  *
47 52
  *  Want to close the facebox?  Trigger the 'close.facebox' document event:
48 53
  *
@@ -64,9 +69,9 @@
64 69
   $.facebox = function(data, klass) {
65 70
     $.facebox.loading()
66 71
 
67  
-    if (data.ajax) fillFaceboxFromAjax(data.ajax)
68  
-    else if (data.image) fillFaceboxFromImage(data.image)
69  
-    else if (data.div) fillFaceboxFromHref(data.div)
  72
+    if (data.ajax) fillFaceboxFromAjax(data.ajax, klass)
  73
+    else if (data.image) fillFaceboxFromImage(data.image, klass)
  74
+    else if (data.div) fillFaceboxFromHref(data.div, klass)
70 75
     else if ($.isFunction(data)) data.call($)
71 76
     else $.facebox.reveal(data, klass)
72 77
   }
20  index.html
@@ -163,7 +163,25 @@
163 163
 
164 164
           <div class="code">
165 165
             <h3>Arbitrary Text</h3>
166  
-            <code>jQuery.facebox('something cool')</code>
  166
+            <code>
  167
+				jQuery.facebox('something cool');<br/>
  168
+            	jQuery.facebox('something cool', 'my-groovy-style');
  169
+			</code>
  170
+			<h3>Remote files</h3>
  171
+            <code>
  172
+				jQuery.facebox({ ajax: 'remote.html' });<br/>
  173
+				jQuery.facebox({ ajax: 'remote.html' }, 'my-groovy-style');
  174
+			</code>
  175
+			<h3>Image</h3>
  176
+            <code>
  177
+			    jQuery.facebox({ image: 'stairs.jpg' });<br/>
  178
+			    jQuery.facebox({ image: 'stairs.jpg' }, 'my-groovy-style');
  179
+			</code>
  180
+			<h3>A Page Element</h3>
  181
+            <code>
  182
+			    jQuery.facebox({ div: '#box' });<br/>
  183
+			    jQuery.facebox({ div: '#box' }, 'my-groovy-style');
  184
+			</code>
167 185
           </div>
168 186
 
169 187
           <p>
2  test.html
@@ -4,7 +4,7 @@
4 4
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5 5
 <head>
6 6
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7  
-  <title>Facebox 1.0</title>
  7
+  <title>Facebox 1.2</title>
8 8
   <link href="facebox.css" media="screen" rel="stylesheet" type="text/css" />
9 9
   <style>
10 10
 #facebox {

0 notes on commit b24c1a8

Please sign in to comment.
Something went wrong with that request. Please try again.