Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Commit 5034f92

Browse files
committed
Add info about modules; additional info to faq
1 parent 620eaa8 commit 5034f92

File tree

1 file changed

+108
-3
lines changed

1 file changed

+108
-3
lines changed

docs/index.html

Lines changed: 108 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ <h1><a href="http://fancyapps.com/fancybox/3/">fancyBox3</a> Documentation</h1>
288288
<li><a href="#embedding">Embedding</a></li>
289289
<li><a href="#options">Options</a></li>
290290
<li><a href="#api">Api</a></li>
291+
<li><a href="#modules">Modules</a></li>
291292
<li><a href="#faq">FAQ</a></li>
292293
</ul>
293294
</aside>
@@ -821,7 +822,6 @@ <h2 id="options">Options</h2>
821822

822823

823824

824-
825825
<!--
826826
827827
API
@@ -1055,6 +1055,84 @@ <h3 id="events">Events</h3>
10551055
<pre><code>$(document).on('onComplete.fb', function( e, instance, slide ) {
10561056
// Your code goes here
10571057
});</code></pre>
1058+
1059+
1060+
1061+
<h2 id="modules">Modules</h2>
1062+
1063+
<p>
1064+
fancyBox code is split into several files (modules) that extend core functionality.
1065+
You can build your own fancyBox version by excluding unnecessary modules, if needed.
1066+
Each one has their own <code>js</code> and/or <code>css</code> files.
1067+
</p>
1068+
1069+
<p>
1070+
Some modules can be customized and controlled programmatically.
1071+
List of all possible options:
1072+
</p>
1073+
1074+
<pre><code>slideShow : {
1075+
speed : 3000 // Slideshow speed in ms
1076+
},
1077+
touch : {
1078+
vertical : true // Allow vertical swipe
1079+
},
1080+
thumbs : {
1081+
showOnStart : false, // Display thumbnails on opening
1082+
hideOnClosing : true // Hide thumbnail grid when closing animation starts
1083+
}</code></pre>
1084+
1085+
<p>
1086+
Example (show thumbnails on start):
1087+
</p>
1088+
1089+
<pre><code>$('[data-fancybox="images"]').fancybox({
1090+
thumbs : {
1091+
showOnStart : true
1092+
}
1093+
})</code></pre>
1094+
<p class="demo">
1095+
<a href="https://codepen.io/fancyapps/pen/RKKVVa?editors=1010" target="_blank">View demo on CodePen</a>
1096+
</p>
1097+
1098+
<p>
1099+
If you would inspect fancyBox instance object, you would find keys that names ar captialized - these are references for each module object.
1100+
Also, you would notice that fancyBox uses common naming convention to prefix jQuery objects with <code>$</code>.
1101+
</p>
1102+
1103+
<p>
1104+
This is how you, for example, can access thumbnail grid element:
1105+
</p>
1106+
1107+
<pre><code>$.fancybox.getInstance().Thumbs.$grid</code></pre>
1108+
1109+
<p>
1110+
This example shows how to call method that toggles thumbnails:
1111+
</p>
1112+
1113+
<pre><code>$.fancybox.getInstance().Thumbs.toggle();</code></pre>
1114+
1115+
<p>
1116+
List of available methods:
1117+
</p>
1118+
1119+
<pre><code>Thumbs.focus()
1120+
Thumbs.close();
1121+
Thumbs.update();
1122+
Thumbs.hide();
1123+
Thumbs.show();
1124+
Thumbs.toggle();
1125+
1126+
FullScreen.isAvailable();
1127+
FullScreen.isActivated();
1128+
FullScreen.launch();
1129+
FullScreen.exit();
1130+
FullScreen.toggle();
1131+
1132+
SlideShow.start();
1133+
SlideShow.stop();
1134+
SlideShow.toggle();
1135+
</code></pre>
10581136
<!--
10591137
10601138
FAQ
@@ -1063,7 +1141,7 @@ <h3 id="events">Events</h3>
10631141
-->
10641142
<h2 id="faq">FAQ</h2>
10651143

1066-
<h3>Opening/closing causes fixed header to jump</h3>
1144+
<h3>Opening/closing causes fixed element to jump</h3>
10671145

10681146
<p>
10691147
Simply add <code>compensate-for-scrollbar</code> CSS class to your fixed positioned elements.
@@ -1076,11 +1154,23 @@ <h3>Opening/closing causes fixed header to jump</h3>
10761154
&lt;/div&gt;
10771155
&lt;/nav&gt;</code></pre>
10781156

1157+
<p>
1158+
The script measures width of the scrollbar and creates <code>compensate-for-scrollbar</code> CSS class
1159+
that uses this value for <code>margin-right</code> property.
1160+
Therefore, if your element has <code>width:100%</code>, you should positon it using <code>left</code> and <code>right</code> properties instead. Example:
1161+
</p>
1162+
1163+
<pre><code>.navbar {
1164+
position: fixed;
1165+
top: 0;
1166+
left: 0;
1167+
right: 0;
1168+
}</code></pre>
10791169

10801170
<h3>How to customize caption</h3>
10811171

10821172
<p>
1083-
Example of appending image download link:
1173+
You can use <code>caption</code> option that accepts a function and is called for each group element. Example of appending image download link:
10841174
</p>
10851175

10861176
<pre><code>$( '[data-fancybox]' ).fancybox({
@@ -1099,6 +1189,21 @@ <h3>How to customize caption</h3>
10991189
<a href="http://codepen.io/fancyapps/pen/ygeYGx?editors=1010" target="_blank">View demo on CodePen</a>
11001190
</p>
11011191

1192+
1193+
<p>
1194+
Example of using different source for caption:
1195+
</p>
1196+
1197+
<pre><code>$( '[data-fancybox]' ).fancybox({
1198+
caption : function( instance, item ) {
1199+
return $(this).find('figcaption').html();
1200+
}
1201+
});</code></pre>
1202+
<p class="demo">
1203+
<a href="https://codepen.io/fancyapps/pen/bgEQXo?editors=1010" target="_blank">View demo on CodePen</a>
1204+
</p>
1205+
1206+
11021207
<h3>How to create custom button in the toolbar</h3>
11031208

11041209
<p>

0 commit comments

Comments
 (0)