... | ... |
@@ -26,6 +26,9 @@ ClassLoader::addClasses(array |
26 | 26 |
// Elements |
27 | 27 |
'eSalesMedia\OnePage\ContentPageStart' => 'system/modules/eSM_onePage/elements/ContentPageStart.php', |
28 | 28 |
'eSalesMedia\OnePage\ContentPageStop' => 'system/modules/eSM_onePage/elements/ContentPageStop.php', |
29 |
+ |
|
30 |
+ // Hooks |
|
31 |
+ 'eSalesMedia\OnePage\Hooks\OnePageHooks' => 'system/modules/eSM_onePage/hooks/OnePageHooks.php', |
|
29 | 32 |
)); |
30 | 33 |
|
31 | 34 |
|
... | ... |
@@ -36,5 +39,5 @@ TemplateLoader::addFiles(array |
36 | 39 |
( |
37 | 40 |
'ce_onepage_page_start' => 'system/modules/eSM_onePage/templates/elements', |
38 | 41 |
'ce_onepage_page_stop' => 'system/modules/eSM_onePage/templates/elements', |
39 |
- 'j_onepage_scroll' => 'system/modules/eSM_onePage/templates/jquery', |
|
42 |
+ 'j_onepage_fullpage' => 'system/modules/eSM_onePage/templates/jquery', |
|
40 | 43 |
)); |
... | ... |
@@ -13,9 +13,9 @@ |
13 | 13 |
*/ |
14 | 14 |
|
15 | 15 |
/** |
16 |
- * onepage scroll version |
|
16 |
+ * onepage scroll vendor libraries version |
|
17 | 17 |
*/ |
18 |
-define('JQMOUSEWHEEL', '3.1.12'); |
|
18 |
+define('JQFULLPAGE', '2.6.2'); |
|
19 | 19 |
|
20 | 20 |
$GLOBALS['TL_CTE']['onePage'] = array |
21 | 21 |
( |
... | ... |
@@ -24,4 +24,6 @@ $GLOBALS['TL_CTE']['onePage'] = array |
24 | 24 |
); |
25 | 25 |
|
26 | 26 |
$GLOBALS['TL_WRAPPERS']['start'][] = 'onepageStart'; |
27 |
-$GLOBALS['TL_WRAPPERS']['stop'][] = 'onepageStop'; |
|
28 | 27 |
\ No newline at end of file |
28 |
+$GLOBALS['TL_WRAPPERS']['stop'][] = 'onepageStop'; |
|
29 |
+ |
|
30 |
+$GLOBALS['TL_HOOKS']['getArticle'][] = array('\\OnePage\\Hooks\\OnePageHooks','eSMGetArticle'); |
|
29 | 31 |
\ No newline at end of file |
30 | 32 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,38 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * eSales Media One-Page toolkit for Contao Open Source CMS |
|
5 |
+ * |
|
6 |
+ * Copyright (C) 2015 eSales Media |
|
7 |
+ * |
|
8 |
+ * @package eSM_onePage |
|
9 |
+ * @link http://www.esales-media.de |
|
10 |
+ * @license commercial |
|
11 |
+ * |
|
12 |
+ * @author Benjamin Roth <benjamin@esales-media.de> |
|
13 |
+ */ |
|
14 |
+ |
|
15 |
+namespace eSalesMedia\OnePage\Hooks; |
|
16 |
+ |
|
17 |
+class OnePageHooks extends \Controller |
|
18 |
+{ |
|
19 |
+ |
|
20 |
+ /** |
|
21 |
+ * Hook for adding One-Page wrapper class to article containing one page elements |
|
22 |
+ * @param $objRow |
|
23 |
+ */ |
|
24 |
+ public function eSMGetArticle(\ArticleModel &$objRow) |
|
25 |
+ { |
|
26 |
+ // Get articles content elements |
|
27 |
+ $Elements = \ContentModel::findPublishedByPidAndTable($objRow->id, 'tl_article'); |
|
28 |
+ |
|
29 |
+ // Add wrapper class to article if it contains onepage sections |
|
30 |
+ if (!is_null($Elements) && in_array('onepageStart',$Elements->fetchEach('type'))) |
|
31 |
+ { |
|
32 |
+ $arrCssID = deserialize($objRow->cssID,true); |
|
33 |
+ $arrCssID[1] .= 'onepage-wrapper'; |
|
34 |
+ $objRow->cssID = serialize($arrCssID); |
|
35 |
+ } |
|
36 |
+ |
|
37 |
+ } |
|
38 |
+} |
|
0 | 39 |
\ No newline at end of file |
... | ... |
@@ -1,8 +1,8 @@ |
1 | 1 |
|
2 |
-<div class="<?php echo $this->class; ?> onepage-page<?php if ($this->eSM_op_theme): ?> <?php echo $this->eSM_op_theme; ?><?php endif; ?> block"<?php echo $this->cssID; ?><?php if ($this->style): ?> style="<?php echo $this->style; ?>"<?php endif; ?>> |
|
2 |
+<div class="<?php echo $this->class; ?> onepage-page<?php if ($this->eSM_op_theme): ?> <?php echo $this->eSM_op_theme; ?><?php endif; ?><?php if ($this->eSM_op_valign): ?> onepage-valign-<?php echo $this->eSM_op_valign; ?> block"<?php echo $this->cssID; ?><?php if ($this->style): ?> style="<?php echo $this->style; ?>"<?php endif; ?>> |
|
3 | 3 |
|
4 | 4 |
<?php if ($this->eSM_op_scrollIndicator): ?> |
5 | 5 |
<a class="onepage-scroll-prev"><?php echo $GLOBALS['TL_LANG']['MSC']['goBack']; ?></a> |
6 | 6 |
<?php endif; ?> |
7 | 7 |
|
8 |
- <div class="onepage-page-content<?php if ($this->eSM_op_valign): ?> onepage-valign-<?php echo $this->eSM_op_valign; ?><?php endif; ?>"> |
|
8 |
+ <div class="onepage-page-content<?php endif; ?>"> |
9 | 9 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,26 @@ |
1 |
+<?php |
|
2 |
+// Load CSS |
|
3 |
+$GLOBALS['TL_CSS'][] = 'system/modules/eSM_onePage/vendor/jquery-fullpage/' . JQFULLPAGE . '/assets/css/jquery.fullPage.css'; |
|
4 |
+$GLOBALS['TL_CSS'][] = 'system/modules/eSM_onePage/assets/css/fullpage-exended.css'; |
|
5 |
+?> |
|
6 |
+<script src="system/modules/eSM_onePage/vendor/jquery-fullpage/<?php echo JQFULLPAGE; ?>/assets/js/jquery.fullPage.min.js"></script> |
|
7 |
+<script> |
|
8 |
+(function($) { |
|
9 |
+ $(document).ready(function() { |
|
10 |
+ $('.onepage-wrapper').fullpage({ |
|
11 |
+ sectionSelector: '.onepage-page', |
|
12 |
+ slideSelector: '.onepage-slide', |
|
13 |
+ navigation: true, |
|
14 |
+ navigationPosition: 'right' |
|
15 |
+ }); |
|
16 |
+ |
|
17 |
+ $('.onepage-scroll-next').click(function (e) { |
|
18 |
+ $.fn.fullpage.moveSectionDown(); |
|
19 |
+ }); |
|
20 |
+ |
|
21 |
+ $('.onepage-scroll-prev').click(function (e) { |
|
22 |
+ $.fn.fullpage.moveSectionUp(); |
|
23 |
+ }); |
|
24 |
+ }); |
|
25 |
+})(jQuery); |
|
26 |
+</script> |
0 | 27 |
deleted file mode 100644 |
... | ... |
@@ -1,59 +0,0 @@ |
1 |
-<script src="system/modules/eSM_onePage/vendor/jquery-mousewheel/<?php echo JQMOUSEWHEEL; ?>/assets/js/jquery.mousewheel.min.js"></script> |
|
2 |
-<script> |
|
3 |
-(function($) { |
|
4 |
- $(document).ready(function() { |
|
5 |
- /*$('.onepage-page').on('mousewheel', function(event) { |
|
6 |
- event.preventDefault(); |
|
7 |
- var self = $(this); |
|
8 |
- if (event.deltaY == -1) |
|
9 |
- { |
|
10 |
- if (self.nextAll('.onepage-page').length) |
|
11 |
- { |
|
12 |
- $('html, body').animate({ |
|
13 |
- scrollTop: self.nextAll('.onepage-page').eq(0).offset().top |
|
14 |
- }, 500); |
|
15 |
- } |
|
16 |
- } else if (event.deltaY == 1) |
|
17 |
- { |
|
18 |
- if (self.prevAll('.onepage-page').length) |
|
19 |
- { |
|
20 |
- $('html, body').animate({ |
|
21 |
- scrollTop: self.prevAll('.onepage-page').eq(0).offset().top |
|
22 |
- }, 500); |
|
23 |
- } |
|
24 |
- } |
|
25 |
- });*/ |
|
26 |
- $('.onepage-scroll-next').click(function(e) { |
|
27 |
- e.preventDefault(); |
|
28 |
- |
|
29 |
- var currentPage = $(this).closest('.onepage-page'); |
|
30 |
- if (currentPage.length) |
|
31 |
- { |
|
32 |
- if (currentPage.nextAll('.onepage-page').length) |
|
33 |
- { |
|
34 |
- $('html, body').animate({ |
|
35 |
- scrollTop: currentPage.nextAll('.onepage-page').eq(0).offset().top |
|
36 |
- }, 500); |
|
37 |
- } |
|
38 |
- } |
|
39 |
- return false; |
|
40 |
- }); |
|
41 |
- |
|
42 |
- $('.onepage-scroll-prev').click(function(e) { |
|
43 |
- e.preventDefault(); |
|
44 |
- |
|
45 |
- var currentPage = $(this).closest('.onepage-page'); |
|
46 |
- if (currentPage.length) |
|
47 |
- { |
|
48 |
- if (currentPage.prevAll('.onepage-page').length) |
|
49 |
- { |
|
50 |
- $('html, body').animate({ |
|
51 |
- scrollTop: currentPage.prevAll('.onepage-page').eq(0).offset().top |
|
52 |
- }, 500); |
|
53 |
- } |
|
54 |
- } |
|
55 |
- return false; |
|
56 |
- }) |
|
57 |
- }); |
|
58 |
-})(jQuery); |
|
59 |
-</script> |
60 | 0 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,696 @@ |
1 |
+# fullPage.js |
|
2 |
+ |
|
3 |
+ |
|
4 |
+ |
|
5 |
+ |
|
6 |
+[](http://opensource.org/licenses/MIT) |
|
7 |
+7Kb gziped! |
|
8 |
+ |
|
9 |
+A simple and easy to use plugin to create fullscreen scrolling websites (also known as single page websites). |
|
10 |
+It allows the creation of fullscreen scrolling websites, as well as adding some landscape sliders inside the sections of the site. |
|
11 |
+ |
|
12 |
+- [Live demo](http://alvarotrigo.com/fullPage/) |
|
13 |
+- [Apple demo] (http://alvarotrigo.com/fullPage/examples/apple.html) |
|
14 |
+- [Blog Article](http://alvarotrigo.com/blog/fullpage-jquery-plugin-for-fullscreen-scrolling-websites/) |
|
15 |
+- [Frequently Answered Questions](https://github.com/alvarotrigo/fullPage.js/wiki/FAQ---Frequently-Answered-Questions) |
|
16 |
+ |
|
17 |
+Invite me to a coffee |
|
18 |
+[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=BEK5JQCQMED4J&lc=GB&item_name=fullPage%2ejs¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted) |
|
19 |
+ |
|
20 |
+Customizations of the plugin available upon request for some reasonable price. <a href="http://alvarotrigo.com/#contact-page">Contact me</a>. |
|
21 |
+ |
|
22 |
+Would you like to have a website using fullpage.js functionality but you don't know how to use it? I can do it for you for a reasonable price. <a href="http://alvarotrigo.com/#contact-page">Contact me</a>. |
|
23 |
+ |
|
24 |
+## Introduction |
|
25 |
+Suggestion are more than welcome, not only for feature requests but also for coding style improvements. |
|
26 |
+Let's make this a great plugin to make people's lives easier! |
|
27 |
+ |
|
28 |
+## Compatibility |
|
29 |
+fullPage.js is fully functional on all modern browsers, as well as some old ones such as Internet Explorer 8, 9, Opera 12, etc. |
|
30 |
+It works with browsers with CSS3 support and with the ones which don't have it, making it ideal for old browsers compatibility. |
|
31 |
+It also provides touch support for mobile phones, tablets and touch screen computers. |
|
32 |
+ |
|
33 |
+## Usage |
|
34 |
+As you can see in the example files, you will need to include: |
|
35 |
+ - [jQuery library](http://jquery.com/). (1.6.0 minimum) |
|
36 |
+ - The JavaScript file `jquery.fullPage.js` (or its minified version `jquery.fullPage.min.js`) |
|
37 |
+ - The css file `jquery.fullPage.css` |
|
38 |
+ |
|
39 |
+ **Optionally**, you can add the [jQuery UI library](http://jqueryui.com/) in case you want to use other easing effects apart from the ones included in the jQuery library (`linear`, `swing`) or the one included by default in fullPage.js (`easeInQuart`). |
|
40 |
+ |
|
41 |
+### Install using bower: |
|
42 |
+**Optionally**, you can install fullPage.js with bower if you prefer: |
|
43 |
+Terminal: |
|
44 |
+```shell |
|
45 |
+bower install fullpage.js |
|
46 |
+``` |
|
47 |
+ |
|
48 |
+###Including files: |
|
49 |
+```html |
|
50 |
+<link rel="stylesheet" type="text/css" href="jquery.fullPage.css" /> |
|
51 |
+ |
|
52 |
+<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> |
|
53 |
+ |
|
54 |
+<!-- This following line is needed only in case of using other easing effect rather than "linear", "swing" or "easeInQuart". You can also add the full jQuery UI instead of this file if you prefer --> |
|
55 |
+<script src="vendors/jquery.easings.min.js"></script> |
|
56 |
+ |
|
57 |
+ |
|
58 |
+<!-- This following line needed in the case of using the plugin option `scrollOverflow:true` --> |
|
59 |
+<script type="text/javascript" src="vendors/jquery.slimscroll.min.js"></script> |
|
60 |
+ |
|
61 |
+<script type="text/javascript" src="jquery.fullPage.js"></script> |
|
62 |
+``` |
|
63 |
+ |
|
64 |
+###Optional use of CDN |
|
65 |
+If you prefer to use a CDN to load the needed files, fullPage.js is in CDNJS: |
|
66 |
+https://cdnjs.com/libraries/fullpage.js |
|
67 |
+ |
|
68 |
+###Required HTML structure |
|
69 |
+Each section will be defined with a `div` containing the `section` class. |
|
70 |
+The active section by default will be the first section, which is taken as the home page. |
|
71 |
+```html |
|
72 |
+<div id="fullpage"> |
|
73 |
+ <div class="section">Some section</div> |
|
74 |
+ <div class="section">Some section</div> |
|
75 |
+ <div class="section">Some section</div> |
|
76 |
+ <div class="section">Some section</div> |
|
77 |
+</div> |
|
78 |
+``` |
|
79 |
+If you want to define a different starting point rather than the first section or the first slide of a section, just add the class `active` to the section and slide you want to load first. |
|
80 |
+```html |
|
81 |
+<div class="section active">Some section</div> |
|
82 |
+``` |
|
83 |
+ |
|
84 |
+In order to create a landscape slider within a section, each slide will be defined with another `div`: |
|
85 |
+```html |
|
86 |
+<div class="section"> |
|
87 |
+ <div class="slide"> Slide 1 </div> |
|
88 |
+ <div class="slide"> Slide 2 </div> |
|
89 |
+ <div class="slide"> Slide 3 </div> |
|
90 |
+ <div class="slide"> Slide 4 </div> |
|
91 |
+</div> |
|
92 |
+```` |
|
93 |
+You can see a fully working example of the HTML structure in the [`demoPage.html` file](https://github.com/alvarotrigo/fullPage.js/blob/master/examples/demoPage.html). |
|
94 |
+ |
|
95 |
+ |
|
96 |
+###Initialization |
|
97 |
+All you need to do is call the plugin inside a `$(document).ready` function: |
|
98 |
+ |
|
99 |
+```javascript |
|
100 |
+$(document).ready(function() { |
|
101 |
+ $('#fullpage').fullpage(); |
|
102 |
+}); |
|
103 |
+``` |
|
104 |
+ |
|
105 |
+A more complex initialization with all options set could look like this: |
|
106 |
+```javascript |
|
107 |
+$(document).ready(function() { |
|
108 |
+ $('#fullpage').fullpage({ |
|
109 |
+ //Navigation |
|
110 |
+ menu: false, |
|
111 |
+ anchors:['firstSlide', 'secondSlide'], |
|
112 |
+ navigation: false, |
|
113 |
+ navigationPosition: 'right', |
|
114 |
+ navigationTooltips: ['firstSlide', 'secondSlide'], |
|
115 |
+ showActiveTooltips: false, |
|
116 |
+ slidesNavigation: true, |
|
117 |
+ slidesNavPosition: 'bottom', |
|
118 |
+ |
|
119 |
+ //Scrolling |
|
120 |
+ css3: true, |
|
121 |
+ scrollingSpeed: 700, |
|
122 |
+ autoScrolling: true, |
|
123 |
+ fitToSection: true, |
|
124 |
+ scrollBar: false, |
|
125 |
+ easing: 'easeInOutCubic', |
|
126 |
+ easingcss3: 'ease', |
|
127 |
+ loopBottom: false, |
|
128 |
+ loopTop: false, |
|
129 |
+ loopHorizontal: true, |
|
130 |
+ continuousVertical: false, |
|
131 |
+ normalScrollElements: '#element1, .element2', |
|
132 |
+ scrollOverflow: false, |
|
133 |
+ touchSensitivity: 15, |
|
134 |
+ normalScrollElementTouchThreshold: 5, |
|
135 |
+ |
|
136 |
+ //Accessibility |
|
137 |
+ keyboardScrolling: true, |
|
138 |
+ animateAnchor: true, |
|
139 |
+ recordHistory: true, |
|
140 |
+ |
|
141 |
+ //Design |
|
142 |
+ controlArrows: true, |
|
143 |
+ verticalCentered: true, |
|
144 |
+ resize : false, |
|
145 |
+ sectionsColor : ['#ccc', '#fff'], |
|
146 |
+ paddingTop: '3em', |
|
147 |
+ paddingBottom: '10px', |
|
148 |
+ fixedElements: '#header, .footer', |
|
149 |
+ responsive: 0, |
|
150 |
+ |
|
151 |
+ //Custom selectors |
|
152 |
+ sectionSelector: '.section', |
|
153 |
+ slideSelector: '.slide', |
|
154 |
+ |
|
155 |
+ //events |
|
156 |
+ onLeave: function(index, nextIndex, direction){}, |
|
157 |
+ afterLoad: function(anchorLink, index){}, |
|
158 |
+ afterRender: function(){}, |
|
159 |
+ afterResize: function(){}, |
|
160 |
+ afterSlideLoad: function(anchorLink, index, slideAnchor, slideIndex){}, |
|
161 |
+ onSlideLeave: function(anchorLink, index, slideIndex, direction){} |
|
162 |
+ }); |
|
163 |
+}); |
|
164 |
+``` |
|
165 |
+ |
|
166 |
+### Advance usage |
|
167 |
+In order to create links to certain slides inside a section, you could do it in two ways: |
|
168 |
+ |
|
169 |
+#### Using anchor links |
|
170 |
+If you are using fullPage.js with anchor links for the sections (using the `anchors` option), then you will be able to use anchor links also to navigate directly to a certain slide inside a section. |
|
171 |
+For example: http://alvarotrigo.com/fullPage/#secondPage/2 |
|
172 |
+ |
|
173 |
+You can do it by using the index of the slide (starting by 0), or if you prefer, you can create custom anchor links for them by using the attribute `data-anchor` in each slide. For example: |
|
174 |
+ |
|
175 |
+```html |
|
176 |
+<div class="section"> |
|
177 |
+ <div class="slide" data-anchor="slide1"> Slide 1 </div> |
|
178 |
+ <div class="slide" data-anchor="slide2"> Slide 2 </div> |
|
179 |
+ <div class="slide" data-anchor="slide3"> Slide 3 </div> |
|
180 |
+ <div class="slide" data-anchor="slide4"> Slide 4 </div> |
|
181 |
+</div> |
|
182 |
+``` |
|
183 |
+ |
|
184 |
+**Be careful!** `data-anchor` tags can not have the same value as any ID element on the site (or NAME element for IE). |
|
185 |
+ |
|
186 |
+## Options |
|
187 |
+ |
|
188 |
+- `controlArrows`: (default `true`) Determines whether to use control arrows for the slides to move right or left. |
|
189 |
+ |
|
190 |
+- `verticalCentered`: (default `true`) Vertically centering of the content within sections. When set to `true`, your content will be wrapped by the plugin. Consider using delegation or load your other scripts in the `afterRender` callback. |
|
191 |
+ |
|
192 |
+- `resize`: (default `false`) Whether you want to resize the text when the window is resized. |
|
193 |
+ |
|
194 |
+- `scrollingSpeed`: (default `700`) Speed in milliseconds for the scrolling transitions. |
|
195 |
+ |
|
196 |
+- `sectionsColor`:(default `none`) Define the CSS `background-color` property for each section: |
|
197 |
+Example: |
|
198 |
+```javascript |
|
199 |
+$('#fullpage').fullpage({ |
|
200 |
+ sectionsColor: ['#f2f2f2', '#4BBFC3', '#7BAABE', 'whitesmoke', '#000'], |
|
201 |
+}); |
|
202 |
+``` |
|
203 |
+ |
|
204 |
+- `anchors`: (default `[]`) Defines the anchor links (#example) to be shown on the URL for each section. Using anchors forward and backward navigation will also be possible through the browser. This option also allows users to bookmark a specific section or slide. **Be careful!** if you use anchors, they can not have the same value as any ID element on the site (or NAME element for IE). |
|
205 |
+ |
|
206 |
+**Important** It is helpful to understand that the values in the `anchors` option array correlate directly to the element with the class of `.section` by it's position in the markup. |
|
207 |
+ |
|
208 |
+- `easing`: (default `easeInOutCubic`) Defines the transition effect to use for the vertical and horizontal scrolling. |
|
209 |
+It requires the file `vendors/jquery.easings.min.js` or [jQuery UI](http://jqueryui.com/) for using some of [its transitions](http://api.jqueryui.com/easings/). Other libraries could be used instead. |
|
210 |
+ |
|
211 |
+- `easingcss3`: (default `ease`) Defines the transition effect to use in case of using `css3:true`. You can use the [pre-defined ones](http://www.w3schools.com/cssref/css3_pr_transition-timing-function.asp) (such as `linear`, `ease-out`...) or create your own ones using the `cubic-bezier` function. You might want to use [Matthew Lein CSS Easing Animation Tool](http://matthewlein.com/ceaser/) for it. |
|
212 |
+ |
|
213 |
+- `loopTop`: (default `false`) Defines whether scrolling up in the first section should scroll to the last one or not. |
|
214 |
+ |
|
215 |
+- `loopBottom`: (default `false`) Defines whether scrolling down in the last section should scroll to the first one or not. |
|
216 |
+ |
|
217 |
+- `loopHorizontal`: (default `true`) Defines whether horizontal sliders will loop after reaching the last or previous slide or not. |
|
218 |
+ |
|
219 |
+- `css3`: (default `true`). Defines whether to use JavaScript or CSS3 transforms to scroll within sections and slides. Useful to speed up the movement in tablet and mobile devices with browsers supporting CSS3. If this option is set to `true` and the browser doesn't support CSS3, a jQuery fallback will be used instead. |
|
220 |
+ |
|
221 |
+- `autoScrolling`: (default `true`) Defines whether to use the "automatic" scrolling or the "normal" one. It also has affects the way the sections fit in the browser/device window in tablets and mobile phones. |
|
222 |
+ |
|
223 |
+- `fitToSection`: (default `true`). Determines whether or not to fit sections to the viewport or not. When set to `true` the currente active section will always fill the whole viewport. Otherwise the user will be free to stop in the middle of a section (when ) |
|
224 |
+ |
|
225 |
+- `scrollBar`: (default `false`). Determines whether to use scrol bar for the site or not. In case of using scroll bar, the `autoScrolling` functionality will still working as expected. The user will also be free to scroll the site with the scroll bar and fullPage.js will fit the section in the screen when scrolling finishes. |
|
226 |
+ |
|
227 |
+- `paddingTop`: (default `0`) Defines the top padding for each section with a numerical value and its measure (paddingTop: '10px', paddingTop: '10em'...) Useful in case of using a fixed header. |
|
228 |
+ |
|
229 |
+- `paddingBottom`: (default `0`) Defines the bottom padding for each section with a numerical value and its measure (paddingBottom: '10px', paddingBottom: '10em'...). Useful in case of using a fixed footer. |
|
230 |
+ |
|
231 |
+- `fixedElements`: (default `null`) Defines which elements will be taken off the scrolling structure of the plugin which is necessary when using the `css3` option to keep them fixed. It requires a string with the jQuery selectors for those elements. (For example: `fixedElements: '#element1, .element2'`) |
|
232 |
+ |
|
233 |
+- `normalScrollElements`: (default `null`) If you want to avoid the auto scroll when scrolling over some elements, this is the option you need to use. (useful for maps, scrolling divs etc.) It requires a string with the jQuery selectors for those elements. (For example: `normalScrollElements: '#element1, .element2'`) |
|
234 |
+ |
|
235 |
+- `normalScrollElementTouchThreshold` : (default `5`) Defines the threshold for the number of hops up the html node tree Fullpage will test to see if `normalScrollElements` is a match to allow scrolling functionality on divs on a touch device. (For example: `normalScrollElementTouchThreshold: 3`) |
|
236 |
+ |
|
237 |
+- `keyboardScrolling`: (default `true`) Defines if the content can be navigated using the keyboard |
|
238 |
+ |
|
239 |
+- `touchSensitivity`: (default `5`) Defines a percentage of the browsers window width/height, and how far a swipe must measure for navigating to the next section / slide |
|
240 |
+ |
|
241 |
+- `continuousVertical`: (default `false`) Defines whether scrolling down in the last section should scroll down to the first one or not, and if scrolling up in the first section should scroll up to the last one or not. Not compatible with `loopTop` or `loopBottom`. |
|
242 |
+ |
|
243 |
+- `animateAnchor`: (default `true`) Defines whether the load of the site when given an anchor (#) will scroll with animation to its destination or will directly load on the given section. |
|
244 |
+ |
|
245 |
+- `recordHistory`: (default `true`) Defines whether to push the state of the site to the browser's history. When set to `true` each section/slide of the site will act as a new page and the back and forward buttons of the browser will scroll the sections/slides to reach the previous or next state of the site. When set to `false`, the URL will keep changing but will have no effect ont he browser's history. This option is automatically turned off when using `autoScrolling:false`. |
|
246 |
+ |
|
247 |
+- `menu`: (default `false`) A selector can be used to specify the menu to link with the sections. This way the scrolling of the sections will activate the corresponding element in the menu using the class `active`. |
|
248 |
+This won't generate a menu but will just add the `active` class to the element in the given menu with the corresponding anchor links. |
|
249 |
+In order to link the elements of the menu with the sections, an HTML 5 data-tag (`data-menuanchor`) will be needed to use with the same anchor links as used within the sections. Example: |
|
250 |
+```html |
|
251 |
+<ul id="myMenu"> |
|
252 |
+ <li data-menuanchor="firstPage" class="active"><a href="#firstPage">First section</a></li> |
|
253 |
+ <li data-menuanchor="secondPage"><a href="#secondPage">Second section</a></li> |
|
254 |
+ <li data-menuanchor="thirdPage"><a href="#thirdPage">Third section</a></li> |
|
255 |
+ <li data-menuanchor="fourthPage"><a href="#fourthPage">Fourth section</a></li> |
|
256 |
+</ul> |
|
257 |
+``` |
|
258 |
+```javascript |
|
259 |
+$('#fullpage').fullpage({ |
|
260 |
+ anchors: ['firstPage', 'secondPage', 'thirdPage', 'fourthPage', 'lastPage'], |
|
261 |
+ menu: '#myMenu' |
|
262 |
+}); |
|
263 |
+``` |
|
264 |
+ |
|
265 |
+**Note:** the menu element should be placed outside the fullpage wrapper in order to avoid problem when using `css3:true`. Otherwise it will be appended to the `body` by the plugin itself. |
|
266 |
+ |
|
267 |
+- `navigation`: (default `false`) If set to `true`, it will show a navigation bar made up of small circles. |
|
268 |
+ |
|
269 |
+- `navigationPosition`: (default `none`) It can be set to `left` or `right` and defines which position the navigation bar will be shown (if using one). |
|
270 |
+ |
|
271 |
+- `navigationTooltips`: (default []) Defines the tooltips to show for the navigation circles in case they are being used. Example: `navigationTooltips: ['firstSlide', 'secondSlide']`. |
|
272 |
+ |
|
273 |
+- `showActiveTooltip`: (default `false`) Shows a persistent tooltip for the actively viewed section in the vertical navigation. |
|
274 |
+ |
|
275 |
+- `slidesNavigation`: (default `false`) If set to `true` it will show a navigation bar made up of small circles for each landscape slider on the site. |
|
276 |
+ |
|
277 |
+- `slidesNavPosition`: (default `bottom`) Defines the position for the landscape navigation bar for sliders. Admits `top` and `bottom` as values. You may want to modify the CSS styles to determine the distance from the top or bottom as well as any other style such as color. |
|
278 |
+ |
|
279 |
+- `scrollOverflow`: (default `false`) defines whether or not to create a scroll for the section in case its content is bigger than the height of it. When set to `true`, your content will be wrapped by the plugin. Consider using delegation or load your other scripts in the `afterRender` callback. |
|
280 |
+In case of setting it to `true`, it requires the vendor plugin [`jquery.slimscroll.min`](https://github.com/rochal/jQuery-slimScroll) and it should be loaded before the fullPage.js plugin. For example: |
|
281 |
+ |
|
282 |
+```html |
|
283 |
+<script type="text/javascript" src="vendors/jquery.slimscroll.min.js"></script> |
|
284 |
+<script type="text/javascript" src="jquery.fullPage.js"></script> |
|
285 |
+``` |
|
286 |
+ |
|
287 |
+- `sectionSelector`: (default `.section`) Defines the jQuery selector used for the plugin sections. It might need to be changed sometimes to avoid problem with other plugins using the same selectors as fullpage.js.. |
|
288 |
+ |
|
289 |
+- `slideSelector`: (default `.slide`) Defines the jQuery selector used for the plugin slides. It might need to be changed sometimes to avoid problem with other plugins using the same selectors as fullpage.js. |
|
290 |
+ |
|
291 |
+- `responsive`: (default `0`) A normal scroll (`autoScrolling:false`) will be used under the defined width in pixels. A class `fp-responsive` is added to the plugin's container in case the user wants to use it for his own responsive CSS. For example, if set to 900, whenever the browser's width is less than 900 the plugin will scroll like a normal site. |
|
292 |
+ |
|
293 |
+## Methods |
|
294 |
+ |
|
295 |
+### moveSectionUp() |
|
296 |
+Scrolls one section up: |
|
297 |
+```javascript |
|
298 |
+$.fn.fullpage.moveSectionUp(); |
|
299 |
+``` |
|
300 |
+--- |
|
301 |
+### moveSectionDown() |
|
302 |
+Scrolls one section down: |
|
303 |
+```javascript |
|
304 |
+$.fn.fullpage.moveSectionDown(); |
|
305 |
+``` |
|
306 |
+--- |
|
307 |
+### moveTo(section, slide) |
|
308 |
+Scrolls the page to the given section and slide. The first slide, the visible one by default, will have index 0. |
|
309 |
+```javascript |
|
310 |
+/*Scrolling to the section with the anchor link `firstSlide` and to the 2nd Slide */ |
|
311 |
+$.fn.fullpage.moveTo('firstSlide', 2); |
|
312 |
+ |
|
313 |
+``` |
|
314 |
+ |
|
315 |
+```javascript |
|
316 |
+//Scrolling to the 3rd section in the site |
|
317 |
+$.fn.fullpage.moveTo(3, 0); |
|
318 |
+ |
|
319 |
+//Which is the same as |
|
320 |
+$.fn.fullpage.moveTo(3); |
|
321 |
+``` |
|
322 |
+--- |
|
323 |
+### moveSlideRight() |
|
324 |
+Scrolls the horizontal slider of the current section to the next slide: |
|
325 |
+```javascript |
|
326 |
+$.fn.fullpage.moveSlideRight(); |
|
327 |
+``` |
|
328 |
+--- |
|
329 |
+### moveSlideLeft() |
|
330 |
+Scrolls the horizontal slider of the current section to the previous slide: |
|
331 |
+```javascript |
|
332 |
+$.fn.fullpage.moveSlideLeft(); |
|
333 |
+``` |
|
334 |
+--- |
|
335 |
+### setAutoScrolling(boolean) |
|
336 |
+Sets the scrolling configuration in real time. |
|
337 |
+Defines the way the page scrolling behaves. If it is set to `true`, it will use the "automatic" scrolling, otherwise, it will use the "manual" or "normal" scrolling of the site. Be careful when combining this option with `scrollOverflow` set to true, as it might be difficult to scroll using the mouse wheel or the trackpad when the section is scrollable. |
|
338 |
+ |
|
339 |
+```javascript |
|
340 |
+$.fn.fullpage.setAutoScrolling(false); |
|
341 |
+``` |
|
342 |
+--- |
|
343 |
+### setFitToSection(boolean) |
|
344 |
+Sets the value for the option `fitToSection` determining whether to fit the section in the screen or not. |
|
345 |
+ |
|
346 |
+```javascript |
|
347 |
+$.fn.fullpage.setFitToSection(false); |
|
348 |
+``` |
|
349 |
+--- |
|
350 |
+### setAllowScrolling(boolean, [directions]) |
|
351 |
+Adds or remove the possibility of scrolling through sections by using the mouse wheel/trackpad or touch gestures (which is active by default). |
|
352 |
+ |
|
353 |
+- `directions`: (optional parameter) Admitted values: `all`, `up`, `down`, `left`, `right` or a combination of them separated by commas like `down, right`. It defines the direction for which the scrolling will be enabled or disabled. |
|
354 |
+ |
|
355 |
+```javascript |
|
356 |
+ |
|
357 |
+//disabling scrolling |
|
358 |
+$.fn.fullpage.setAllowScrolling(false); |
|
359 |
+ |
|
360 |
+//disabling scrolling down |
|
361 |
+$.fn.fullpage.setAllowScrolling(false, 'down'); |
|
362 |
+ |
|
363 |
+//disabling scrolling down and right |
|
364 |
+$.fn.fullpage.setAllowScrolling(false, 'down, right'); |
|
365 |
+``` |
|
366 |
+--- |
|
367 |
+### setKeyboardScrolling(boolean) |
|
368 |
+Adds or remove the possibility of scrolling through sections by using the keyboard arrow keys (which is active by default). |
|
369 |
+ |
|
370 |
+```javascript |
|
371 |
+$.fn.fullpage.setKeyboardScrolling(false); |
|
372 |
+``` |
|
373 |
+--- |
|
374 |
+### setRecordHistory(boolean) |
|
375 |
+Defines whether to record the history for each hash change in the URL. |
|
376 |
+ |
|
377 |
+```javascript |
|
378 |
+$.fn.fullpage.setRecordHistory(false); |
|
379 |
+``` |
|
380 |
+--- |
|
381 |
+### setScrollingSpeed(milliseconds) |
|
382 |
+Defines the scrolling speed in milliseconds. |
|
383 |
+ |
|
384 |
+```javascript |
|
385 |
+$.fn.fullpage.setScrollingSpeed(700); |
|
386 |
+``` |
|
387 |
+--- |
|
388 |
+### destroy(type) |
|
389 |
+Destroys the plugin events and optionally its HTML markup and styles. |
|
390 |
+Ideal to use when using AJAX to load content. () |
|
391 |
+ |
|
392 |
+- `type`: can be empty or `all`. If `all` is passed, the HTML markup and styles used by fullpage.js will be removed. This way the original HTML markup, the one used before any plugin modification is made, will be maintained. |
|
393 |
+ |
|
394 |
+```javascript |
|
395 |
+//destroy any plugin event (scrolls, hashchange in the URL...) |
|
396 |
+$.fn.fullpage.destroy(); |
|
397 |
+ |
|
398 |
+//destroy any plugin event and any plugin modification done over your original HTML markup. |
|
399 |
+$.fn.fullpage.destroy('all'); |
|
400 |
+``` |
|
401 |
+--- |
|
402 |
+### reBuild() |
|
403 |
+Updates the DOM structure to fit the new window size or its contents. |
|
404 |
+Ideal to use in combination with AJAX calls or external changes in the DOM structure of the site. |
|
405 |
+ |
|
406 |
+```javascript |
|
407 |
+$.fn.fullpage.reBuild(); |
|
408 |
+``` |
|
409 |
+ |
|
410 |
+ |
|
411 |
+## Callbacks |
|
412 |
+###afterLoad (`anchorLink`, `index`) |
|
413 |
+Callback fired once the sections have been loaded, after the scrolling has ended. |
|
414 |
+Parameters: |
|
415 |
+ |
|
416 |
+- `anchorLink`: anchorLink corresponding to the section. |
|
417 |
+- `index`: index of the section. Starting from 1. |
|
418 |
+ |
|
419 |
+In case of not having anchorLinks defined in the plugin the `index` parameter would be the only one to use. |
|
420 |
+ |
|
421 |
+Example: |
|
422 |
+ |
|
423 |
+```javascript |
|
424 |
+ $('#fullpage').fullpage({ |
|
425 |
+ anchors: ['firstPage', 'secondPage', 'thirdPage', 'fourthPage', 'lastPage'], |
|
426 |
+ |
|
427 |
+ afterLoad: function(anchorLink, index){ |
|
428 |
+ var loadedSection = $(this); |
|
429 |
+ |
|
430 |
+ //using index |
|
431 |
+ if(index == 3){ |
|
432 |
+ alert("Section 3 ended loading"); |
|
433 |
+ } |
|
434 |
+ |
|
435 |
+ //using anchorLink |
|
436 |
+ if(anchorLink == 'secondSlide'){ |
|
437 |
+ alert("Section 2 ended loading"); |
|
438 |
+ } |
|
439 |
+ } |
|
440 |
+ }); |
|
441 |
+``` |
|
442 |
+--- |
|
443 |
+###onLeave (`index`, `nextIndex`, `direction`) |
|
444 |
+This callback is fired once the user leaves a section, in the transition to the new section. |
|
445 |
+ |
|
446 |
+Parameters: |
|
447 |
+ |
|
448 |
+- `index`: index of the leaving section. Starting from 1. |
|
449 |
+- `nextIndex`: index of the destination section. Starting from 1. |
|
450 |
+- `direction`: it will take the values `up` or `down` depending on the scrolling direction. |
|
451 |
+ |
|
452 |
+Example: |
|
453 |
+ |
|
454 |
+```javascript |
|
455 |
+ $('#fullpage').fullpage({ |
|
456 |
+ onLeave: function(index, nextIndex, direction){ |
|
457 |
+ var leavingSection = $(this); |
|
458 |
+ |
|
459 |
+ //after leaving section 2 |
|
460 |
+ if(index == 2 && direction =='down'){ |
|
461 |
+ alert("Going to section 3!"); |
|
462 |
+ } |
|
463 |
+ |
|
464 |
+ else if(index == 2 && direction == 'up'){ |
|
465 |
+ alert("Going to section 1!"); |
|
466 |
+ } |
|
467 |
+ } |
|
468 |
+ }); |
|
469 |
+``` |
|
470 |
+ |
|
471 |
+--- |
|
472 |
+###afterRender() |
|
473 |
+This callback is fired just after the structure of the page is generated. This is the callback you want to use to initialize other plugins or fire any code which requires the document to be ready (as this plugin modifies the DOM to create the resulting structure). |
|
474 |
+ |
|
475 |
+Example: |
|
476 |
+ |
|
477 |
+```javascript |
|
478 |
+ $('#fullpage').fullpage({ |
|
479 |
+ afterRender: function(){ |
|
480 |
+ var pluginContainer = $(this); |
|
481 |
+ alert("The resulting DOM structure is ready"); |
|
482 |
+ } |
|
483 |
+ }); |
|
484 |
+``` |
|
485 |
+--- |
|
486 |
+###afterResize() |
|
487 |
+This callback is fired after resizing the browser's window. Just after the sections are resized. |
|
488 |
+ |
|
489 |
+Example: |
|
490 |
+ |
|
491 |
+```javascript |
|
492 |
+ $('#fullpage').fullpage({ |
|
493 |
+ afterResize: function(){ |
|
494 |
+ var pluginContainer = $(this); |
|
495 |
+ alert("The sections have finished resizing"); |
|
496 |
+ } |
|
497 |
+ }); |
|
498 |
+``` |
|
499 |
+--- |
|
500 |
+###afterSlideLoad (`anchorLink`, `index`, `slideAnchor`, `slideIndex`) |
|
501 |
+Callback fired once the slide of a section have been loaded, after the scrolling has ended. |
|
502 |
+Parameters: |
|
503 |
+ |
|
504 |
+- `anchorLink`: anchorLink corresponding to the section. |
|
505 |
+- `index`: index of the section. Starting from 1. |
|
506 |
+- `slideAnchor`: anchor corresponding to the slide (in case there is) |
|
507 |
+- `slideIndex`: index of the slide. Starting from 1. (the default slide doesn't count as slide, but as a section) |
|
508 |
+ |
|
509 |
+In case of not having anchorLinks defined for the slide or slides the `slideIndex` parameter would be the only one to use. |
|
510 |
+Example: |
|
511 |
+ |
|
512 |
+```javascript |
|
513 |
+ $('#fullpage').fullpage({ |
|
514 |
+ anchors: ['firstPage', 'secondPage', 'thirdPage', 'fourthPage', 'lastPage'], |
|
515 |
+ |
|
516 |
+ afterSlideLoad: function( anchorLink, index, slideAnchor, slideIndex){ |
|
517 |
+ var loadedSlide = $(this); |
|
518 |
+ |
|
519 |
+ //first slide of the second section |
|
520 |
+ if(anchorLink == 'secondPage' && slideIndex == 1){ |
|
521 |
+ alert("First slide loaded"); |
|
522 |
+ } |
|
523 |
+ |
|
524 |
+ //second slide of the second section (supposing #secondSlide is the |
|
525 |
+ //anchor for the second slide |
|
526 |
+ if(index == 2 && slideIndex == 'secondSlide'){ |
|
527 |
+ alert("Second slide loaded"); |
|
528 |
+ } |
|
529 |
+ } |
|
530 |
+ }); |
|
531 |
+``` |
|
532 |
+ |
|
533 |
+ |
|
534 |
+--- |
|
535 |
+###onSlideLeave (`anchorLink`, `index`, `slideIndex`, `direction`) |
|
536 |
+This callback is fired once the user leaves an slide to go to another, in the transition to the new slide. |
|
537 |
+Parameters: |
|
538 |
+ |
|
539 |
+- `anchorLink`: anchorLink corresponding to the section. |
|
540 |
+- `index`: index of the section. Starting from 1. |
|
541 |
+- `slideIndex`: index of the slide. **Starting from 0.** |
|
542 |
+- `direction`: takes the values `right` or `left` depending on the scrolling direction. |
|
543 |
+ |
|
544 |
+ |
|
545 |
+Example: |
|
546 |
+ |
|
547 |
+```javascript |
|
548 |
+ $('#fullpage').fullpage({ |
|
549 |
+ onSlideLeave: function( anchorLink, index, slideIndex, direction){ |
|
550 |
+ var leavingSlide = $(this); |
|
551 |
+ |
|
552 |
+ //leaving the first slide of the 2nd Section to the right |
|
553 |
+ if(index == 2 && slideIndex == 0 && direction == 'right'){ |
|
554 |
+ alert("Leaving the fist slide!!"); |
|
555 |
+ } |
|
556 |
+ |
|
557 |
+ //leaving the 3rd slide of the 2nd Section to the left |
|
558 |
+ if(index == 2 && slideIndex == 2 && direction == 'left'){ |
|
559 |
+ alert("Going to slide 2! "); |
|
560 |
+ } |
|
561 |
+ } |
|
562 |
+ }); |
|
563 |
+``` |
|
564 |
+#Resources |
|
565 |
+- [CSS Easing Animation Tool - Matthew Lein](http://matthewlein.com/ceaser/) (useful to define the `easingcss3` value) |
|
566 |
+- [fullPage.js jsDelivr CDN](http://www.jsdelivr.com/#!jquery.fullpage) |
|
567 |
+- [fullPage.js plugin for October CMS](http://octobercms.com/plugin/freestream-parallax) |
|
568 |
+- [fullPage.js wordpress plugin](https://wordpress.org/plugins/wp-fullpage/) |
|
569 |
+- [Integrating fullPage.js with Wordpress (Tutorial)](http://premium.wpmudev.org/blog/build-apple-inspired-full-page-scrolling-pages-for-your-wordpress-site/) |
|
570 |
+ |
|
571 |
+## Who is using fullPage.js |
|
572 |
+If you want your page to be listed here. Please <a href="mailto:alvaro@alvarotrigo.com">contact me</a> with the URL. |
|
573 |
+ |
|
574 |
+[](http://www.sony-asia.com/microsite/mdr-10/) |
|
575 |
+ |
|
576 |
+[](http://www.britishairways.com/en-gb/information/travel-classes/experience-our-cabins) |
|
577 |
+[](http://www.mi.com/shouhuan) |
|
578 |
+[](http://usescribe.com/) |
|
579 |
+[](http://www.matrimonia.rs/) |
|
580 |
+[](http://www.getredd.com/) |
|
581 |
+[](http://www.sanyang.com.tw/service/Conception/) |
|
582 |
+ |
|
583 |
+- http://www.britishairways.com/en-gb/information/travel-classes/experience-our-cabins |
|
584 |
+- http://www.sony-asia.com/microsite/mdr-10/ |
|
585 |
+- http://www.saltaboombox.com.ar |
|
586 |
+- http://snapzheimer.org/ |
|
587 |
+- http://www.battlefield.com/ |
|
588 |
+- http://www.kibey.com/ |
|
589 |
+- http://www.newjumoconcept.com/ |
|
590 |
+- http://promo.prestigio.com/grace1/ |
|
591 |
+- http://www.mi.com/shouhuan |
|
592 |
+- https://moneytree.jp/ |
|
593 |
+- http://torchbrowser.com/ |
|
594 |
+- http://leafcutter.com.au/ |
|
595 |
+- http://thekorner.fr/ |
|
596 |
+- http://ymcadc.org/AnnualReport/ |
|
597 |
+- http://www.restaurantwoods.nl/ |
|
598 |
+- http://lingualeo.com/ |
|
599 |
+- http://www.getikto.com/ |
|
600 |
+- http://charlotteaimes.com/ |
|
601 |
+- http://collection.madeofsundays.com |
|
602 |
+- http://thiswasmybest.com/ |
|
603 |
+- http://jacoberiksson.se/ |
|
604 |
+- http://coppertino.com/ |
|
605 |
+- https://cloudmagic.com/ |
|
606 |
+- http://www.dividendsolar.com/ |
|
607 |
+- http://www.thespecialists.be |
|
608 |
+- http://brianingle.webflow.com/ |
|
609 |
+- http://lawinenstift.com/ |
|
610 |
+- http://wtfdesign.pl/ |
|
611 |
+- http://www.swenk.me/ |
|
612 |
+- http://educationaboveall.org/ |
|
613 |
+- http://bnacademy.com.au/ |
|
614 |
+- http://rockercreative.com/ |
|
615 |
+- http://wantnova.com/ |
|
616 |
+- http://usescribe.com/ |
|
617 |
+- http://lucilecazanave.com/ |
|
618 |
+- http://overallstudio.co.il/ |
|
619 |
+- http://boxx.hk/ |
|
620 |
+- http://medlive.com |
|
621 |
+- http://bearonunicycle.com/ |
|
622 |
+- http://rawmilk.dk/en/ |
|
623 |
+- http://www.nearpod.com/ |
|
624 |
+- http://www.famavolat.com/ |
|
625 |
+- http://www.carpetloverclub.net/ |
|
626 |
+- http://www.sanyang.com.tw/service/Conception/ |
|
627 |
+- http://www.batzaya.net/ |
|
628 |
+- http://www.graphicid.dk/ |
|
629 |
+- http://hed.citinet.pro/ |
|
630 |
+- http://www.jukstapoz.com/ |
|
631 |
+- http://portfolio.io.utwente.nl/student/dijkavan/ |
|
632 |
+- http://www.omqcomics.com/ |
|
633 |
+- http://www.carlphot.com/ |
|
634 |
+- http://medissix.com/ |
|
635 |
+- http://trasmissione-energia.terna.it/ |
|
636 |
+- http://www.thefoodmovie.com/ |
|
637 |
+- http://www.villareginateodolinda.it |
|
638 |
+- http://www.kesstrio.com |
|
639 |
+- http://willontheway.com/ |
|
640 |
+- http://www.karmaffne.com/ |
|
641 |
+- http://fossdistillery.is |
|
642 |
+- http://www.conversionculture.com/ |
|
643 |
+- http://ded-morozz.kiev.ua/ |
|
644 |
+- http://www.fergalkeenan.com |
|
645 |
+- http://spell-star.appspot.com/ |
|
646 |
+- http://yizeng.me/ |
|
647 |
+- http://neolearning.eu/ |
|
648 |
+- http://unabridgedsoftware.com/ |
|
649 |
+- http://wc2014.plnwrx.com/ |
|
650 |
+- http://organice.io/ |
|
651 |
+- http://alchemy-research.com/ |
|
652 |
+- http://www.cima-ecuador.com/ |
|
653 |
+- http://atlanticcorp.us/ |
|
654 |
+- http://moysport.ru/ |
|
655 |
+- http://www.norttilaakso.fi/ |
|
656 |
+- http://wcfixtures.co.uk/ |
|
657 |
+- http://www.dopehustleinc.com/default.php |
|
658 |
+- http://themify.me/demo/#theme=fullpane |
|
659 |
+- http://bragdonfarm.com/ |
|
660 |
+- http://www.paperdeermusic.com/ |
|
661 |
+- http://dancingroad.com |
|
662 |
+- http://www.camanihome.com/ |
|
663 |
+- http://www.exapoint.ch/ |
|
664 |
+ |
|
665 |
+You can find another list [here](http://libscore.com/#$.fn.fullpage). |
|
666 |
+ |
|
667 |
+## Donations |
|
668 |
+Donations would be more than welcome :) |
|
669 |
+ |
|
670 |
+[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=BEK5JQCQMED4J&lc=GB&item_name=fullPage%2ejs¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted) |
|
671 |
+ |
|
672 |
+ |
|
673 |
+## License |
|
674 |
+ |
|
675 |
+(The MIT License) |
|
676 |
+ |
|
677 |
+Copyright (c) 2013 Alvaro Trigo <alvaro@alvarotrigo.com> |
|
678 |
+ |
|
679 |
+Permission is hereby granted, free of charge, to any person obtaining |
|
680 |
+a copy of this software and associated documentation files (the |
|
681 |
+'Software'), to deal in the Software without restriction, including |
|
682 |
+without limitation the rights to use, copy, modify, merge, publish, |
|
683 |
+distribute, sublicense, and/or sell copies of the Software, and to |
|
684 |
+permit persons to whom the Software is furnished to do so, subject to |
|
685 |
+the following conditions: |
|
686 |
+ |
|
687 |
+The above copyright notice and this permission notice shall be |
|
688 |
+included in all copies or substantial portions of the Software. |
|
689 |
+ |
|
690 |
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
691 |
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|
692 |
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|
693 |
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
|
694 |
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
|
695 |
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
|
696 |
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
1 | 4 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,202 @@ |
1 |
+/** |
|
2 |
+ * fullPage 2.6.0 |
|
3 |
+ * https://github.com/alvarotrigo/fullPage.js |
|
4 |
+ * MIT licensed |
|
5 |
+ * |
|
6 |
+ * Copyright (C) 2013 alvarotrigo.com - A project by Alvaro Trigo |
|
7 |
+ */ |
|
8 |
+html, body { |
|
9 |
+ margin: 0; |
|
10 |
+ padding: 0; |
|
11 |
+ overflow:hidden; |
|
12 |
+ |
|
13 |
+ /*Avoid flicker on slides transitions for mobile phones #336 */ |
|
14 |
+ -webkit-tap-highlight-color: rgba(0,0,0,0); |
|
15 |
+} |
|
16 |
+#superContainer { |
|
17 |
+ height: 100%; |
|
18 |
+ position: relative; |
|
19 |
+ |
|
20 |
+ /* Touch detection for Windows 8 */ |
|
21 |
+ -ms-touch-action: none; |
|
22 |
+ |
|
23 |
+ /* IE 11 on Windows Phone 8.1*/ |
|
24 |
+ touch-action: none; |
|
25 |
+} |
|
26 |
+.fp-section { |
|
27 |
+ position: relative; |
|
28 |
+ -webkit-box-sizing: border-box; /* Safari<=5 Android<=3 */ |
|
29 |
+ -moz-box-sizing: border-box; /* <=28 */ |
|
30 |
+ box-sizing: border-box; |
|
31 |
+} |
|
32 |
+.fp-slide { |
|
33 |
+ float: left; |
|
34 |
+} |
|
35 |
+.fp-slide, .fp-slidesContainer { |
|
36 |
+ height: 100%; |
|
37 |
+ display: block; |
|
38 |
+} |
|
39 |
+.fp-slides { |
|
40 |
+ z-index:1; |
|
41 |
+ height: 100%; |
|
42 |
+ overflow: hidden; |
|
43 |
+ position: relative; |
|
44 |
+ -webkit-transition: all 0.3s ease-out; /* Safari<=6 Android<=4.3 */ |
|
45 |
+ transition: all 0.3s ease-out; |
|
46 |
+} |
|
47 |
+.fp-section.fp-table, .fp-slide.fp-table { |
|
48 |
+ display: table; |
|
49 |
+ table-layout:fixed; |
|
50 |
+ width: 100%; |
|
51 |
+} |
|
52 |
+.fp-tableCell { |
|
53 |
+ display: table-cell; |
|
54 |
+ vertical-align: middle; |
|
55 |
+ width: 100%; |
|
56 |
+ height: 100%; |
|
57 |
+} |
|
58 |
+.fp-slidesContainer { |
|
59 |
+ float: left; |
|
60 |
+ position: relative; |
|
61 |
+} |
|
62 |
+.fp-controlArrow { |
|
63 |
+ position: absolute; |
|
64 |
+ z-index: 4; |
|
65 |
+ top: 50%; |
|
66 |
+ cursor: pointer; |
|
67 |
+ width: 0; |
|
68 |
+ height: 0; |
|
69 |
+ border-style: solid; |
|
70 |
+ margin-top: -38px; |
|
71 |
+ -webkit-transform: translate3d(0,0,0); |
|
72 |
+ -ms-transform: translate3d(0,0,0); |
|
73 |
+ transform: translate3d(0,0,0); |
|
74 |
+} |
|
75 |
+.fp-controlArrow.fp-prev { |
|
76 |
+ left: 15px; |
|
77 |
+ width: 0; |
|
78 |
+ border-width: 38.5px 34px 38.5px 0; |
|
79 |
+ border-color: transparent #fff transparent transparent; |
|
80 |
+} |
|
81 |
+.fp-controlArrow.fp-next { |
|
82 |
+ right: 15px; |
|
83 |
+ border-width: 38.5px 0 38.5px 34px; |
|
84 |
+ border-color: transparent transparent transparent #fff; |
|
85 |
+} |
|
86 |
+.fp-scrollable { |
|
87 |
+ overflow: scroll; |
|
88 |
+} |
|
89 |
+.fp-notransition { |
|
90 |
+ -webkit-transition: none !important; |
|
91 |
+ transition: none !important; |
|
92 |
+} |
|
93 |
+#fp-nav { |
|
94 |
+ position: fixed; |
|
95 |
+ z-index: 100; |
|
96 |
+ margin-top: -32px; |
|
97 |
+ top: 50%; |
|
98 |
+ opacity: 1; |
|
99 |
+ -webkit-transform: translate3d(0,0,0); |
|
100 |
+} |
|
101 |
+#fp-nav.right { |
|
102 |
+ right: 17px; |
|
103 |
+} |
|
104 |
+#fp-nav.left { |
|
105 |
+ left: 17px; |
|
106 |
+} |
|
107 |
+.fp-slidesNav{ |
|
108 |
+ position: absolute; |
|
109 |
+ z-index: 4; |
|
110 |
+ left: 50%; |
|
111 |
+ opacity: 1; |
|
112 |
+} |
|
113 |
+.fp-slidesNav.bottom { |
|
114 |
+ bottom: 17px; |
|
115 |
+} |
|
116 |
+.fp-slidesNav.top { |
|
117 |
+ top: 17px; |
|
118 |
+} |
|
119 |
+#fp-nav ul, |
|
120 |
+.fp-slidesNav ul { |
|
121 |
+ margin: 0; |
|
122 |
+ padding: 0; |
|
123 |
+} |
|
124 |
+#fp-nav ul li, |
|
125 |
+.fp-slidesNav ul li { |
|
126 |
+ display: block; |
|
127 |
+ width: 14px; |
|
128 |
+ height: 13px; |
|
129 |
+ margin: 7px; |
|
130 |
+ position:relative; |
|
131 |
+} |
|
132 |
+.fp-slidesNav ul li { |
|
133 |
+ display: inline-block; |
|
134 |
+} |
|
135 |
+#fp-nav ul li a, |
|
136 |
+.fp-slidesNav ul li a { |
|
137 |
+ display: block; |
|
138 |
+ position: relative; |
|
139 |
+ z-index: 1; |
|
140 |
+ width: 100%; |
|
141 |
+ height: 100%; |
|
142 |
+ cursor: pointer; |
|
143 |
+ text-decoration: none; |
|
144 |
+} |
|
145 |
+#fp-nav ul li a.active span, |
|
146 |
+.fp-slidesNav ul li a.active span, |
|
147 |
+#fp-nav ul li:hover a.active span, |
|
148 |
+.fp-slidesNav ul li:hover a.active span{ |
|
149 |
+ height: 12px; |
|
150 |
+ width: 12px; |
|
151 |
+ margin: -6px 0 0 -6px; |
|
152 |
+ border-radius: 100%; |
|
153 |
+ } |
|
154 |
+#fp-nav ul li a span, |
|
155 |
+.fp-slidesNav ul li a span { |
|
156 |
+ border-radius: 50%; |
|
157 |
+ position: absolute; |
|
158 |
+ z-index: 1; |
|
159 |
+ height: 4px; |
|
160 |
+ width: 4px; |
|
161 |
+ border: 0; |
|
162 |
+ background: #333; |
|
163 |
+ left: 50%; |
|
164 |
+ top: 50%; |
|
165 |
+ margin: -2px 0 0 -2px; |
|
166 |
+ -webkit-transition: all 0.1s ease-in-out; |
|
167 |
+ -moz-transition: all 0.1s ease-in-out; |
|
168 |
+ -o-transition: all 0.1s ease-in-out; |
|
169 |
+ transition: all 0.1s ease-in-out; |
|
170 |
+} |
|
171 |
+#fp-nav ul li:hover a span, |
|
172 |
+.fp-slidesNav ul li:hover a span{ |
|
173 |
+ width: 10px; |
|
174 |
+ height: 10px; |
|
175 |
+ margin: -5px 0px 0px -5px; |
|
176 |
+} |
|
177 |
+#fp-nav ul li .fp-tooltip { |
|
178 |
+ position: absolute; |
|
179 |
+ top: -2px; |
|
180 |
+ color: #fff; |
|
181 |
+ font-size: 14px; |
|
182 |
+ font-family: arial, helvetica, sans-serif; |
|
183 |
+ white-space: nowrap; |
|
184 |
+ max-width: 220px; |
|
185 |
+ overflow: hidden; |
|
186 |
+ display: block; |
|
187 |
+ opacity: 0; |
|
188 |
+ width: 0; |
|
189 |
+} |
|
190 |
+#fp-nav ul li:hover .fp-tooltip, |
|
191 |
+#fp-nav.fp-show-active a.active + .fp-tooltip { |
|
192 |
+ -webkit-transition: opacity 0.2s ease-in; |
|
193 |
+ transition: opacity 0.2s ease-in; |
|
194 |
+ width: auto; |
|
195 |
+ opacity: 1; |
|
196 |
+} |
|
197 |
+#fp-nav ul li .fp-tooltip.right { |
|
198 |
+ right: 20px; |
|
199 |
+} |
|
200 |
+#fp-nav ul li .fp-tooltip.left { |
|
201 |
+ left: 20px; |
|
202 |
+} |
0 | 203 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,228 @@ |
1 |
+/** |
|
2 |
+ * fullPage 2.6.0 |
|
3 |
+ * https://github.com/alvarotrigo/fullPage.js |
|
4 |
+ * MIT licensed |
|
5 |
+ * |
|
6 |
+ * Copyright (C) 2013 alvarotrigo.com - A project by Alvaro Trigo |
|
7 |
+ * Contribution by Jhony0311 |
|
8 |
+ */ |
|
9 |
+html, body { |
|
10 |
+ margin: 0; |
|
11 |
+ padding: 0; |
|
12 |
+ overflow:hidden; |
|
13 |
+ |
|
14 |
+ /*Avoid flicker on slides transitions for mobile phones #336 */ |
|
15 |
+ -webkit-tap-highlight-color: rgba(0,0,0,0); |
|
16 |
+} |
|
17 |
+#superContainer { |
|
18 |
+ height: 100%; |
|
19 |
+ position: relative; |
|
20 |
+ |
|
21 |
+ /* Touch detection for Windows 8 */ |
|
22 |
+ -ms-touch-action: none; |
|
23 |
+ |
|
24 |
+ /* IE 11 on Windows Phone 8.1*/ |
|
25 |
+ touch-action: none; |
|
26 |
+} |
|
27 |
+.fp-section { |
|
28 |
+ position: relative; |
|
29 |
+ -webkit-box-sizing: border-box; /* Safari<=5 Android<=3 */ |
|
30 |
+ -moz-box-sizing: border-box; /* <=28 */ |
|
31 |
+ box-sizing: border-box; |
|
32 |
+} |
|
33 |
+.fp-slide { |
|
34 |
+ float: left; |
|
35 |
+} |
|
36 |
+.fp-slide, .fp-slidesContainer { |
|
37 |
+ height: 100%; |
|
38 |
+ display: block; |
|
39 |
+} |
|
40 |
+.fp-slides { |
|
41 |
+ z-index:1; |
|
42 |
+ height: 100%; |
|
43 |
+ overflow: hidden; |
|
44 |
+ position: relative; |
|
45 |
+ -webkit-transition: all 0.3s ease-out; /* Safari<=6 Android<=4.3 */ |
|
46 |
+ transition: all 0.3s ease-out; |
|
47 |
+} |
|
48 |
+.fp-section.fp-table, .fp-slide.fp-table { |
|
49 |
+ display: table; |
|
50 |
+ table-layout:fixed; |
|
51 |
+ width: 100%; |
|
52 |
+} |
|
53 |
+.fp-tableCell { |
|
54 |
+ display: table-cell; |
|
55 |
+ vertical-align: middle; |
|
56 |
+ width: 100%; |
|
57 |
+ height: 100%; |
|
58 |
+} |
|
59 |
+.fp-slidesContainer { |
|
60 |
+ float: left; |
|
61 |
+ position: relative; |
|
62 |
+} |
|
63 |
+.fp-controlArrow { |
|
64 |
+ position: absolute; |
|
65 |
+ z-index: 4; |
|
66 |
+ top: 50%; |
|
67 |
+ cursor: pointer; |
|
68 |
+ width: 0; |
|
69 |
+ height: 0; |
|
70 |
+ border-style: solid; |
|
71 |
+ margin-top: -38px; |
|
72 |
+ -webkit-transform: translate3d(0,0,0); |
|
73 |
+ -ms-transform: translate3d(0,0,0); |
|
74 |
+ transform: translate3d(0,0,0); |
|
75 |
+ |
|
76 |
+ &.fp-prev { |
|
77 |
+ left: 15px; |
|
78 |
+ width: 0; |
|
79 |
+ border-width: 38.5px 34px 38.5px 0; |
|
80 |
+ border-color: transparent #fff transparent transparent; |
|
81 |
+ } |
|
82 |
+ |
|
83 |
+ &.fp-next { |
|
84 |
+ right: 15px; |
|
85 |
+ border-width: 38.5px 0 38.5px 34px; |
|
86 |
+ border-color: transparent transparent transparent #fff; |
|
87 |
+ } |
|
88 |
+} |
|
89 |
+.fp-scrollable { |
|
90 |
+ overflow: scroll; |
|
91 |
+} |
|
92 |
+.fp-notransition { |
|
93 |
+ -webkit-transition: none !important; |
|
94 |
+ transition: none !important; |
|
95 |
+} |
|
96 |
+.fp-slidesNav{ |
|
97 |
+ position: absolute; |
|
98 |
+ z-index: 4; |
|
99 |
+ left: 50%; |
|
100 |
+ opacity: 1; |
|
101 |
+ |
|
102 |
+ &.bottom { |
|
103 |
+ bottom: 17px; |
|
104 |
+ } |
|
105 |
+ |
|
106 |
+ &.top { |
|
107 |
+ top: 17px; |
|
108 |
+ } |
|
109 |
+} |
|
110 |
+ |
|
111 |
+#fp-nav ul, |
|
112 |
+.fp-slidesNav ul { |
|
113 |
+ margin: 0; |
|
114 |
+ padding: 0; |
|
115 |
+ |
|
116 |
+ li { |
|
117 |
+ |
|
118 |
+ a { |
|
119 |
+ display: block; |
|
120 |
+ position: relative; |
|
121 |
+ z-index: 1; |
|
122 |
+ width: 100%; |
|
123 |
+ height: 100%; |
|
124 |
+ cursor: pointer; |
|
125 |
+ text-decoration: none; |
|
126 |
+ |
|
127 |
+ &.active span { |
|
128 |
+ height: 12px; |
|
129 |
+ width: 12px; |
|
130 |
+ margin: -6px 0 0 -6px; |
|
131 |
+ border-radius: 100%; |
|
132 |
+ |
|
133 |
+ #fp-nav ul li:hover &, |
|
134 |
+ #fp-slidesNav ul li:hover & { |
|
135 |
+ height: 12px; |
|
136 |
+ width: 12px; |
|
137 |
+ margin: -6px 0 0 -6px; |
|
138 |
+ border-radius: 100%; |
|
139 |
+ } |
|
140 |
+ } |
|
141 |
+ |
|
142 |
+ span { |
|
143 |
+ border-radius: 50%; |
|
144 |
+ position: absolute; |
|
145 |
+ z-index: 1; |
|
146 |
+ height: 4px; |
|
147 |
+ width: 4px; |
|
148 |
+ border: 0; |
|
149 |
+ background: #333; |
|
150 |
+ left: 50%; |
|
151 |
+ top: 50%; |
|
152 |
+ margin: -2px 0 0 -2px; |
|
153 |
+ -webkit-transition: all 0.1s ease-in-out; |
|
154 |
+ -moz-transition: all 0.1s ease-in-out; |
|
155 |
+ -o-transition: all 0.1s ease-in-out; |
|
156 |
+ transition: all 0.1s ease-in-out; |
|
157 |
+ } |
|
158 |
+ } |
|
159 |
+ |
|
160 |
+ &:hover { |
|
161 |
+ |
|
162 |
+ a { |
|
163 |
+ span { |
|
164 |
+ width: 10px; |
|
165 |
+ height: 10px; |
|
166 |
+ margin: -5px 0px 0px -5px; |
|
167 |
+ } |
|
168 |
+ } |
|
169 |
+ } |
|
170 |
+ |
|
171 |
+ } |
|
172 |
+} |
|
173 |
+#fp-nav { |
|
174 |
+ position: fixed; |
|
175 |
+ z-index: 100; |
|
176 |
+ margin-top: -32px; |
|
177 |
+ top: 50%; |
|
178 |
+ opacity: 1; |
|
179 |
+ -webkit-transform: translate3d(0,0,0); |
|
180 |
+ &.right { |
|
181 |
+ right: 17px; |
|
182 |
+ } |
|
183 |
+ &.left { |
|
184 |
+ left: 17px |
|
185 |
+ } |
|
186 |
+ ul { |
|
187 |
+ li { |
|
188 |
+ .fp-tooltip { |
|
189 |
+ position: absolute; |
|
190 |
+ top: -2px; |
|
191 |
+ color: #fff; |
|
192 |
+ font-size: 14px; |
|
193 |
+ font-family: arial, helvetica, sans-serif; |
|
194 |
+ white-space: nowrap; |
|
195 |
+ max-width: 220px; |
|
196 |
+ overflow: hidden; |
|
197 |
+ display: block; |
|
198 |
+ opacity: 0; |
|
199 |
+ width: 0; |
|
200 |
+ |
|
201 |
+ &.right { |
|
202 |
+ right: 20px; |
|
203 |
+ } |
|
204 |
+ |
|
205 |
+ &.left { |
|
206 |
+ |
|
207 |
+ } |
|
208 |
+ } |
|
209 |
+ &:hover { |
|
210 |
+ .fp-tooltip { |
|
211 |
+ -webkit-transition: opacity 0.2s ease-in; |
|
212 |
+ transition: opacity 0.2s ease-in; |
|
213 |
+ width: auto; |
|
214 |
+ opacity: 1; |
|
215 |
+ } |
|
216 |
+ } |
|
217 |
+ } |
|
218 |
+ } |
|
219 |
+ &.fp-show-active a.active + .fp-tooltip { |
|
220 |
+ -webkit-transition: opacity 0.2s ease-in; |
|
221 |
+ transition: opacity 0.2s ease-in; |
|
222 |
+ width: auto; |
|
223 |
+ opacity: 1; |
|
224 |
+ } |
|
225 |
+} |
|
226 |
+.fp-slidesNav ul li { |
|
227 |
+ display: inline-block; |
|
228 |
+} |
|
0 | 229 |
\ No newline at end of file |
1 | 230 |
new file mode 100755 |
... | ... |
@@ -0,0 +1,2168 @@ |
1 |
+/** |
|
2 |
+ * fullPage 2.6.2 |
|
3 |
+ * https://github.com/alvarotrigo/fullPage.js |
|
4 |
+ * MIT licensed |
|
5 |
+ * |
|
6 |
+ * Copyright (C) 2015 alvarotrigo.com - A project by Alvaro Trigo |
|
7 |
+ */ |
|
8 |
+(function($, window, document, Math, undefined) { |
|
9 |
+ 'use strict'; |
|
10 |
+ |
|
11 |
+ // keeping central set of classnames and selectors |
|
12 |
+ var WRAPPER = 'fullpage-wrapper'; |
|
13 |
+ var WRAPPER_SEL = '.' + WRAPPER; |
|
14 |
+ |
|
15 |
+ // slimscroll |
|
16 |
+ var SCROLLABLE = 'fp-scrollable'; |
|
17 |
+ var SCROLLABLE_SEL = '.' + SCROLLABLE; |
|
18 |
+ var SLIMSCROLL_BAR_SEL = '.slimScrollBar'; |
|
19 |
+ var SLIMSCROLL_RAIL_SEL = '.slimScrollRail'; |
|
20 |
+ |
|
21 |
+ // util |
|
22 |
+ var RESPONSIVE = 'fp-responsive'; |
|
23 |
+ var NO_TRANSITION = 'fp-notransition'; |
|
24 |
+ var DESTROYED = 'fp-destroyed'; |
|
25 |
+ var VIEWING_PREFIX = 'fp-viewing'; |
|
26 |
+ var ACTIVE = 'active'; |
|
27 |
+ var ACTIVE_SEL = '.' + ACTIVE; |
|
28 |
+ |
|
29 |
+ // section |
|
30 |
+ var SECTION_DEFAULT_SEL = '.section'; |
|
31 |
+ var SECTION = 'fp-section'; |
|
32 |
+ var SECTION_SEL = '.' + SECTION; |
|
33 |
+ var SECTION_ACTIVE_SEL = SECTION_SEL + ACTIVE_SEL; |
|
34 |
+ var SECTION_FIRST_SEL = SECTION_SEL + ':first'; |
|
35 |
+ var SECTION_LAST_SEL = SECTION_SEL + ':last'; |
|
36 |
+ var TABLE_CELL = 'fp-tableCell'; |
|
37 |
+ var TABLE_CELL_SEL = '.' + TABLE_CELL; |
|
38 |
+ |
|
39 |
+ // section nav |
|
40 |
+ var SECTION_NAV = 'fp-nav'; |
|
41 |
+ var SECTION_NAV_SEL = '#' + SECTION_NAV; |
|
42 |
+ var SECTION_NAV_TOOLTIP = 'fp-tooltip'; |
|
43 |
+ var SHOW_ACTIVE_TOOLTIP = 'fp-show-active'; |
|
44 |
+ |
|
45 |
+ // slide |
|
46 |
+ var SLIDE_DEFAULT_SEL = '.slide'; |
|
47 |
+ var SLIDE = 'fp-slide'; |
|
48 |
+ var SLIDE_SEL = '.' + SLIDE; |
|
49 |
+ var SLIDE_ACTIVE_SEL = SLIDE_SEL + ACTIVE_SEL; |
|
50 |
+ var SLIDES_WRAPPER = 'fp-slides'; |
|
51 |
+ var SLIDES_WRAPPER_SEL = '.' + SLIDES_WRAPPER; |
|
52 |
+ var SLIDES_CONTAINER = 'fp-slidesContainer'; |
|
53 |
+ var SLIDES_CONTAINER_SEL = '.' + SLIDES_CONTAINER; |
|
54 |
+ var TABLE = 'fp-table'; |
|
55 |
+ |
|
56 |
+ // slide nav |
|
57 |
+ var SLIDES_NAV = 'fp-slidesNav'; |
|
58 |
+ var SLIDES_NAV_SEL = '.' + SLIDES_NAV; |
|
59 |
+ var SLIDES_NAV_LINK_SEL = SLIDES_NAV_SEL + ' a'; |
|
60 |
+ var SLIDES_ARROW = 'fp-controlArrow'; |
|
61 |
+ var SLIDES_ARROW_SEL = '.' + SLIDES_ARROW; |
|
62 |
+ var SLIDES_PREV = 'fp-prev'; |
|
63 |
+ var SLIDES_PREV_SEL = '.' + SLIDES_PREV; |
|
64 |
+ var SLIDES_ARROW_PREV = SLIDES_ARROW + ' ' + SLIDES_PREV; |
|
65 |
+ var SLIDES_ARROW_PREV_SEL = SLIDES_ARROW_SEL + SLIDES_PREV_SEL; |
|
66 |
+ var SLIDES_NEXT = 'fp-next'; |
|
67 |
+ var SLIDES_NEXT_SEL = '.' + SLIDES_NEXT; |
|
68 |
+ var SLIDES_ARROW_NEXT = SLIDES_ARROW + ' ' + SLIDES_NEXT; |
|
69 |
+ var SLIDES_ARROW_NEXT_SEL = SLIDES_ARROW_SEL + SLIDES_NEXT_SEL; |
|
70 |
+ |
|
71 |
+ var $window = $(window); |
|
72 |
+ var $document = $(document); |
|
73 |
+ |
|
74 |
+ $.fn.fullpage = function(options) { |
|
75 |
+ |
|
76 |
+ // common jQuery objects |
|
77 |
+ var $htmlBody = $('html, body'); |
|
78 |
+ var $body = $('body'); |
|
79 |
+ |
|
80 |
+ var FP = $.fn.fullpage; |
|
81 |
+ // Create some defaults, extending them with any options that were provided |
|
82 |
+ options = $.extend({ |
|
83 |
+ //navigation |
|
84 |
+ menu: false, |
|
85 |
+ anchors:[], |
|
86 |
+ navigation: false, |
|
87 |
+ navigationPosition: 'right', |
|
88 |
+ navigationTooltips: [], |
|
89 |
+ showActiveTooltip: false, |
|
90 |
+ slidesNavigation: false, |
|
91 |
+ slidesNavPosition: 'bottom', |
|
92 |
+ scrollBar: false, |
|
93 |
+ |
|
94 |
+ //scrolling |
|
95 |
+ css3: true, |
|
96 |
+ scrollingSpeed: 700, |
|
97 |
+ autoScrolling: true, |
|
98 |
+ fitToSection: true, |
|
99 |
+ easing: 'easeInOutCubic', |
|
100 |
+ easingcss3: 'ease', |
|
101 |
+ loopBottom: false, |
|
102 |
+ loopTop: false, |
|
103 |
+ loopHorizontal: true, |
|
104 |
+ continuousVertical: false, |
|
105 |
+ normalScrollElements: null, |
|
106 |
+ scrollOverflow: false, |
|
107 |
+ touchSensitivity: 5, |
|
108 |
+ normalScrollElementTouchThreshold: 5, |
|
109 |
+ |
|
110 |
+ //Accessibility |
|
111 |
+ keyboardScrolling: true, |
|
112 |
+ animateAnchor: true, |
|
113 |
+ recordHistory: true, |
|
114 |
+ |
|
115 |
+ //design |
|
116 |
+ controlArrows: true, |
|
117 |
+ controlArrowColor: '#fff', |
|
118 |
+ verticalCentered: true, |
|
119 |
+ resize: false, |
|
120 |
+ sectionsColor : [], |
|
121 |
+ paddingTop: 0, |
|
122 |
+ paddingBottom: 0, |
|
123 |
+ fixedElements: null, |
|
124 |
+ responsive: 0, |
|
125 |
+ |
|
126 |
+ //Custom selectors |
|
127 |
+ sectionSelector: SECTION_DEFAULT_SEL, |
|
128 |
+ slideSelector: SLIDE_DEFAULT_SEL, |
|
129 |
+ |
|
130 |
+ |
|
131 |
+ //events |
|
132 |
+ afterLoad: null, |
|
133 |
+ onLeave: null, |
|
134 |
+ afterRender: null, |
|
135 |
+ afterResize: null, |
|
136 |
+ afterReBuild: null, |
|
137 |
+ afterSlideLoad: null, |
|
138 |
+ onSlideLeave: null |
|
139 |
+ }, options); |
|
140 |
+ |
|
141 |
+ displayWarnings(); |
|
142 |
+ |
|
143 |
+ |
|
144 |
+ //easeInOutCubic animation included in the plugin |
|
145 |
+ $.extend($.easing,{ easeInOutCubic: function (x, t, b, c, d) {if ((t/=d/2) < 1) return c/2*t*t*t + b;return c/2*((t-=2)*t*t + 2) + b;}}); |
|
146 |
+ |
|
147 |
+ //TO BE REMOVED in future versions. Maintained temporaly for backwards compatibility. |
|
148 |
+ $.extend($.easing,{ easeInQuart: function (x, t, b, c, d) { return c*(t/=d)*t*t*t + b; }}); |
|
149 |
+ |
|
150 |
+ FP.setAutoScrolling = function(value, type){ |
|
151 |
+ setVariableState('autoScrolling', value, type); |
|
152 |
+ |
|
153 |
+ var element = $(SECTION_ACTIVE_SEL); |
|
154 |
+ |
|
155 |
+ if(options.autoScrolling && !options.scrollBar){ |
|
156 |
+ $htmlBody.css({ |
|
157 |
+ 'overflow' : 'hidden', |
|
158 |
+ 'height' : '100%' |
|
159 |
+ }); |
|
160 |
+ |
|
161 |
+ FP.setRecordHistory(options.recordHistory, 'internal'); |
|
162 |
+ |
|
163 |
+ //for IE touch devices |
|
164 |
+ container.css({ |
|
165 |
+ '-ms-touch-action': 'none', |
|
166 |
+ 'touch-action': 'none' |
|
167 |
+ }); |
|
168 |
+ |
|
169 |
+ if(element.length){ |
|
170 |
+ //moving the container up |
|
171 |
+ silentScroll(element.position().top); |
|
172 |
+ } |
|
173 |
+ |
|
174 |
+ }else{ |
|
175 |
+ $htmlBody.css({ |
|
176 |
+ 'overflow' : 'visible', |
|
177 |
+ 'height' : 'initial' |
|
178 |
+ }); |
|
179 |
+ |
|
180 |
+ FP.setRecordHistory(false, 'internal'); |
|
181 |
+ |
|
182 |
+ //for IE touch devices |
|
183 |
+ container.css({ |
|
184 |
+ '-ms-touch-action': '', |
|
185 |
+ 'touch-action': '' |
|
186 |
+ }); |
|
187 |
+ |
|
188 |
+ silentScroll(0); |
|
189 |
+ |
|
190 |
+ //scrolling the page to the section with no animation |
|
191 |
+ if (element.length) { |
|
192 |
+ $htmlBody.scrollTop(element.position().top); |
|
193 |
+ } |
|
194 |
+ } |
|
195 |
+ |
|
196 |
+ }; |
|
197 |
+ |
|
198 |
+ /** |
|
199 |
+ * Defines wheter to record the history for each hash change in the URL. |
|
200 |
+ */ |
|
201 |
+ FP.setRecordHistory = function(value, type){ |
|
202 |
+ setVariableState('recordHistory', value, type); |
|
203 |
+ }; |
|
204 |
+ |
|
205 |
+ /** |
|
206 |
+ * Defines the scrolling speed |
|
207 |
+ */ |
|
208 |
+ FP.setScrollingSpeed = function(value, type){ |
|
209 |
+ setVariableState('scrollingSpeed', value, type); |
|
210 |
+ }; |
|
211 |
+ |
|
212 |
+ /** |
|
213 |
+ * Sets fitToSection |
|
214 |
+ */ |
|
215 |
+ FP.setFitToSection = function(value, type){ |
|
216 |
+ setVariableState('fitToSection', value, type); |
|
217 |
+ }; |
|
218 |
+ |
|
219 |
+ /** |
|
220 |
+ * Adds or remove the possiblity of scrolling through sections by using the mouse wheel or the trackpad. |
|
221 |
+ */ |
|
222 |
+ FP.setMouseWheelScrolling = function (value){ |
|
223 |
+ if(value){ |
|
224 |
+ addMouseWheelHandler(); |
|
225 |
+ }else{ |
|
226 |
+ removeMouseWheelHandler(); |
|
227 |
+ } |
|
228 |
+ }; |
|
229 |
+ |
|
230 |
+ /** |
|
231 |
+ * Adds or remove the possiblity of scrolling through sections by using the mouse wheel/trackpad or touch gestures. |
|
232 |
+ * Optionally a second parameter can be used to specify the direction for which the action will be applied. |
|
233 |
+ * |
|
234 |
+ * @param directions string containing the direction or directions separated by comma. |
|
235 |
+ */ |
|
236 |
+ FP.setAllowScrolling = function (value, directions){ |
|
237 |
+ if(typeof directions != 'undefined'){ |
|
238 |
+ directions = directions.replace(' ', '').split(','); |
|
239 |
+ $.each(directions, function (index, direction){ |
|
240 |
+ setIsScrollable(value, direction); |
|
241 |
+ }); |
|
242 |
+ } |
|
243 |
+ else if(value){ |
|
244 |
+ FP.setMouseWheelScrolling(true); |
|
245 |
+ addTouchHandler(); |
|
246 |
+ }else{ |
|
247 |
+ FP.setMouseWheelScrolling(false); |
|
248 |
+ removeTouchHandler(); |
|
249 |
+ } |
|
250 |
+ }; |
|
251 |
+ |
|
252 |
+ /** |
|
253 |
+ * Adds or remove the possiblity of scrolling through sections by using the keyboard arrow keys |
|
254 |
+ */ |
|
255 |
+ FP.setKeyboardScrolling = function (value){ |
|
256 |
+ options.keyboardScrolling = value; |
|
257 |
+ }; |
|
258 |
+ |
|
259 |
+ FP.moveSectionUp = function(){ |
|
260 |
+ var prev = $(SECTION_ACTIVE_SEL).prev(SECTION_SEL); |
|
261 |
+ |
|
262 |
+ //looping to the bottom if there's no more sections above |
|
263 |
+ if (!prev.length && (options.loopTop || options.continuousVertical)) { |
|
264 |
+ prev = $(SECTION_SEL).last(); |
|
265 |
+ } |
|
266 |
+ |
|
267 |
+ if (prev.length) { |
|
268 |
+ scrollPage(prev, null, true); |
|
269 |
+ } |
|
270 |
+ }; |
|
271 |
+ |
|
272 |
+ FP.moveSectionDown = function (){ |
|
273 |
+ var next = $(SECTION_ACTIVE_SEL).next(SECTION_SEL); |
|
274 |
+ |
|
275 |
+ //looping to the top if there's no more sections below |
|
276 |
+ if(!next.length && |
|
277 |
+ (options.loopBottom || options.continuousVertical)){ |
|
278 |
+ next = $(SECTION_SEL).first(); |
|
279 |
+ } |
|
280 |
+ |
|
281 |
+ if(next.length){ |
|
282 |
+ scrollPage(next, null, false); |
|
283 |
+ } |
|
284 |
+ }; |
|
285 |
+ |
|
286 |
+ FP.moveTo = function (section, slide){ |
|
287 |
+ var destiny = ''; |
|
288 |
+ |
|
289 |
+ if(isNaN(section)){ |
|
290 |
+ destiny = $('[data-anchor="'+section+'"]'); |
|
291 |
+ }else{ |
|
292 |
+ destiny = $(SECTION_SEL).eq( (section -1) ); |
|
293 |
+ } |
|
294 |
+ |
|
295 |
+ if (typeof slide !== 'undefined'){ |
|
296 |
+ scrollPageAndSlide(section, slide); |
|
297 |
+ }else if(destiny.length > 0){ |
|
298 |
+ scrollPage(destiny); |
|
299 |
+ } |
|
300 |
+ }; |
|
301 |
+ |
|
302 |
+ FP.moveSlideRight = function(){ |
|
303 |
+ moveSlide('next'); |
|
304 |
+ }; |
|
305 |
+ |
|
306 |
+ FP.moveSlideLeft = function(){ |
|
307 |
+ moveSlide('prev'); |
|
308 |
+ }; |
|
309 |
+ |
|
310 |
+ /** |
|
311 |
+ * When resizing is finished, we adjust the slides sizes and positions |
|
312 |
+ */ |
|
313 |
+ FP.reBuild = function(resizing){ |
|
314 |
+ if(container.hasClass(DESTROYED)){ return; } //nothing to do if the plugin was destroyed |
|
315 |
+ |
|
316 |
+ isResizing = true; |
|
317 |
+ |
|
318 |
+ var windowsWidth = $window.width(); |
|
319 |
+ windowsHeight = $window.height(); //updating global var |
|
320 |
+ |
|
321 |
+ //text and images resizing |
|
322 |
+ if (options.resize) { |
|
323 |
+ resizeMe(windowsHeight, windowsWidth); |
|
324 |
+ } |
|
325 |
+ |
|
326 |
+ $(SECTION_SEL).each(function(){ |
|
327 |
+ var slidesWrap = $(this).find(SLIDES_WRAPPER_SEL); |
|
328 |
+ var slides = $(this).find(SLIDE_SEL); |
|
329 |
+ |
|
330 |
+ //adjusting the height of the table-cell for IE and Firefox |
|
331 |
+ if(options.verticalCentered){ |
|
332 |
+ $(this).find(TABLE_CELL_SEL).css('height', getTableHeight($(this)) + 'px'); |
|
333 |
+ } |
|
334 |
+ |
|
335 |
+ $(this).css('height', windowsHeight + 'px'); |
|
336 |
+ |
|
337 |
+ //resizing the scrolling divs |
|
338 |
+ if(options.scrollOverflow){ |
|
339 |
+ if(slides.length){ |
|
340 |
+ slides.each(function(){ |
|
341 |
+ createSlimScrolling($(this)); |
|
342 |
+ }); |
|
343 |
+ }else{ |
|
344 |
+ createSlimScrolling($(this)); |
|
345 |
+ } |
|
346 |
+ } |
|
347 |
+ |
|
348 |
+ //adjusting the position fo the FULL WIDTH slides... |
|
349 |
+ if (slides.length) { |
|
350 |
+ landscapeScroll(slidesWrap, slidesWrap.find(SLIDE_ACTIVE_SEL)); |
|
351 |
+ } |
|
352 |
+ }); |
|
353 |
+ |
|
354 |
+ var activeSection = $(SECTION_ACTIVE_SEL); |
|
355 |
+ |
|
356 |
+ //isn't it the first section? |
|
357 |
+ if(activeSection.index(SECTION_SEL)){ |
|
358 |
+ //adjusting the position for the current section |
|
359 |
+ scrollPage(activeSection); |
|
360 |
+ } |
|
361 |
+ |
|
362 |
+ isResizing = false; |
|
363 |
+ $.isFunction( options.afterResize ) && resizing && options.afterResize.call(container); |
|
364 |
+ $.isFunction( options.afterReBuild ) && !resizing && options.afterReBuild.call(container); |
|
365 |
+ }; |
|
366 |
+ |
|
367 |
+ //flag to avoid very fast sliding for landscape sliders |
|
368 |
+ var slideMoving = false; |
|
369 |
+ |
|
370 |
+ var isTouchDevice = navigator.userAgent.match(/(iPhone|iPod|iPad|Android|playbook|silk|BlackBerry|BB10|Windows Phone|Tizen|Bada|webOS|IEMobile|Opera Mini)/); |
|
371 |
+ var isTouch = (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0) || (navigator.maxTouchPoints)); |
|
372 |
+ var container = $(this); |
|
373 |
+ var windowsHeight = $window.height(); |
|
374 |
+ var isResizing = false; |
|
375 |
+ var lastScrolledDestiny; |
|
376 |
+ var lastScrolledSlide; |
|
377 |
+ var canScroll = true; |
|
378 |
+ var scrollings = []; |
|
379 |
+ var nav; |
|
380 |
+ var isScrollAllowed = { 'up':true, 'down':true, 'left':true, 'right':true }; |
|
381 |
+ var originals = $.extend(true, {}, options); //deep copy |
|
382 |
+ |
|
383 |
+ FP.setAllowScrolling(true); |
|
384 |
+ container.removeClass(DESTROYED); //in case it was destroyed before initilizing it again |
|
385 |
+ |
|
386 |
+ //if css3 is not supported, it will use jQuery animations |
|
387 |
+ if(options.css3){ |
|
388 |
+ options.css3 = support3d(); |
|
389 |
+ } |
|
390 |
+ |
|
391 |
+ if($(this).length){ |
|
392 |
+ container.css({ |
|
393 |
+ 'height': '100%', |
|
394 |
+ 'position': 'relative' |
|
395 |
+ }); |
|
396 |
+ |
|
397 |
+ //adding a class to recognize the container internally in the code |
|
398 |
+ container.addClass(WRAPPER); |
|
399 |
+ } |
|
400 |
+ |
|
401 |
+ //trying to use fullpage without a selector? |
|
402 |
+ else{ |
|
403 |
+ showError('error', 'Error! Fullpage.js needs to be initialized with a selector. For example: $(\'#myContainer\').fullpage();'); |
|
404 |
+ } |
|
405 |
+ |
|
406 |
+ //adding internal class names to void problem with common ones |
|
407 |
+ $(options.sectionSelector).each(function(){ |
|
408 |
+ $(this).addClass(SECTION); |
|
409 |
+ }); |
|
410 |
+ $(options.slideSelector).each(function(){ |
|
411 |
+ $(this).addClass(SLIDE); |
|
412 |
+ }); |
|
413 |
+ |
|
414 |
+ //creating the navigation dots |
|
415 |
+ if (options.navigation) { |
|
416 |
+ addVerticalNavigation(); |
|
417 |
+ } |
|
418 |
+ |
|
419 |
+ $(SECTION_SEL).each(function(index){ |
|
420 |
+ var that = $(this); |
|
421 |
+ var slides = $(this).find(SLIDE_SEL); |
|
422 |
+ var numSlides = slides.length; |
|
423 |
+ |
|
424 |
+ //if no active section is defined, the 1st one will be the default one |
|
425 |
+ if(!index && $(SECTION_ACTIVE_SEL).length === 0) { |
|
426 |
+ $(this).addClass(ACTIVE); |
|
427 |
+ } |
|
428 |
+ |
|
429 |
+ $(this).css('height', windowsHeight + 'px'); |
|
430 |
+ |
|
431 |
+ if(options.paddingTop){ |
|
432 |
+ $(this).css('padding-top', options.paddingTop); |
|
433 |
+ } |
|
434 |
+ |
|
435 |
+ if(options.paddingBottom){ |
|
436 |
+ $(this).css('padding-bottom', options.paddingBottom); |
|
437 |
+ } |
|
438 |
+ |
|
439 |
+ if (typeof options.sectionsColor[index] !== 'undefined') { |
|
440 |
+ $(this).css('background-color', options.sectionsColor[index]); |
|
441 |
+ } |
|
442 |
+ |
|
443 |
+ if (typeof options.anchors[index] !== 'undefined') { |
|
444 |
+ $(this).attr('data-anchor', options.anchors[index]); |
|
445 |
+ |
|
446 |
+ //activating the menu / nav element on load |
|
447 |
+ if($(this).hasClass(ACTIVE)){ |
|
448 |
+ activateMenuAndNav(options.anchors[index], index); |
|
449 |
+ } |
|
450 |
+ } |
|
451 |
+ |
|
452 |
+ // if there's any slide |
|
453 |
+ if (numSlides > 1) { |
|
454 |
+ var sliderWidth = numSlides * 100; |
|
455 |
+ var slideWidth = 100 / numSlides; |
|
456 |
+ |
|
457 |
+ slides.wrapAll('<div class="' + SLIDES_CONTAINER + '" />'); |
|
458 |
+ slides.parent().wrap('<div class="' + SLIDES_WRAPPER + '" />'); |
|
459 |
+ |
|
460 |
+ $(this).find(SLIDES_CONTAINER_SEL).css('width', sliderWidth + '%'); |
|
461 |
+ |
|
462 |
+ if(options.controlArrows){ |
|
463 |
+ createSlideArrows($(this)); |
|
464 |
+ } |
|
465 |
+ |
|
466 |
+ if(options.slidesNavigation){ |
|
467 |
+ addSlidesNavigation($(this), numSlides); |
|
468 |
+ } |
|
469 |
+ |
|
470 |
+ slides.each(function(index) { |
|
471 |
+ $(this).css('width', slideWidth + '%'); |
|
472 |
+ |
|
473 |
+ if(options.verticalCentered){ |
|
474 |
+ addTableClass($(this)); |
|
475 |
+ } |
|
476 |
+ }); |
|
477 |
+ |
|
478 |
+ var startingSlide = that.find(SLIDE_ACTIVE_SEL); |
|
479 |
+ |
|
480 |
+ //if the slide won#t be an starting point, the default will be the first one |
|
481 |
+ if(!startingSlide.length){ |
|
482 |
+ slides.eq(0).addClass(ACTIVE); |
|
483 |
+ } |
|
484 |
+ |
|
485 |
+ //is there a starting point for a non-starting section? |
|
486 |
+ else{ |
|
487 |
+ silentLandscapeScroll(startingSlide); |
|
488 |
+ } |
|
489 |
+ |
|
490 |
+ }else{ |
|
491 |
+ if(options.verticalCentered){ |
|
492 |
+ addTableClass($(this)); |
|
493 |
+ } |
|
494 |
+ } |
|
495 |
+ |
|
496 |
+ }).promise().done(function(){ |
|
497 |
+ FP.setAutoScrolling(options.autoScrolling, 'internal'); |
|
498 |
+ |
|
499 |
+ //the starting point is a slide? |
|
500 |
+ var activeSlide = $(SECTION_ACTIVE_SEL).find(SLIDE_ACTIVE_SEL); |
|
501 |
+ |
|
502 |
+ //the active section isn't the first one? Is not the first slide of the first section? Then we load that section/slide by default. |
|
503 |
+ if( activeSlide.length && ($(SECTION_ACTIVE_SEL).index(SECTION_SEL) !== 0 || ($(SECTION_ACTIVE_SEL).index(SECTION_SEL) === 0 && activeSlide.index() !== 0))){ |
|
504 |
+ silentLandscapeScroll(activeSlide); |
|
505 |
+ } |
|
506 |
+ |
|
507 |
+ //fixed elements need to be moved out of the plugin container due to problems with CSS3. |
|
508 |
+ if(options.fixedElements && options.css3){ |
|
509 |
+ $(options.fixedElements).appendTo($body); |
|
510 |
+ } |
|
511 |
+ |
|
512 |
+ //vertical centered of the navigation + first bullet active |
|
513 |
+ if(options.navigation){ |
|
514 |
+ nav.css('margin-top', '-' + (nav.height()/2) + 'px'); |
|
515 |
+ nav.find('li').eq($(SECTION_ACTIVE_SEL).index(SECTION_SEL)).find('a').addClass(ACTIVE); |
|
516 |
+ } |
|
517 |
+ |
|
518 |
+ //moving the menu outside the main container if it is inside (avoid problems with fixed positions when using CSS3 tranforms) |
|
519 |
+ if(options.menu && options.css3 && $(options.menu).closest(WRAPPER_SEL).length){ |
|
520 |
+ $(options.menu).appendTo($body); |
|
521 |
+ } |
|
522 |
+ |
|
523 |
+ if(options.scrollOverflow){ |
|
524 |
+ if(document.readyState === 'complete'){ |
|
525 |
+ createSlimScrollingHandler(); |
|
526 |
+ } |
|
527 |
+ //after DOM and images are loaded |
|
528 |
+ $window.on('load', createSlimScrollingHandler); |
|
529 |
+ }else{ |
|
530 |
+ $.isFunction( options.afterRender ) && options.afterRender.call(container); |
|
531 |
+ } |
|
532 |
+ |
|
533 |
+ responsive(); |
|
534 |
+ |
|
535 |
+ //for animateAnchor:false |
|
536 |
+ if(!options.animateAnchor){ |
|
537 |
+ //getting the anchor link in the URL and deleting the `#` |
|
538 |
+ var value = window.location.hash.replace('#', '').split('/'); |
|
539 |
+ var destiny = value[0]; |
|
540 |
+ |
|
541 |
+ if(destiny.length){ |
|
542 |
+ var section = $('[data-anchor="'+destiny+'"]'); |
|
543 |
+ |
|
544 |
+ if(section.length){ |
|
545 |
+ if(options.autoScrolling){ |
|
546 |
+ silentScroll(section.position().top); |
|
547 |
+ } |
|
548 |
+ else{ |
|
549 |
+ silentScroll(0); |
|
550 |
+ |
|
551 |
+ //scrolling the page to the section with no animation |
|
552 |
+ $htmlBody.scrollTop(section.position().top); |
|
553 |
+ } |
|
554 |
+ activateMenuAndNav(destiny, null); |
|
555 |
+ |
|
556 |
+ $.isFunction( options.afterLoad ) && options.afterLoad.call( section, destiny, (section.index(SECTION_SEL) + 1)); |
|
557 |
+ |
|
558 |
+ //updating the active class |
|
559 |
+ section.addClass(ACTIVE).siblings().removeClass(ACTIVE); |
|
560 |
+ } |
|
561 |
+ } |
|
562 |
+ } |
|
563 |
+ |
|
564 |
+ //setting the class for the body element |
|
565 |
+ setBodyClass(); |
|
566 |
+ |
|
567 |
+ $window.on('load', function() { |
|
568 |
+ scrollToAnchor(); |
|
569 |
+ }); |
|
570 |
+ |
|
571 |
+ }); |
|
572 |
+ |
|
573 |
+ |
|
574 |
+ /** |
|
575 |
+ * Creates the control arrows for the given section |
|
576 |
+ */ |
|
577 |
+ function createSlideArrows(section){ |
|
578 |
+ section.find(SLIDES_WRAPPER_SEL).after('<div class="' + SLIDES_ARROW_PREV + '"></div><div class="' + SLIDES_ARROW_NEXT + '"></div>'); |
|
579 |
+ |
|
580 |
+ if(options.controlArrowColor!='#fff'){ |
|
581 |
+ section.find(SLIDES_ARROW_NEXT_SEL).css('border-color', 'transparent transparent transparent '+options.controlArrowColor); |
|
582 |
+ section.find(SLIDES_ARROW_PREV_SEL).css('border-color', 'transparent '+ options.controlArrowColor + ' transparent transparent'); |
|
583 |
+ } |
|
584 |
+ |
|
585 |
+ if(!options.loopHorizontal){ |
|
586 |
+ section.find(SLIDES_ARROW_PREV_SEL).hide(); |
|
587 |
+ } |
|
588 |
+ } |
|
589 |
+ |
|
590 |
+ /** |
|
591 |
+ * Creates a vertical navigation bar. |
|
592 |
+ */ |
|
593 |
+ function addVerticalNavigation(){ |
|
594 |
+ $body.append('<div id="' + SECTION_NAV + '"><ul></ul></div>'); |
|
595 |
+ nav = $(SECTION_NAV_SEL); |
|
596 |
+ |
|
597 |
+ nav.addClass(function() { |
|
598 |
+ return options.showActiveTooltip ? SHOW_ACTIVE_TOOLTIP + ' ' + options.navigationPosition : options.navigationPosition; |
|
599 |
+ }); |
|
600 |
+ |
|
601 |
+ for (var i = 0; i < $(SECTION_SEL).length; i++) { |
|
602 |
+ var link = ''; |
|
603 |
+ if (options.anchors.length) { |
|
604 |
+ link = options.anchors[i]; |
|
605 |
+ } |
|
606 |
+ |
|
607 |
+ var li = '<li><a href="#' + link + '"><span></span></a>'; |
|
608 |
+ |
|
609 |
+ // Only add tooltip if needed (defined by user) |
|
610 |
+ var tooltip = options.navigationTooltips[i]; |
|
611 |
+ |
|
612 |
+ if (typeof tooltip !== 'undefined' && tooltip !== '') { |
|
613 |
+ li += '<div class="' + SECTION_NAV_TOOLTIP + ' ' + options.navigationPosition + '">' + tooltip + '</div>'; |
|
614 |
+ } |
|
615 |
+ |
|
616 |
+ li += '</li>'; |
|
617 |
+ |
|
618 |
+ nav.find('ul').append(li); |
|
619 |
+ } |
|
620 |
+ } |
|
621 |
+ |
|
622 |
+ function createSlimScrollingHandler(){ |
|
623 |
+ $(SECTION_SEL).each(function(){ |
|
624 |
+ var slides = $(this).find(SLIDE_SEL); |
|
625 |
+ |
|
626 |
+ if(slides.length){ |
|
627 |
+ slides.each(function(){ |
|
628 |
+ createSlimScrolling($(this)); |
|
629 |
+ }); |
|
630 |
+ }else{ |
|
631 |
+ createSlimScrolling($(this)); |
|
632 |
+ } |
|
633 |
+ |
|
634 |
+ }); |
|
635 |
+ $.isFunction( options.afterRender ) && options.afterRender.call( this); |
|
636 |
+ } |
|
637 |
+ |
|
638 |
+ var scrollId; |
|
639 |
+ var scrollId2; |
|
640 |
+ var isScrolling = false; |
|
641 |
+ |
|
642 |
+ //when scrolling... |
|
643 |
+ $window.on('scroll', scrollHandler); |
|
644 |
+ |
|
645 |
+ function scrollHandler(){ |
|
646 |
+ var currentSection; |
|
647 |
+ |
|
648 |
+ if(!options.autoScrolling || options.scrollBar){ |
|
649 |
+ var currentScroll = $window.scrollTop(); |
|
650 |
+ var visibleSectionIndex = 0; |
|
651 |
+ var initial = Math.abs(currentScroll - document.querySelectorAll(SECTION_SEL)[0].offsetTop); |
|
652 |
+ |
|
653 |
+ //taking the section which is showing more content in the viewport |
|
654 |
+ var sections = document.querySelectorAll(SECTION_SEL); |
|
655 |
+ for (var i = 0; i < sections.length; ++i) { |
|
656 |
+ var section = sections[i]; |
|
657 |
+ |
|
658 |
+ var current = Math.abs(currentScroll - section.offsetTop); |
|
659 |
+ |
|
660 |
+ if(current < initial){ |
|
661 |
+ visibleSectionIndex = i; |
|
662 |
+ initial = current; |
|
663 |
+ } |
|
664 |
+ } |
|
665 |
+ |
|
666 |
+ //geting the last one, the current one on the screen |
|
667 |
+ currentSection = $(sections).eq(visibleSectionIndex); |
|
668 |
+ } |
|
669 |
+ |
|
670 |
+ if(!options.autoScrolling || options.scrollBar){ |
|
671 |
+ //executing only once the first time we reach the section |
|
672 |
+ if(!currentSection.hasClass(ACTIVE)){ |
|
673 |
+ isScrolling = true; |
|
674 |
+ var leavingSection = $(SECTION_ACTIVE_SEL); |
|
675 |
+ var leavingSectionIndex = leavingSection.index(SECTION_SEL) + 1; |
|
676 |
+ var yMovement = getYmovement(currentSection); |
|
677 |
+ var anchorLink = currentSection.data('anchor'); |
|
678 |
+ var sectionIndex = currentSection.index(SECTION_SEL) + 1; |
|
679 |
+ var activeSlide = currentSection.find(SLIDE_ACTIVE_SEL); |
|
680 |
+ |
|
681 |
+ if(activeSlide.length){ |
|
682 |
+ var slideAnchorLink = activeSlide.data('anchor'); |
|
683 |
+ var slideIndex = activeSlide.index(); |
|
684 |
+ } |
|
685 |
+ |
|
686 |
+ if(canScroll){ |
|
687 |
+ currentSection.addClass(ACTIVE).siblings().removeClass(ACTIVE); |
|
688 |
+ |
|
689 |
+ $.isFunction( options.onLeave ) && options.onLeave.call( leavingSection, leavingSectionIndex, sectionIndex, yMovement); |
|
690 |
+ |
|
691 |
+ $.isFunction( options.afterLoad ) && options.afterLoad.call( currentSection, anchorLink, sectionIndex); |
|
692 |
+ |
|
693 |
+ activateMenuAndNav(anchorLink, sectionIndex - 1); |
|
694 |
+ |
|
695 |
+ if(options.anchors.length){ |
|
696 |
+ //needed to enter in hashChange event when using the menu with anchor links |
|
697 |
+ lastScrolledDestiny = anchorLink; |
|
698 |
+ |
|
699 |
+ setState(slideIndex, slideAnchorLink, anchorLink, sectionIndex); |
|
700 |
+ } |
|
701 |
+ } |
|
702 |
+ |
|
703 |
+ //small timeout in order to avoid entering in hashChange event when scrolling is not finished yet |
|
704 |
+ clearTimeout(scrollId); |
|
705 |
+ scrollId = setTimeout(function(){ |
|
706 |
+ isScrolling = false; |
|
707 |
+ }, 100); |
|
708 |
+ } |
|
709 |
+ |
|
710 |
+ if(options.fitToSection){ |
|
711 |
+ //for the auto adjust of the viewport to fit a whole section |
|
712 |
+ clearTimeout(scrollId2); |
|
713 |
+ |
|
714 |
+ scrollId2 = setTimeout(function(){ |
|
715 |
+ if(canScroll){ |
|
716 |
+ //allows to scroll to an active section and |
|
717 |
+ //if the section is already active, we prevent firing callbacks |
|
718 |
+ if($(SECTION_ACTIVE_SEL).is(currentSection)){ |
|
719 |
+ isResizing = true; |
|
720 |
+ } |
|
721 |
+ scrollPage(currentSection); |
|
722 |
+ isResizing = false; |
|
723 |
+ } |
|
724 |
+ }, 1000); |
|
725 |
+ } |
|
726 |
+ } |
|
727 |
+ } |
|
728 |
+ |
|
729 |
+ |
|
730 |
+ /** |
|
731 |
+ * Determines whether the active section or slide is scrollable through and scrolling bar |
|
732 |
+ */ |
|
733 |
+ function isScrollable(activeSection){ |
|
734 |
+ //if there are landscape slides, we check if the scrolling bar is in the current one or not |
|
735 |
+ if(activeSection.find(SLIDES_WRAPPER_SEL).length){ |
|
736 |
+ return activeSection.find(SLIDE_ACTIVE_SEL).find(SCROLLABLE_SEL); |
|
737 |
+ } |
|
738 |
+ |
|
739 |
+ return activeSection.find(SCROLLABLE_SEL); |
|
740 |
+ } |
|
741 |
+ |
|
742 |
+ /** |
|
743 |
+ * Determines the way of scrolling up or down: |
|
744 |
+ * by 'automatically' scrolling a section or by using the default and normal scrolling. |
|
745 |
+ */ |
|
746 |
+ function scrolling(type, scrollable){ |
|
747 |
+ if (!isScrollAllowed[type]){ |
|
748 |
+ return; |
|
749 |
+ } |
|
750 |
+ var check, scrollSection; |
|
751 |
+ |
|
752 |
+ if(type == 'down'){ |
|
753 |
+ check = 'bottom'; |
|
754 |
+ scrollSection = FP.moveSectionDown; |
|
755 |
+ }else{ |
|
756 |
+ check = 'top'; |
|
757 |
+ scrollSection = FP.moveSectionUp; |
|
758 |
+ } |
|
759 |
+ |
|
760 |
+ if(scrollable.length > 0 ){ |
|
761 |
+ //is the scrollbar at the start/end of the scroll? |
|
762 |
+ if(isScrolled(check, scrollable)){ |
|
763 |
+ scrollSection(); |
|
764 |
+ }else{ |
|
765 |
+ return true; |
|
766 |
+ } |
|
767 |
+ }else{ |
|
768 |
+ // moved up/down |
|
769 |
+ scrollSection(); |
|
770 |
+ } |
|
771 |
+ } |
|
772 |
+ |
|
773 |
+ |
|
774 |
+ var touchStartY = 0; |
|
775 |
+ var touchStartX = 0; |
|
776 |
+ var touchEndY = 0; |
|
777 |
+ var touchEndX = 0; |
|
778 |
+ |
|
779 |
+ /* Detecting touch events |
|
780 |
+ |
|
781 |
+ * As we are changing the top property of the page on scrolling, we can not use the traditional way to detect it. |
|
782 |
+ * This way, the touchstart and the touch moves shows an small difference between them which is the |
|
783 |
+ * used one to determine the direction. |
|
784 |
+ */ |
|
785 |
+ function touchMoveHandler(event){ |
|
786 |
+ var e = event.originalEvent; |
|
787 |
+ |
|
788 |
+ // additional: if one of the normalScrollElements isn't within options.normalScrollElementTouchThreshold hops up the DOM chain |
|
789 |
+ if (!checkParentForNormalScrollElement(event.target) && isReallyTouch(e) ) { |
|
790 |
+ |
|
791 |
+ if(options.autoScrolling){ |
|
792 |
+ //preventing the easing on iOS devices |
|
793 |
+ event.preventDefault(); |
|
794 |
+ } |
|
795 |
+ |
|
796 |
+ var activeSection = $(SECTION_ACTIVE_SEL); |
|
797 |
+ var scrollable = isScrollable(activeSection); |
|
798 |
+ |
|
799 |
+ if (canScroll && !slideMoving) { //if theres any # |
|
800 |
+ var touchEvents = getEventsPage(e); |
|
801 |
+ |
|
802 |
+ touchEndY = touchEvents.y; |
|
803 |
+ touchEndX = touchEvents.x; |
|
804 |
+ |
|
805 |
+ //if movement in the X axys is greater than in the Y and the currect section has slides... |
|
806 |
+ if (activeSection.find(SLIDES_WRAPPER_SEL).length && Math.abs(touchStartX - touchEndX) > (Math.abs(touchStartY - touchEndY))) { |
|
807 |
+ |
|
808 |
+ //is the movement greater than the minimum resistance to scroll? |
|
809 |
+ if (Math.abs(touchStartX - touchEndX) > ($window.width() / 100 * options.touchSensitivity)) { |
|
810 |
+ if (touchStartX > touchEndX) { |
|
811 |
+ if(isScrollAllowed.right){ |
|
812 |
+ FP.moveSlideRight(); //next |
|
813 |
+ } |
|
814 |
+ } else { |
|
815 |
+ if(isScrollAllowed.left){ |
|
816 |
+ FP.moveSlideLeft(); //prev |
|
817 |
+ } |
|
818 |
+ } |
|
819 |
+ } |
|
820 |
+ } |
|
821 |
+ |
|
822 |
+ //vertical scrolling (only when autoScrolling is enabled) |
|
823 |
+ else if(options.autoScrolling){ |
|
824 |
+ |
|
825 |
+ //is the movement greater than the minimum resistance to scroll? |
|
826 |
+ if (Math.abs(touchStartY - touchEndY) > ($window.height() / 100 * options.touchSensitivity)) { |
|
827 |
+ if (touchStartY > touchEndY) { |
|
828 |
+ scrolling('down', scrollable); |
|
829 |
+ } else if (touchEndY > touchStartY) { |
|
830 |
+ scrolling('up', scrollable); |
|
831 |
+ } |
|
832 |
+ } |
|
833 |
+ } |
|
834 |
+ } |
|
835 |
+ } |
|
836 |
+ |
|
837 |
+ } |
|
838 |
+ |
|
839 |
+ /** |
|
840 |
+ * recursive function to loop up the parent nodes to check if one of them exists in options.normalScrollElements |
|
841 |
+ * Currently works well for iOS - Android might need some testing |
|
842 |
+ * @param {Element} el target element / jquery selector (in subsequent nodes) |
|
843 |
+ * @param {int} hop current hop compared to options.normalScrollElementTouchThreshold |
|
844 |
+ * @return {boolean} true if there is a match to options.normalScrollElements |
|
845 |
+ */ |
|
846 |
+ function checkParentForNormalScrollElement (el, hop) { |
|
847 |
+ hop = hop || 0; |
|
848 |
+ var parent = $(el).parent(); |
|
849 |
+ |
|
850 |
+ if (hop < options.normalScrollElementTouchThreshold && |
|
851 |
+ parent.is(options.normalScrollElements) ) { |
|
852 |
+ return true; |
|
853 |
+ } else if (hop == options.normalScrollElementTouchThreshold) { |
|
854 |
+ return false; |
|
855 |
+ } else { |
|
856 |
+ return checkParentForNormalScrollElement(parent, ++hop); |
|
857 |
+ } |
|
858 |
+ } |
|
859 |
+ |
|
860 |
+ /** |
|
861 |
+ * As IE >= 10 fires both touch and mouse events when using a mouse in a touchscreen |
|
862 |
+ * this way we make sure that is really a touch event what IE is detecting. |
|
863 |
+ */ |
|
864 |
+ function isReallyTouch(e){ |
|
865 |
+ //if is not IE || IE is detecting `touch` or `pen` |
|
866 |
+ return typeof e.pointerType === 'undefined' || e.pointerType != 'mouse'; |
|
867 |
+ } |
|
868 |
+ |
|
869 |
+ function touchStartHandler(event){ |
|
870 |
+ var e = event.originalEvent; |
|
871 |
+ |
|
872 |
+ //stopping the auto scroll to adjust to a section |
|
873 |
+ if(options.fitToSection){ |
|
874 |
+ $htmlBody.stop(); |
|
875 |
+ } |
|
876 |
+ |
|
877 |
+ if(isReallyTouch(e)){ |
|
878 |
+ var touchEvents = getEventsPage(e); |
|
879 |
+ touchStartY = touchEvents.y; |
|
880 |
+ touchStartX = touchEvents.x; |
|
881 |
+ } |
|
882 |
+ } |
|
883 |
+ |
|
884 |
+ function getAverage(elements, number){ |
|
885 |
+ var sum = 0; |
|
886 |
+ |
|
887 |
+ //taking `number` elements from the end to make the average, if there are not enought, 1 |
|
888 |
+ var lastElements = elements.slice(Math.max(elements.length - number, 1)); |
|
889 |
+ |
|
890 |
+ for(var i = 0; i < lastElements.length; i++){ |
|
891 |
+ sum = sum + lastElements[i]; |
|
892 |
+ } |
|
893 |
+ |
|
894 |
+ return Math.ceil(sum/number); |
|
895 |
+ } |
|
896 |
+ |
|
897 |
+ /** |
|
898 |
+ * Detecting mousewheel scrolling |
|
899 |
+ * |
|
900 |
+ * http://blogs.sitepointstatic.com/examples/tech/mouse-wheel/index.html |
|
901 |
+ * http://www.sitepoint.com/html5-javascript-mouse-wheel/ |
|
902 |
+ */ |
|
903 |
+ var prevTime = new Date().getTime(); |
|
904 |
+ |
|
905 |
+ function MouseWheelHandler(e) { |
|
906 |
+ var curTime = new Date().getTime(); |
|
907 |
+ |
|
908 |
+ if(options.autoScrolling){ |
|
909 |
+ // cross-browser wheel delta |
|
910 |
+ e = window.event || e; |
|
911 |
+ var value = e.wheelDelta || -e.deltaY || -e.detail; |
|
912 |
+ var delta = Math.max(-1, Math.min(1, value)); |
|
913 |
+ |
|
914 |
+ //Limiting the array to 150 (lets not waist memory!) |
|
915 |
+ if(scrollings.length > 149){ |
|
916 |
+ scrollings.shift(); |
|
917 |
+ } |
|
918 |
+ |
|
919 |
+ //keeping record of the previous scrollings |
|
920 |
+ scrollings.push(Math.abs(value)); |
|
921 |
+ |
|
922 |
+ //preventing to scroll the site on mouse wheel when scrollbar is present |
|
923 |
+ if(options.scrollBar){ |
|
924 |
+ e.preventDefault ? e.preventDefault() : e.returnValue = false; |
|
925 |
+ } |
|
926 |
+ |
|
927 |
+ var activeSection = $(SECTION_ACTIVE_SEL); |
|
928 |
+ var scrollable = isScrollable(activeSection); |
|
929 |
+ |
|
930 |
+ //time difference between the last scroll and the current one |
|
931 |
+ var timeDiff = curTime-prevTime; |
|
932 |
+ prevTime = curTime; |
|
933 |
+ |
|
934 |
+ //haven't they scrolled in a while? |
|
935 |
+ //(enough to be consider a different scrolling action to scroll another section) |
|
936 |
+ if(timeDiff > 200){ |
|
937 |
+ //emptying the array, we dont care about old scrollings for our averages |
|
938 |
+ scrollings = []; |
|
939 |
+ } |
|
940 |
+ |
|
941 |
+ if(canScroll){ |
|
942 |
+ var averageEnd = getAverage(scrollings, 10); |
|
943 |
+ var averageMiddle = getAverage(scrollings, 70); |
|
944 |
+ var isAccelerating = averageEnd >= averageMiddle; |
|
945 |
+ |
|
946 |
+ //to avoid double swipes... |
|
947 |
+ if(isAccelerating){ |
|
948 |
+ //scrolling down? |
|
949 |
+ if (delta < 0) { |
|
950 |
+ scrolling('down', scrollable); |
|
951 |
+ |
|
952 |
+ //scrolling up? |
|
953 |
+ }else { |
|
954 |
+ scrolling('up', scrollable); |
|
955 |
+ } |
|
956 |
+ } |
|
957 |
+ } |
|
958 |
+ |
|
959 |
+ return false; |
|
960 |
+ } |
|
961 |
+ |
|
962 |
+ if(options.fitToSection){ |
|
963 |
+ //stopping the auto scroll to adjust to a section |
|
964 |
+ $htmlBody.stop(); |
|
965 |
+ } |
|
966 |
+ } |
|
967 |
+ |
|
968 |
+ function moveSlide(direction){ |
|
969 |
+ var activeSection = $(SECTION_ACTIVE_SEL); |
|
970 |
+ var slides = activeSection.find(SLIDES_WRAPPER_SEL); |
|
971 |
+ |
|
972 |
+ // more than one slide needed and nothing should be sliding |
|
973 |
+ if (!slides.length || slideMoving) { |
|
974 |
+ return; |
|
975 |
+ } |
|
976 |
+ |
|
977 |
+ var currentSlide = slides.find(SLIDE_ACTIVE_SEL); |
|
978 |
+ var destiny = null; |
|
979 |
+ |
|
980 |
+ if(direction === 'prev'){ |
|
981 |
+ destiny = currentSlide.prev(SLIDE_SEL); |
|
982 |
+ }else{ |
|
983 |
+ destiny = currentSlide.next(SLIDE_SEL); |
|
984 |
+ } |
|
985 |
+ |
|
986 |
+ //isn't there a next slide in the secuence? |
|
987 |
+ if(!destiny.length){ |
|
988 |
+ //respect loopHorizontal settin |
|
989 |
+ if (!options.loopHorizontal) return; |
|
990 |
+ |
|
991 |
+ if(direction === 'prev'){ |
|
992 |
+ destiny = currentSlide.siblings(':last'); |
|
993 |
+ }else{ |
|
994 |
+ destiny = currentSlide.siblings(':first'); |
|
995 |
+ } |
|
996 |
+ } |
|
997 |
+ |
|
998 |
+ slideMoving = true; |
|
999 |
+ |
|
1000 |
+ landscapeScroll(slides, destiny); |
|
1001 |
+ } |
|
1002 |
+ |
|
1003 |
+ /** |
|
1004 |
+ * Maintains the active slides in the viewport |
|
1005 |
+ * (Because he `scroll` animation might get lost with some actions, such as when using continuousVertical) |
|
1006 |
+ */ |
|
1007 |
+ function keepSlidesPosition(){ |
|
1008 |
+ $(SLIDE_ACTIVE_SEL).each(function(){ |
|
1009 |
+ silentLandscapeScroll($(this)); |
|
1010 |
+ }); |
|
1011 |
+ } |
|
1012 |
+ |
|
1013 |
+ /** |
|
1014 |
+ * Scrolls the site to the given element and scrolls to the slide if a callback is given. |
|
1015 |
+ */ |
|
1016 |
+ function scrollPage(element, callback, isMovementUp){ |
|
1017 |
+ var dest = element.position(); |
|
1018 |
+ if(typeof dest === 'undefined'){ return; } //there's no element to scroll, leaving the function |
|
1019 |
+ |
|
1020 |
+ //local variables |
|
1021 |
+ var v = { |
|
1022 |
+ element: element, |
|
1023 |
+ callback: callback, |
|
1024 |
+ isMovementUp: isMovementUp, |
|
1025 |
+ dest: dest, |
|
1026 |
+ dtop: dest.top, |
|
1027 |
+ yMovement: getYmovement(element), |
|
1028 |
+ anchorLink: element.data('anchor'), |
|
1029 |
+ sectionIndex: element.index(SECTION_SEL), |
|
1030 |
+ activeSlide: element.find(SLIDE_ACTIVE_SEL), |
|
1031 |
+ activeSection: $(SECTION_ACTIVE_SEL), |
|
1032 |
+ leavingSection: $(SECTION_ACTIVE_SEL).index(SECTION_SEL) + 1, |
|
1033 |
+ |
|
1034 |
+ //caching the value of isResizing at the momment the function is called |
|
1035 |
+ //because it will be checked later inside a setTimeout and the value might change |
|
1036 |
+ localIsResizing: isResizing |
|
1037 |
+ }; |
|
1038 |
+ |
|
1039 |
+ //quiting when destination scroll is the same as the current one |
|
1040 |
+ if((v.activeSection.is(element) && !isResizing) || (options.scrollBar && $window.scrollTop() === v.dtop)){ return; } |
|
1041 |
+ |
|
1042 |
+ if(v.activeSlide.length){ |
|
1043 |
+ var slideAnchorLink = v.activeSlide.data('anchor'); |
|
1044 |
+ var slideIndex = v.activeSlide.index(); |
|
1045 |
+ } |
|
1046 |
+ |
|
1047 |
+ // If continuousVertical && we need to wrap around |
|
1048 |
+ if (options.autoScrolling && options.continuousVertical && typeof (v.isMovementUp) !== "undefined" && |
|
1049 |
+ ((!v.isMovementUp && v.yMovement == 'up') || // Intending to scroll down but about to go up or |
|
1050 |
+ (v.isMovementUp && v.yMovement == 'down'))) { // intending to scroll up but about to go down |
|
1051 |
+ |
|
1052 |
+ v = createInfiniteSections(v); |
|
1053 |
+ } |
|
1054 |
+ |
|
1055 |
+ element.addClass(ACTIVE).siblings().removeClass(ACTIVE); |
|
1056 |
+ |
|
1057 |
+ //preventing from activating the MouseWheelHandler event |
|
1058 |
+ //more than once if the page is scrolling |
|
1059 |
+ canScroll = false; |
|
1060 |
+ |
|
1061 |
+ setState(slideIndex, slideAnchorLink, v.anchorLink, v.sectionIndex); |
|
1062 |
+ |
|
1063 |
+ //callback (onLeave) if the site is not just resizing and readjusting the slides |
|
1064 |
+ $.isFunction(options.onLeave) && !v.localIsResizing && options.onLeave.call(v.activeSection, v.leavingSection, (v.sectionIndex + 1), v.yMovement); |
|
1065 |
+ |
|
1066 |
+ performMovement(v); |
|
1067 |
+ |
|
1068 |
+ //flag to avoid callingn `scrollPage()` twice in case of using anchor links |
|
1069 |
+ lastScrolledDestiny = v.anchorLink; |
|
1070 |
+ |
|
1071 |
+ //avoid firing it twice (as it does also on scroll) |
|
1072 |
+ activateMenuAndNav(v.anchorLink, v.sectionIndex); |
|
1073 |
+ } |
|
1074 |
+ |
|
1075 |
+ /** |
|
1076 |
+ * Performs the movement (by CSS3 or by jQuery) |
|
1077 |
+ */ |
|
1078 |
+ function performMovement(v){ |
|
1079 |
+ // using CSS3 translate functionality |
|
1080 |
+ if (options.css3 && options.autoScrolling && !options.scrollBar) { |
|
1081 |
+ |
|
1082 |
+ var translate3d = 'translate3d(0px, -' + v.dtop + 'px, 0px)'; |
|
1083 |
+ transformContainer(translate3d, true); |
|
1084 |
+ |
|
1085 |
+ setTimeout(function () { |
|
1086 |
+ afterSectionLoads(v); |
|
1087 |
+ }, options.scrollingSpeed); |
|
1088 |
+ } |
|
1089 |
+ |
|
1090 |
+ // using jQuery animate |
|
1091 |
+ else{ |
|
1092 |
+ var scrollSettings = getScrollSettings(v); |
|
1093 |
+ |
|
1094 |
+ $(scrollSettings.element).animate( |
|
1095 |
+ scrollSettings.options, |
|
1096 |
+ options.scrollingSpeed, options.easing).promise().done(function () { //only one single callback in case of animating `html, body` |
|
1097 |
+ afterSectionLoads(v); |
|
1098 |
+ }); |
|
1099 |
+ } |
|
1100 |
+ } |
|
1101 |
+ |
|
1102 |
+ /** |
|
1103 |
+ * Gets the scrolling settings depending on the plugin autoScrolling option |
|
1104 |
+ */ |
|
1105 |
+ function getScrollSettings(v){ |
|
1106 |
+ var scroll = {}; |
|
1107 |
+ |
|
1108 |
+ if(options.autoScrolling && !options.scrollBar){ |
|
1109 |
+ scroll.options = { 'top': -v.dtop}; |
|
1110 |
+ scroll.element = WRAPPER_SEL; |
|
1111 |
+ }else{ |
|
1112 |
+ scroll.options = { 'scrollTop': v.dtop}; |
|
1113 |
+ scroll.element = 'html, body'; |
|
1114 |
+ } |
|
1115 |
+ |
|
1116 |
+ return scroll; |
|
1117 |
+ } |
|
1118 |
+ |
|
1119 |
+ /** |
|
1120 |
+ * Adds sections before or after the current one to create the infinite effect. |
|
1121 |
+ */ |
|
1122 |
+ function createInfiniteSections(v){ |
|
1123 |
+ // Scrolling down |
|
1124 |
+ if (!v.isMovementUp) { |
|
1125 |
+ // Move all previous sections to after the active section |
|
1126 |
+ $(SECTION_ACTIVE_SEL).after(v.activeSection.prevAll(SECTION_SEL).get().reverse()); |
|
1127 |
+ } |
|
1128 |
+ else { // Scrolling up |
|
1129 |
+ // Move all next sections to before the active section |
|
1130 |
+ $(SECTION_ACTIVE_SEL).before(v.activeSection.nextAll(SECTION_SEL)); |
|
1131 |
+ } |
|
1132 |
+ |
|
1133 |
+ // Maintain the displayed position (now that we changed the element order) |
|
1134 |
+ silentScroll($(SECTION_ACTIVE_SEL).position().top); |
|
1135 |
+ |
|
1136 |
+ // Maintain the active slides visible in the viewport |
|
1137 |
+ keepSlidesPosition(); |
|
1138 |
+ |
|
1139 |
+ // save for later the elements that still need to be reordered |
|
1140 |
+ v.wrapAroundElements = v.activeSection; |
|
1141 |
+ |
|
1142 |
+ // Recalculate animation variables |
|
1143 |
+ v.dest = v.element.position(); |
|
1144 |
+ v.dtop = v.dest.top; |
|
1145 |
+ v.yMovement = getYmovement(v.element); |
|
1146 |
+ |
|
1147 |
+ return v; |
|
1148 |
+ } |
|
1149 |
+ |
|
1150 |
+ /** |
|
1151 |
+ * Fix section order after continuousVertical changes have been animated |
|
1152 |
+ */ |
|
1153 |
+ function continuousVerticalFixSectionOrder (v) { |
|
1154 |
+ // If continuousVertical is in effect (and autoScrolling would also be in effect then), |
|
1155 |
+ // finish moving the elements around so the direct navigation will function more simply |
|
1156 |
+ if (!v.wrapAroundElements || !v.wrapAroundElements.length) { |
|
1157 |
+ return; |
|
1158 |
+ } |
|
1159 |
+ |
|
1160 |
+ if (v.isMovementUp) { |
|
1161 |
+ $(SECTION_FIRST_SEL).before(v.wrapAroundElements); |
|
1162 |
+ } |
|
1163 |
+ else { |
|
1164 |
+ $(SECTION_LAST_SEL).after(v.wrapAroundElements); |
|
1165 |
+ } |
|
1166 |
+ |
|
1167 |
+ silentScroll($(SECTION_ACTIVE_SEL).position().top); |
|
1168 |
+ |
|
1169 |
+ // Maintain the active slides visible in the viewport |
|
1170 |
+ keepSlidesPosition(); |
|
1171 |
+ } |
|
1172 |
+ |
|
1173 |
+ |
|
1174 |
+ /** |
|
1175 |
+ * Actions to do once the section is loaded |
|
1176 |
+ */ |
|
1177 |
+ function afterSectionLoads (v){ |
|
1178 |
+ continuousVerticalFixSectionOrder(v); |
|
1179 |
+ //callback (afterLoad) if the site is not just resizing and readjusting the slides |
|
1180 |
+ $.isFunction(options.afterLoad) && !v.localIsResizing && options.afterLoad.call(v.element, v.anchorLink, (v.sectionIndex + 1)); |
|
1181 |
+ canScroll = true; |
|
1182 |
+ |
|
1183 |
+ setTimeout(function () { |
|
1184 |
+ $.isFunction(v.callback) && v.callback.call(this); |
|
1185 |
+ }, 600); |
|
1186 |
+ } |
|
1187 |
+ |
|
1188 |
+ /** |
|
1189 |
+ * Scrolls to the anchor in the URL when loading the site |
|
1190 |
+ */ |
|
1191 |
+ function scrollToAnchor(){ |
|
1192 |
+ //getting the anchor link in the URL and deleting the `#` |
|
1193 |
+ var value = window.location.hash.replace('#', '').split('/'); |
|
1194 |
+ var section = value[0]; |
|
1195 |
+ var slide = value[1]; |
|
1196 |
+ |
|
1197 |
+ if(section){ //if theres any # |
|
1198 |
+ scrollPageAndSlide(section, slide); |
|
1199 |
+ } |
|
1200 |
+ } |
|
1201 |
+ |
|
1202 |
+ //detecting any change on the URL to scroll to the given anchor link |
|
1203 |
+ //(a way to detect back history button as we play with the hashes on the URL) |
|
1204 |
+ $window.on('hashchange', hashChangeHandler); |
|
1205 |
+ |
|
1206 |
+ function hashChangeHandler(){ |
|
1207 |
+ if(!isScrolling){ |
|
1208 |
+ var value = window.location.hash.replace('#', '').split('/'); |
|
1209 |
+ var section = value[0]; |
|
1210 |
+ var slide = value[1]; |
|
1211 |
+ |
|
1212 |
+ if(section.length){ |
|
1213 |
+ //when moving to a slide in the first section for the first time (first time to add an anchor to the URL) |
|
1214 |
+ var isFirstSlideMove = (typeof lastScrolledDestiny === 'undefined'); |
|
1215 |
+ var isFirstScrollMove = (typeof lastScrolledDestiny === 'undefined' && typeof slide === 'undefined' && !slideMoving); |
|
1216 |
+ |
|
1217 |
+ /*in order to call scrollpage() only once for each destination at a time |
|
1218 |
+ It is called twice for each scroll otherwise, as in case of using anchorlinks `hashChange` |
|
1219 |
+ event is fired on every scroll too.*/ |
|
1220 |
+ if ((section && section !== lastScrolledDestiny) && !isFirstSlideMove || isFirstScrollMove || (!slideMoving && lastScrolledSlide != slide )) { |
|
1221 |
+ scrollPageAndSlide(section, slide); |
|
1222 |
+ } |
|
1223 |
+ } |
|
1224 |
+ } |
|
1225 |
+ } |
|
1226 |
+ |
|
1227 |
+ /** |
|
1228 |
+ * Sliding with arrow keys, both, vertical and horizontal |
|
1229 |
+ */ |
|
1230 |
+ $document.keydown(keydownHandler); |
|
1231 |
+ |
|
1232 |
+ var keydownId; |
|
1233 |
+ function keydownHandler(e) { |
|
1234 |
+ clearTimeout(keydownId); |
|
1235 |
+ |
|
1236 |
+ var activeElement = $(document.activeElement); |
|
1237 |
+ |
|
1238 |
+ if(!activeElement.is('textarea') && !activeElement.is('input') && !activeElement.is('select') && |
|
1239 |
+ options.keyboardScrolling && options.autoScrolling){ |
|
1240 |
+ var keyCode = e.which; |
|
1241 |
+ |
|
1242 |
+ //preventing the scroll with arrow keys & spacebar & Page Up & Down keys |
|
1243 |
+ var keyControls = [40, 38, 32, 33, 34]; |
|
1244 |
+ if($.inArray(keyCode, keyControls) > -1){ |
|
1245 |
+ e.preventDefault(); |
|
1246 |
+ } |
|
1247 |
+ |
|
1248 |
+ keydownId = setTimeout(function(){ |
|
1249 |
+ onkeydown(e); |
|
1250 |
+ },150); |
|
1251 |
+ } |
|
1252 |
+ } |
|
1253 |
+ |
|
1254 |
+ function onkeydown(e){ |
|
1255 |
+ var shiftPressed = e.shiftKey; |
|
1256 |
+ |
|
1257 |
+ switch (e.which) { |
|
1258 |
+ //up |
|
1259 |
+ case 38: |
|
1260 |
+ case 33: |
|
1261 |
+ FP.moveSectionUp(); |
|
1262 |
+ break; |
|
1263 |
+ |
|
1264 |
+ //down |
|
1265 |
+ case 32: //spacebar |
|
1266 |
+ if(shiftPressed){ |
|
1267 |
+ FP.moveSectionUp(); |
|
1268 |
+ break; |
|
1269 |
+ } |
|
1270 |
+ case 40: |
|
1271 |
+ case 34: |
|
1272 |
+ FP.moveSectionDown(); |
|
1273 |
+ break; |
|
1274 |
+ |
|
1275 |
+ //Home |
|
1276 |
+ case 36: |
|
1277 |
+ FP.moveTo(1); |
|
1278 |
+ break; |
|
1279 |
+ |
|
1280 |
+ //End |
|
1281 |
+ case 35: |
|
1282 |
+ FP.moveTo( $(SECTION_SEL).length ); |
|
1283 |
+ break; |
|
1284 |
+ |
|
1285 |
+ //left |
|
1286 |
+ case 37: |
|
1287 |
+ FP.moveSlideLeft(); |
|
1288 |
+ break; |
|
1289 |
+ |
|
1290 |
+ //right |
|
1291 |
+ case 39: |
|
1292 |
+ FP.moveSlideRight(); |
|
1293 |
+ break; |
|
1294 |
+ |
|
1295 |
+ default: |
|
1296 |
+ return; // exit this handler for other keys |
|
1297 |
+ } |
|
1298 |
+ } |
|
1299 |
+ |
|
1300 |
+ //binding the mousemove when the mouse's middle button is released |
|
1301 |
+ container.mousedown(function(e){ |
|
1302 |
+ //middle button |
|
1303 |
+ if (e.which == 2){ |
|
1304 |
+ oldPageY = e.pageY; |
|
1305 |
+ container.on('mousemove', mouseMoveHandler); |
|
1306 |
+ } |
|
1307 |
+ }); |
|
1308 |
+ |
|
1309 |
+ //unbinding the mousemove when the mouse's middle button is released |
|
1310 |
+ container.mouseup(function(e){ |
|
1311 |
+ //middle button |
|
1312 |
+ if (e.which == 2){ |
|
1313 |
+ container.off('mousemove'); |
|
1314 |
+ } |
|
1315 |
+ }); |
|
1316 |
+ |
|
1317 |
+ /** |
|
1318 |
+ * Detecting the direction of the mouse movement. |
|
1319 |
+ * Used only for the middle button of the mouse. |
|
1320 |
+ */ |
|
1321 |
+ var oldPageY = 0; |
|
1322 |
+ function mouseMoveHandler(e){ |
|
1323 |
+ // moving up |
|
1324 |
+ if(canScroll){ |
|
1325 |
+ if (e.pageY < oldPageY){ |
|
1326 |
+ FP.moveSectionUp(); |
|
1327 |
+ |
|
1328 |
+ // moving downw |
|
1329 |
+ }else if(e.pageY > oldPageY){ |
|
1330 |
+ FP.moveSectionDown(); |
|
1331 |
+ } |
|
1332 |
+ } |
|
1333 |
+ oldPageY = e.pageY; |
|
1334 |
+ } |
|
1335 |
+ |
|
1336 |
+ /** |
|
1337 |
+ * Scrolls to the section when clicking the navigation bullet |
|
1338 |
+ */ |
|
1339 |
+ $document.on('click touchstart', SECTION_NAV_SEL + ' a', function(e){ |
|
1340 |
+ e.preventDefault(); |
|
1341 |
+ var index = $(this).parent().index(); |
|
1342 |
+ scrollPage($(SECTION_SEL).eq(index)); |
|
1343 |
+ }); |
|
1344 |
+ |
|
1345 |
+ /** |
|
1346 |
+ * Scrolls the slider to the given slide destination for the given section |
|
1347 |
+ */ |
|
1348 |
+ $document.on('click touchstart', SLIDES_NAV_LINK_SEL, function(e){ |
|
1349 |
+ e.preventDefault(); |
|
1350 |
+ var slides = $(this).closest(SECTION_SEL).find(SLIDES_WRAPPER_SEL); |
|
1351 |
+ var destiny = slides.find(SLIDE_SEL).eq($(this).closest('li').index()); |
|
1352 |
+ |
|
1353 |
+ landscapeScroll(slides, destiny); |
|
1354 |
+ }); |
|
1355 |
+ |
|
1356 |
+ if(options.normalScrollElements){ |
|
1357 |
+ $document.on('mouseenter', options.normalScrollElements, function () { |
|
1358 |
+ FP.setMouseWheelScrolling(false); |
|
1359 |
+ }); |
|
1360 |
+ |
|
1361 |
+ $document.on('mouseleave', options.normalScrollElements, function(){ |
|
1362 |
+ FP.setMouseWheelScrolling(true); |
|
1363 |
+ }); |
|
1364 |
+ } |
|
1365 |
+ |
|
1366 |
+ /** |
|
1367 |
+ * Scrolling horizontally when clicking on the slider controls. |
|
1368 |
+ */ |
|
1369 |
+ $(SECTION_SEL).on('click touchstart', SLIDES_ARROW_SEL, function() { |
|
1370 |
+ if ($(this).hasClass(SLIDES_PREV)) { |
|
1371 |
+ FP.moveSlideLeft(); |
|
1372 |
+ } else { |
|
1373 |
+ FP.moveSlideRight(); |
|
1374 |
+ } |
|
1375 |
+ }); |
|
1376 |
+ |
|
1377 |
+ /** |
|
1378 |
+ * Scrolls horizontal sliders. |
|
1379 |
+ */ |
|
1380 |
+ function landscapeScroll(slides, destiny){ |
|
1381 |
+ var destinyPos = destiny.position(); |
|
1382 |
+ var slideIndex = destiny.index(); |
|
1383 |
+ var section = slides.closest(SECTION_SEL); |
|
1384 |
+ var sectionIndex = section.index(SECTION_SEL); |
|
1385 |
+ var anchorLink = section.data('anchor'); |
|
1386 |
+ var slidesNav = section.find(SLIDES_NAV_SEL); |
|
1387 |
+ var slideAnchor = getSlideAnchor(destiny); |
|
1388 |
+ |
|
1389 |
+ //caching the value of isResizing at the momment the function is called |
|
1390 |
+ //because it will be checked later inside a setTimeout and the value might change |
|
1391 |
+ var localIsResizing = isResizing; |
|
1392 |
+ |
|
1393 |
+ if(options.onSlideLeave){ |
|
1394 |
+ var prevSlide = section.find(SLIDE_ACTIVE_SEL); |
|
1395 |
+ var prevSlideIndex = prevSlide.index(); |
|
1396 |
+ var xMovement = getXmovement(prevSlideIndex, slideIndex); |
|
1397 |
+ |
|
1398 |
+ //if the site is not just resizing and readjusting the slides |
|
1399 |
+ if(!localIsResizing && xMovement!=='none'){ |
|
1400 |
+ $.isFunction( options.onSlideLeave ) && options.onSlideLeave.call( prevSlide, anchorLink, (sectionIndex + 1), prevSlideIndex, xMovement); |
|
1401 |
+ } |
|
1402 |
+ } |
|
1403 |
+ |
|
1404 |
+ destiny.addClass(ACTIVE).siblings().removeClass(ACTIVE); |
|
1405 |
+ |
|
1406 |
+ if(!options.loopHorizontal && options.controlArrows){ |
|
1407 |
+ //hidding it for the fist slide, showing for the rest |
|
1408 |
+ section.find(SLIDES_ARROW_PREV_SEL).toggle(slideIndex!==0); |
|
1409 |
+ |
|
1410 |
+ //hidding it for the last slide, showing for the rest |
|
1411 |
+ section.find(SLIDES_ARROW_NEXT_SEL).toggle(!destiny.is(':last-child')); |
|
1412 |
+ } |
|
1413 |
+ |
|
1414 |
+ //only changing the URL if the slides are in the current section (not for resize re-adjusting) |
|
1415 |
+ if(section.hasClass(ACTIVE)){ |
|
1416 |
+ setState(slideIndex, slideAnchor, anchorLink, sectionIndex); |
|
1417 |
+ } |
|
1418 |
+ |
|
1419 |
+ var afterSlideLoads = function(){ |
|
1420 |
+ //if the site is not just resizing and readjusting the slides |
|
1421 |
+ if(!localIsResizing){ |
|
1422 |
+ $.isFunction( options.afterSlideLoad ) && options.afterSlideLoad.call( destiny, anchorLink, (sectionIndex + 1), slideAnchor, slideIndex); |
|
1423 |
+ } |
|
1424 |
+ //letting them slide again |
|
1425 |
+ slideMoving = false; |
|
1426 |
+ }; |
|
1427 |
+ |
|
1428 |
+ if(options.css3){ |
|
1429 |
+ var translate3d = 'translate3d(-' + destinyPos.left + 'px, 0px, 0px)'; |
|
1430 |
+ |
|
1431 |
+ addAnimation(slides.find(SLIDES_CONTAINER_SEL), options.scrollingSpeed>0).css(getTransforms(translate3d)); |
|
1432 |
+ |
|
1433 |
+ setTimeout(function(){ |
|
1434 |
+ afterSlideLoads(); |
|
1435 |
+ }, options.scrollingSpeed, options.easing); |
|
1436 |
+ }else{ |
|
1437 |
+ slides.animate({ |
|
1438 |
+ scrollLeft : destinyPos.left |
|
1439 |
+ }, options.scrollingSpeed, options.easing, function() { |
|
1440 |
+ |
|
1441 |
+ afterSlideLoads(); |
|
1442 |
+ }); |
|
1443 |
+ } |
|
1444 |
+ |
|
1445 |
+ slidesNav.find(ACTIVE_SEL).removeClass(ACTIVE); |
|
1446 |
+ slidesNav.find('li').eq(slideIndex).find('a').addClass(ACTIVE); |
|
1447 |
+ } |
|
1448 |
+ |
|
1449 |
+ //when resizing the site, we adjust the heights of the sections, slimScroll... |
|
1450 |
+ $window.resize(resizeHandler); |
|
1451 |
+ |
|
1452 |
+ var previousHeight = windowsHeight; |
|
1453 |
+ var resizeId; |
|
1454 |
+ function resizeHandler(){ |
|
1455 |
+ //checking if it needs to get responsive |
|
1456 |
+ responsive(); |
|
1457 |
+ |
|
1458 |
+ // rebuild immediately on touch devices |
|
1459 |
+ if (isTouchDevice) { |
|
1460 |
+ var activeElement = $(document.activeElement); |
|
1461 |
+ |
|
1462 |
+ //if the keyboard is NOT visible |
|
1463 |
+ if (!activeElement.is('textarea') && !activeElement.is('input') && !activeElement.is('select')) { |
|
1464 |
+ var currentHeight = $window.height(); |
|
1465 |
+ |
|
1466 |
+ //making sure the change in the viewport size is enough to force a rebuild. (20 % of the window to avoid problems when hidding scroll bars) |
|
1467 |
+ if( Math.abs(currentHeight - previousHeight) > (20 * Math.max(previousHeight, currentHeight) / 100) ){ |
|
1468 |
+ FP.reBuild(true); |
|
1469 |
+ previousHeight = currentHeight; |
|
1470 |
+ } |
|
1471 |
+ } |
|
1472 |
+ }else{ |
|
1473 |
+ //in order to call the functions only when the resize is finished |
|
1474 |
+ //http://stackoverflow.com/questions/4298612/jquery-how-to-call-resize-event-only-once-its-finished-resizing |
|
1475 |
+ clearTimeout(resizeId); |
|
1476 |
+ |
|
1477 |
+ resizeId = setTimeout(function(){ |
|
1478 |
+ FP.reBuild(true); |
|
1479 |
+ }, 500); |
|
1480 |
+ } |
|
1481 |
+ } |
|
1482 |
+ |
|
1483 |
+ /** |
|
1484 |
+ * Checks if the site needs to get responsive and disables autoScrolling if so. |
|
1485 |
+ * A class `fp-responsive` is added to the plugin's container in case the user wants to use it for his own responsive CSS. |
|
1486 |
+ */ |
|
1487 |
+ function responsive(){ |
|
1488 |
+ if(options.responsive){ |
|
1489 |
+ var isResponsive = container.hasClass(RESPONSIVE); |
|
1490 |
+ if ($window.width() < options.responsive ){ |
|
1491 |
+ if(!isResponsive){ |
|
1492 |
+ FP.setAutoScrolling(false, 'internal'); |
|
1493 |
+ FP.setFitToSection(false, 'internal'); |
|
1494 |
+ $(SECTION_NAV_SEL).hide(); |
|
1495 |
+ container.addClass(RESPONSIVE); |
|
1496 |
+ } |
|
1497 |
+ }else if(isResponsive){ |
|
1498 |
+ FP.setAutoScrolling(originals.autoScrolling, 'internal'); |
|
1499 |
+ FP.setFitToSection(originals.autoScrolling, 'internal'); |
|
1500 |
+ $(SECTION_NAV_SEL).show(); |
|
1501 |
+ container.removeClass(RESPONSIVE); |
|
1502 |
+ } |
|
1503 |
+ } |
|
1504 |
+ } |
|
1505 |
+ |
|
1506 |
+ /** |
|
1507 |
+ * Adds transition animations for the given element |
|
1508 |
+ */ |
|
1509 |
+ function addAnimation(element){ |
|
1510 |
+ var transition = 'all ' + options.scrollingSpeed + 'ms ' + options.easingcss3; |
|
1511 |
+ |
|
1512 |
+ element.removeClass(NO_TRANSITION); |
|
1513 |
+ return element.css({ |
|
1514 |
+ '-webkit-transition': transition, |
|
1515 |
+ 'transition': transition |
|
1516 |
+ }); |
|
1517 |
+ } |
|
1518 |
+ |
|
1519 |
+ /** |
|
1520 |
+ * Remove transition animations for the given element |
|
1521 |
+ */ |
|
1522 |
+ function removeAnimation(element){ |
|
1523 |
+ return element.addClass(NO_TRANSITION); |
|
1524 |
+ } |
|
1525 |
+ |
|
1526 |
+ /** |
|
1527 |
+ * Resizing of the font size depending on the window size as well as some of the images on the site. |
|
1528 |
+ */ |
|
1529 |
+ function resizeMe(displayHeight, displayWidth) { |
|
1530 |
+ //Standard dimensions, for which the body font size is correct |
|
1531 |
+ var preferredHeight = 825; |
|
1532 |
+ var preferredWidth = 900; |
|
1533 |
+ |
|
1534 |
+ if (displayHeight < preferredHeight || displayWidth < preferredWidth) { |
|
1535 |
+ var heightPercentage = (displayHeight * 100) / preferredHeight; |
|
1536 |
+ var widthPercentage = (displayWidth * 100) / preferredWidth; |
|
1537 |
+ var percentage = Math.min(heightPercentage, widthPercentage); |
|
1538 |
+ var newFontSize = percentage.toFixed(2); |
|
1539 |
+ |
|
1540 |
+ $body.css('font-size', newFontSize + '%'); |
|
1541 |
+ } else { |
|
1542 |
+ $body.css('font-size', '100%'); |
|
1543 |
+ } |
|
1544 |
+ } |
|
1545 |
+ |
|
1546 |
+ /** |
|
1547 |
+ * Activating the website navigation dots according to the given slide name. |
|
1548 |
+ */ |
|
1549 |
+ function activateNavDots(name, sectionIndex){ |
|
1550 |
+ if(options.navigation){ |
|
1551 |
+ $(SECTION_NAV_SEL).find(ACTIVE_SEL).removeClass(ACTIVE); |
|
1552 |
+ if(name){ |
|
1553 |
+ $(SECTION_NAV_SEL).find('a[href="#' + name + '"]').addClass(ACTIVE); |
|
1554 |
+ }else{ |
|
1555 |
+ $(SECTION_NAV_SEL).find('li').eq(sectionIndex).find('a').addClass(ACTIVE); |
|
1556 |
+ } |
|
1557 |
+ } |
|
1558 |
+ } |
|
1559 |
+ |
|
1560 |
+ /** |
|
1561 |
+ * Activating the website main menu elements according to the given slide name. |
|
1562 |
+ */ |
|
1563 |
+ function activateMenuElement(name){ |
|
1564 |
+ if(options.menu){ |
|
1565 |
+ $(options.menu).find(ACTIVE_SEL).removeClass(ACTIVE); |
|
1566 |
+ $(options.menu).find('[data-menuanchor="'+name+'"]').addClass(ACTIVE); |
|
1567 |
+ } |
|
1568 |
+ } |
|
1569 |
+ |
|
1570 |
+ function activateMenuAndNav(anchor, index){ |
|
1571 |
+ activateMenuElement(anchor); |
|
1572 |
+ activateNavDots(anchor, index); |
|
1573 |
+ } |
|
1574 |
+ |
|
1575 |
+ /** |
|
1576 |
+ * Return a boolean depending on whether the scrollable element is at the end or at the start of the scrolling |
|
1577 |
+ * depending on the given type. |
|
1578 |
+ */ |
|
1579 |
+ function isScrolled(type, scrollable){ |
|
1580 |
+ if(type === 'top'){ |
|
1581 |
+ return !scrollable.scrollTop(); |
|
1582 |
+ }else if(type === 'bottom'){ |
|
1583 |
+ return scrollable.scrollTop() + 1 + scrollable.innerHeight() >= scrollable[0].scrollHeight; |
|
1584 |
+ } |
|
1585 |
+ } |
|
1586 |
+ |
|
1587 |
+ /** |
|
1588 |
+ * Retuns `up` or `down` depending on the scrolling movement to reach its destination |
|
1589 |
+ * from the current section. |
|
1590 |
+ */ |
|
1591 |
+ function getYmovement(destiny){ |
|
1592 |
+ var fromIndex = $(SECTION_ACTIVE_SEL).index(SECTION_SEL); |
|
1593 |
+ var toIndex = destiny.index(SECTION_SEL); |
|
1594 |
+ if( fromIndex == toIndex){ |
|
1595 |
+ return 'none'; |
|
1596 |
+ } |
|
1597 |
+ if(fromIndex > toIndex){ |
|
1598 |
+ return 'up'; |
|
1599 |
+ } |
|
1600 |
+ return 'down'; |
|
1601 |
+ } |
|
1602 |
+ |
|
1603 |
+ /** |
|
1604 |
+ * Retuns `right` or `left` depending on the scrolling movement to reach its destination |
|
1605 |
+ * from the current slide. |
|
1606 |
+ */ |
|
1607 |
+ function getXmovement(fromIndex, toIndex){ |
|
1608 |
+ if( fromIndex == toIndex){ |
|
1609 |
+ return 'none'; |
|
1610 |
+ } |
|
1611 |
+ if(fromIndex > toIndex){ |
|
1612 |
+ return 'left'; |
|
1613 |
+ } |
|
1614 |
+ return 'right'; |
|
1615 |
+ } |
|
1616 |
+ |
|
1617 |
+ |
|
1618 |
+ function createSlimScrolling(element){ |
|
1619 |
+ //needed to make `scrollHeight` work under Opera 12 |
|
1620 |
+ element.css('overflow', 'hidden'); |
|
1621 |
+ |
|
1622 |
+ //in case element is a slide |
|
1623 |
+ var section = element.closest(SECTION_SEL); |
|
1624 |
+ var scrollable = element.find(SCROLLABLE_SEL); |
|
1625 |
+ var contentHeight; |
|
1626 |
+ |
|
1627 |
+ //if there was scroll, the contentHeight will be the one in the scrollable section |
|
1628 |
+ if(scrollable.length){ |
|
1629 |
+ contentHeight = scrollable.get(0).scrollHeight; |
|
1630 |
+ }else{ |
|
1631 |
+ contentHeight = element.get(0).scrollHeight; |
|
1632 |
+ if(options.verticalCentered){ |
|
1633 |
+ contentHeight = element.find(TABLE_CELL_SEL).get(0).scrollHeight; |
|
1634 |
+ } |
|
1635 |
+ } |
|
1636 |
+ |
|
1637 |
+ var scrollHeight = windowsHeight - parseInt(section.css('padding-bottom')) - parseInt(section.css('padding-top')); |
|
1638 |
+ |
|
1639 |
+ //needs scroll? |
|
1640 |
+ if ( contentHeight > scrollHeight) { |
|
1641 |
+ //was there already an scroll ? Updating it |
|
1642 |
+ if(scrollable.length){ |
|
1643 |
+ scrollable.css('height', scrollHeight + 'px').parent().css('height', scrollHeight + 'px'); |
|
1644 |
+ } |
|
1645 |
+ //creating the scrolling |
|
1646 |
+ else{ |
|
1647 |
+ if(options.verticalCentered){ |
|
1648 |
+ element.find(TABLE_CELL_SEL).wrapInner('<div class="' + SCROLLABLE + '" />'); |
|
1649 |
+ }else{ |
|
1650 |
+ element.wrapInner('<div class="' + SCROLLABLE + '" />'); |
|
1651 |
+ } |
|
1652 |
+ |
|
1653 |
+ element.find(SCROLLABLE_SEL).slimScroll({ |
|
1654 |
+ allowPageScroll: true, |
|
1655 |
+ height: scrollHeight + 'px', |
|
1656 |
+ size: '10px', |
|
1657 |
+ alwaysVisible: true |
|
1658 |
+ }); |
|
1659 |
+ } |
|
1660 |
+ } |
|
1661 |
+ |
|
1662 |
+ //removing the scrolling when it is not necessary anymore |
|
1663 |
+ else{ |
|
1664 |
+ removeSlimScroll(element); |
|
1665 |
+ } |
|
1666 |
+ |
|
1667 |
+ //undo |
|
1668 |
+ element.css('overflow', ''); |
|
1669 |
+ } |
|
1670 |
+ |
|
1671 |
+ function removeSlimScroll(element){ |
|
1672 |
+ element.find(SCROLLABLE_SEL).children().first().unwrap().unwrap(); |
|
1673 |
+ element.find(SLIMSCROLL_BAR_SEL).remove(); |
|
1674 |
+ element.find(SLIMSCROLL_RAIL_SEL).remove(); |
|
1675 |
+ } |
|
1676 |
+ |
|
1677 |
+ function addTableClass(element){ |
|
1678 |
+ element.addClass(TABLE).wrapInner('<div class="' + TABLE_CELL + '" style="height:' + getTableHeight(element) + 'px;" />'); |
|
1679 |
+ } |
|
1680 |
+ |
|
1681 |
+ function getTableHeight(element){ |
|
1682 |
+ var sectionHeight = windowsHeight; |
|
1683 |
+ |
|
1684 |
+ if(options.paddingTop || options.paddingBottom){ |
|
1685 |
+ var section = element; |
|
1686 |
+ if(!section.hasClass(SECTION)){ |
|
1687 |
+ section = element.closest(SECTION_SEL); |
|
1688 |
+ } |
|
1689 |
+ |
|
1690 |
+ var paddings = parseInt(section.css('padding-top')) + parseInt(section.css('padding-bottom')); |
|
1691 |
+ sectionHeight = (windowsHeight - paddings); |
|
1692 |
+ } |
|
1693 |
+ |
|
1694 |
+ return sectionHeight; |
|
1695 |
+ } |
|
1696 |
+ |
|
1697 |
+ /** |
|
1698 |
+ * Adds a css3 transform property to the container class with or without animation depending on the animated param. |
|
1699 |
+ */ |
|
1700 |
+ function transformContainer(translate3d, animated){ |
|
1701 |
+ if(animated){ |
|
1702 |
+ addAnimation(container); |
|
1703 |
+ }else{ |
|
1704 |
+ removeAnimation(container); |
|
1705 |
+ } |
|
1706 |
+ |
|
1707 |
+ container.css(getTransforms(translate3d)); |
|
1708 |
+ |
|
1709 |
+ //syncronously removing the class after the animation has been applied. |
|
1710 |
+ setTimeout(function(){ |
|
1711 |
+ container.removeClass(NO_TRANSITION); |
|
1712 |
+ },10); |
|
1713 |
+ } |
|
1714 |
+ |
|
1715 |
+ |
|
1716 |
+ /** |
|
1717 |
+ * Scrolls to the given section and slide |
|
1718 |
+ */ |
|
1719 |
+ function scrollPageAndSlide(destiny, slide){ |
|
1720 |
+ var section; |
|
1721 |
+ |
|
1722 |
+ if (typeof slide === 'undefined') { |
|
1723 |
+ slide = 0; |
|
1724 |
+ } |
|
1725 |
+ |
|
1726 |
+ if(isNaN(destiny)){ |
|
1727 |
+ section = $('[data-anchor="'+destiny+'"]'); |
|
1728 |
+ }else{ |
|
1729 |
+ section = $(SECTION_SEL).eq( (destiny -1) ); |
|
1730 |
+ } |
|
1731 |
+ |
|
1732 |
+ |
|
1733 |
+ //we need to scroll to the section and then to the slide |
|
1734 |
+ if (destiny !== lastScrolledDestiny && !section.hasClass(ACTIVE)){ |
|
1735 |
+ scrollPage(section, function(){ |
|
1736 |
+ scrollSlider(section, slide); |
|
1737 |
+ }); |
|
1738 |
+ } |
|
1739 |
+ //if we were already in the section |
|
1740 |
+ else{ |
|
1741 |
+ scrollSlider(section, slide); |
|
1742 |
+ } |
|
1743 |
+ } |
|
1744 |
+ |
|
1745 |
+ /** |
|
1746 |
+ * Scrolls the slider to the given slide destination for the given section |
|
1747 |
+ */ |
|
1748 |
+ function scrollSlider(section, slide){ |
|
1749 |
+ if(typeof slide != 'undefined'){ |
|
1750 |
+ var slides = section.find(SLIDES_WRAPPER_SEL); |
|
1751 |
+ var destiny = slides.find('[data-anchor="'+slide+'"]'); |
|
1752 |
+ |
|
1753 |
+ if(!destiny.length){ |
|
1754 |
+ destiny = slides.find(SLIDE_SEL).eq(slide); |
|
1755 |
+ } |
|
1756 |
+ |
|
1757 |
+ if(destiny.length){ |
|
1758 |
+ landscapeScroll(slides, destiny); |
|
1759 |
+ } |
|
1760 |
+ } |
|
1761 |
+ } |
|
1762 |
+ |
|
1763 |
+ /** |
|
1764 |
+ * Creates a landscape navigation bar with dots for horizontal sliders. |
|
1765 |
+ */ |
|
1766 |
+ function addSlidesNavigation(section, numSlides){ |
|
1767 |
+ section.append('<div class="' + SLIDES_NAV + '"><ul></ul></div>'); |
|
1768 |
+ var nav = section.find(SLIDES_NAV_SEL); |
|
1769 |
+ |
|
1770 |
+ //top or bottom |
|
1771 |
+ nav.addClass(options.slidesNavPosition); |
|
1772 |
+ |
|
1773 |
+ for(var i=0; i< numSlides; i++){ |
|
1774 |
+ nav.find('ul').append('<li><a href="#"><span></span></a></li>'); |
|
1775 |
+ } |
|
1776 |
+ |
|
1777 |
+ //centering it |
|
1778 |
+ nav.css('margin-left', '-' + (nav.width()/2) + 'px'); |
|
1779 |
+ |
|
1780 |
+ nav.find('li').first().find('a').addClass(ACTIVE); |
|
1781 |
+ } |
|
1782 |
+ |
|
1783 |
+ |
|
1784 |
+ /** |
|
1785 |
+ * Sets the state of the website depending on the active section/slide. |
|
1786 |
+ * It changes the URL hash when needed and updates the body class. |
|
1787 |
+ */ |
|
1788 |
+ function setState(slideIndex, slideAnchor, anchorLink, sectionIndex){ |
|
1789 |
+ var sectionHash = ''; |
|
1790 |
+ |
|
1791 |
+ if(options.anchors.length){ |
|
1792 |
+ |
|
1793 |
+ //isn't it the first slide? |
|
1794 |
+ if(slideIndex){ |
|
1795 |
+ if(typeof anchorLink !== 'undefined'){ |
|
1796 |
+ sectionHash = anchorLink; |
|
1797 |
+ } |
|
1798 |
+ |
|
1799 |
+ //slide without anchor link? We take the index instead. |
|
1800 |
+ if(typeof slideAnchor === 'undefined'){ |
|
1801 |
+ slideAnchor = slideIndex; |
|
1802 |
+ } |
|
1803 |
+ |
|
1804 |
+ lastScrolledSlide = slideAnchor; |
|
1805 |
+ setUrlHash(sectionHash + '/' + slideAnchor); |
|
1806 |
+ |
|
1807 |
+ //first slide won't have slide anchor, just the section one |
|
1808 |
+ }else if(typeof slideIndex !== 'undefined'){ |
|
1809 |
+ lastScrolledSlide = slideAnchor; |
|
1810 |
+ setUrlHash(anchorLink); |
|
1811 |
+ } |
|
1812 |
+ |
|
1813 |
+ //section without slides |
|
1814 |
+ else{ |
|
1815 |
+ setUrlHash(anchorLink); |
|
1816 |
+ } |
|
1817 |
+ } |
|
1818 |
+ |
|
1819 |
+ setBodyClass(); |
|
1820 |
+ } |
|
1821 |
+ |
|
1822 |
+ /** |
|
1823 |
+ * Sets the URL hash. |
|
1824 |
+ */ |
|
1825 |
+ function setUrlHash(url){ |
|
1826 |
+ if(options.recordHistory){ |
|
1827 |
+ location.hash = url; |
|
1828 |
+ }else{ |
|
1829 |
+ //Mobile Chrome doesn't work the normal way, so... lets use HTML5 for phones :) |
|
1830 |
+ if(isTouchDevice || isTouch){ |
|
1831 |
+ history.replaceState(undefined, undefined, '#' + url); |
|
1832 |
+ }else{ |
|
1833 |
+ var baseUrl = window.location.href.split('#')[0]; |
|
1834 |
+ window.location.replace( baseUrl + '#' + url ); |
|
1835 |
+ } |
|
1836 |
+ } |
|
1837 |
+ } |
|
1838 |
+ |
|
1839 |
+ /** |
|
1840 |
+ * Gets the anchor for the given slide. Its index will be used if there's none. |
|
1841 |
+ */ |
|
1842 |
+ function getSlideAnchor(slide){ |
|
1843 |
+ var slideAnchor = slide.data('anchor'); |
|
1844 |
+ var slideIndex = slide.index(SLIDE_SEL); |
|
1845 |
+ |
|
1846 |
+ //Slide without anchor link? We take the index instead. |
|
1847 |
+ if(typeof slideAnchor === 'undefined'){ |
|
1848 |
+ slideAnchor = slideIndex; |
|
1849 |
+ } |
|
1850 |
+ |
|
1851 |
+ return slideAnchor; |
|
1852 |
+ } |
|
1853 |
+ |
|
1854 |
+ /** |
|
1855 |
+ * Sets a class for the body of the page depending on the active section / slide |
|
1856 |
+ */ |
|
1857 |
+ function setBodyClass(){ |
|
1858 |
+ var section = $(SECTION_ACTIVE_SEL); |
|
1859 |
+ var slide = section.find(SLIDE_ACTIVE_SEL); |
|
1860 |
+ |
|
1861 |
+ var sectionAnchor = section.data('anchor'); |
|
1862 |
+ var slideAnchor = getSlideAnchor(slide); |
|
1863 |
+ |
|
1864 |
+ var sectionIndex = section.index(SECTION_SEL); |
|
1865 |
+ |
|
1866 |
+ var text = String(sectionIndex); |
|
1867 |
+ |
|
1868 |
+ if(options.anchors.length){ |
|
1869 |
+ text = sectionAnchor; |
|
1870 |
+ } |
|
1871 |
+ |
|
1872 |
+ if(slide.length){ |
|
1873 |
+ text = text + '-' + slideAnchor; |
|
1874 |
+ } |
|
1875 |
+ |
|
1876 |
+ //changing slash for dash to make it a valid CSS style |
|
1877 |
+ text = text.replace('/', '-').replace('#',''); |
|
1878 |
+ |
|
1879 |
+ //removing previous anchor classes |
|
1880 |
+ var classRe = new RegExp('\\b\\s?' + VIEWING_PREFIX + '-[^\\s]+\\b', "g"); |
|
1881 |
+ $body[0].className = $body[0].className.replace(classRe, ''); |
|
1882 |
+ |
|
1883 |
+ //adding the current anchor |
|
1884 |
+ $body.addClass(VIEWING_PREFIX + '-' + text); |
|
1885 |
+ } |
|
1886 |
+ |
|
1887 |
+ /** |
|
1888 |
+ * Checks for translate3d support |
|
1889 |
+ * @return boolean |
|
1890 |
+ * http://stackoverflow.com/questions/5661671/detecting-transform-translate3d-support |
|
1891 |
+ */ |
|
1892 |
+ function support3d() { |
|
1893 |
+ var el = document.createElement('p'), |
|
1894 |
+ has3d, |
|
1895 |
+ transforms = { |
|
1896 |
+ 'webkitTransform':'-webkit-transform', |
|
1897 |
+ 'OTransform':'-o-transform', |
|
1898 |
+ 'msTransform':'-ms-transform', |
|
1899 |
+ 'MozTransform':'-moz-transform', |
|
1900 |
+ 'transform':'transform' |
|
1901 |
+ }; |
|
1902 |
+ |
|
1903 |
+ // Add it to the body to get the computed style. |
|
1904 |
+ document.body.insertBefore(el, null); |
|
1905 |
+ |
|
1906 |
+ for (var t in transforms) { |
|
1907 |
+ if (el.style[t] !== undefined) { |
|
1908 |
+ el.style[t] = 'translate3d(1px,1px,1px)'; |
|
1909 |
+ has3d = window.getComputedStyle(el).getPropertyValue(transforms[t]); |
|
1910 |
+ } |
|
1911 |
+ } |
|
1912 |
+ |
|
1913 |
+ document.body.removeChild(el); |
|
1914 |
+ |
|
1915 |
+ return (has3d !== undefined && has3d.length > 0 && has3d !== 'none'); |
|
1916 |
+ } |
|
1917 |
+ |
|
1918 |
+ |
|
1919 |
+ |
|
1920 |
+ /** |
|
1921 |
+ * Removes the auto scrolling action fired by the mouse wheel and trackpad. |
|
1922 |
+ * After this function is called, the mousewheel and trackpad movements won't scroll through sections. |
|
1923 |
+ */ |
|
1924 |
+ function removeMouseWheelHandler(){ |
|
1925 |
+ if (document.addEventListener) { |
|
1926 |
+ document.removeEventListener('mousewheel', MouseWheelHandler, false); //IE9, Chrome, Safari, Oper |
|
1927 |
+ document.removeEventListener('wheel', MouseWheelHandler, false); //Firefox |
|
1928 |
+ } else { |
|
1929 |
+ document.detachEvent('onmousewheel', MouseWheelHandler); //IE 6/7/8 |
|
1930 |
+ } |
|
1931 |
+ } |
|
1932 |
+ |
|
1933 |
+ |
|
1934 |
+ /** |
|
1935 |
+ * Adds the auto scrolling action for the mouse wheel and trackpad. |
|
1936 |
+ * After this function is called, the mousewheel and trackpad movements will scroll through sections |
|
1937 |
+ */ |
|
1938 |
+ function addMouseWheelHandler(){ |
|
1939 |
+ if (document.addEventListener) { |
|
1940 |
+ document.addEventListener('mousewheel', MouseWheelHandler, false); //IE9, Chrome, Safari, Oper |
|
1941 |
+ document.addEventListener('wheel', MouseWheelHandler, false); //Firefox |
|
1942 |
+ } else { |
|
1943 |
+ document.attachEvent('onmousewheel', MouseWheelHandler); //IE 6/7/8 |
|
1944 |
+ } |
|
1945 |
+ } |
|
1946 |
+ |
|
1947 |
+ |
|
1948 |
+ /** |
|
1949 |
+ * Adds the possibility to auto scroll through sections on touch devices. |
|
1950 |
+ */ |
|
1951 |
+ function addTouchHandler(){ |
|
1952 |
+ if(isTouchDevice || isTouch){ |
|
1953 |
+ //Microsoft pointers |
|
1954 |
+ var MSPointer = getMSPointer(); |
|
1955 |
+ |
|
1956 |
+ $document.off('touchstart ' + MSPointer.down).on('touchstart ' + MSPointer.down, touchStartHandler); |
|
1957 |
+ $document.off('touchmove ' + MSPointer.move).on('touchmove ' + MSPointer.move, touchMoveHandler); |
|
1958 |
+ } |
|
1959 |
+ } |
|
1960 |
+ |
|
1961 |
+ /** |
|
1962 |
+ * Removes the auto scrolling for touch devices. |
|
1963 |
+ */ |
|
1964 |
+ function removeTouchHandler(){ |
|
1965 |
+ if(isTouchDevice || isTouch){ |
|
1966 |
+ //Microsoft pointers |
|
1967 |
+ var MSPointer = getMSPointer(); |
|
1968 |
+ |
|
1969 |
+ $document.off('touchstart ' + MSPointer.down); |
|
1970 |
+ $document.off('touchmove ' + MSPointer.move); |
|
1971 |
+ } |
|
1972 |
+ } |
|
1973 |
+ |
|
1974 |
+ |
|
1975 |
+ /* |
|
1976 |
+ * Returns and object with Microsoft pointers (for IE<11 and for IE >= 11) |
|
1977 |
+ * http://msdn.microsoft.com/en-us/library/ie/dn304886(v=vs.85).aspx |
|
1978 |
+ */ |
|
1979 |
+ function getMSPointer(){ |
|
1980 |
+ var pointer; |
|
1981 |
+ |
|
1982 |
+ //IE >= 11 & rest of browsers |
|
1983 |
+ if(window.PointerEvent){ |
|
1984 |
+ pointer = { down: 'pointerdown', move: 'pointermove'}; |
|
1985 |
+ } |
|
1986 |
+ |
|
1987 |
+ //IE < 11 |
|
1988 |
+ else{ |
|
1989 |
+ pointer = { down: 'MSPointerDown', move: 'MSPointerMove'}; |
|
1990 |
+ } |
|
1991 |
+ |
|
1992 |
+ return pointer; |
|
1993 |
+ } |
|
1994 |
+ /** |
|
1995 |
+ * Gets the pageX and pageY properties depending on the browser. |
|
1996 |
+ * https://github.com/alvarotrigo/fullPage.js/issues/194#issuecomment-34069854 |
|
1997 |
+ */ |
|
1998 |
+ function getEventsPage(e){ |
|
1999 |
+ var events = []; |
|
2000 |
+ |
|
2001 |
+ events.y = (typeof e.pageY !== 'undefined' && (e.pageY || e.pageX) ? e.pageY : e.touches[0].pageY); |
|
2002 |
+ events.x = (typeof e.pageX !== 'undefined' && (e.pageY || e.pageX) ? e.pageX : e.touches[0].pageX); |
|
2003 |
+ |
|
2004 |
+ //in touch devices with scrollBar:true, e.pageY is detected, but we have to deal with touch events. #1008 |
|
2005 |
+ if(isTouch && isReallyTouch(e)){ |
|
2006 |
+ events.y = e.touches[0].pageY; |
|
2007 |
+ events.x = e.touches[0].pageX; |
|
2008 |
+ } |
|
2009 |
+ |
|
2010 |
+ return events; |
|
2011 |
+ } |
|
2012 |
+ |
|
2013 |
+ function silentLandscapeScroll(activeSlide){ |
|
2014 |
+ FP.setScrollingSpeed (0, 'internal'); |
|
2015 |
+ landscapeScroll(activeSlide.closest(SLIDES_WRAPPER_SEL), activeSlide); |
|
2016 |
+ FP.setScrollingSpeed(originals.scrollingSpeed, 'internal'); |
|
2017 |
+ } |
|
2018 |
+ |
|
2019 |
+ function silentScroll(top){ |
|
2020 |
+ if(options.scrollBar){ |
|
2021 |
+ container.scrollTop(top); |
|
2022 |
+ } |
|
2023 |
+ else if (options.css3) { |
|
2024 |
+ var translate3d = 'translate3d(0px, -' + top + 'px, 0px)'; |
|
2025 |
+ transformContainer(translate3d, false); |
|
2026 |
+ } |
|
2027 |
+ else { |
|
2028 |
+ container.css('top', -top); |
|
2029 |
+ } |
|
2030 |
+ } |
|
2031 |
+ |
|
2032 |
+ function getTransforms(translate3d){ |
|
2033 |
+ return { |
|
2034 |
+ '-webkit-transform': translate3d, |
|
2035 |
+ '-moz-transform': translate3d, |
|
2036 |
+ '-ms-transform':translate3d, |
|
2037 |
+ 'transform': translate3d |
|
2038 |
+ }; |
|
2039 |
+ } |
|
2040 |
+ |
|
2041 |
+ function setIsScrollable(value, direction){ |
|
2042 |
+ switch (direction){ |
|
2043 |
+ case 'up': isScrollAllowed.up = value; break; |
|
2044 |
+ case 'down': isScrollAllowed.down = value; break; |
|
2045 |
+ case 'left': isScrollAllowed.left = value; break; |
|
2046 |
+ case 'right': isScrollAllowed.right = value; break; |
|
2047 |
+ case 'all': FP.setAllowScrolling(value); |
|
2048 |
+ } |
|
2049 |
+ } |
|
2050 |
+ |
|
2051 |
+ |
|
2052 |
+ /* |
|
2053 |
+ * Destroys fullpage.js plugin events and optinally its html markup and styles |
|
2054 |
+ */ |
|
2055 |
+ FP.destroy = function(all){ |
|
2056 |
+ FP.setAutoScrolling(false, 'internal'); |
|
2057 |
+ FP.setAllowScrolling(false); |
|
2058 |
+ FP.setKeyboardScrolling(false); |
|
2059 |
+ container.addClass(DESTROYED); |
|
2060 |
+ |
|
2061 |
+ $window |
|
2062 |
+ .off('scroll', scrollHandler) |
|
2063 |
+ .off('hashchange', hashChangeHandler) |
|
2064 |
+ .off('resize', resizeHandler); |
|
2065 |
+ |
|
2066 |
+ $document |
|
2067 |
+ .off('click', SECTION_NAV_SEL + ' a') |
|
2068 |
+ .off('mouseenter', SECTION_NAV_SEL + ' li') |
|
2069 |
+ .off('mouseleave', SECTION_NAV_SEL + ' li') |
|
2070 |
+ .off('click', SLIDES_NAV_LINK_SEL) |
|
2071 |
+ .off('mouseover', options.normalScrollElements) |
|
2072 |
+ .off('mouseout', options.normalScrollElements); |
|
2073 |
+ |
|
2074 |
+ $(SECTION_SEL) |
|
2075 |
+ .off('click', SLIDES_ARROW_SEL); |
|
2076 |
+ |
|
2077 |
+ //lets make a mess! |
|
2078 |
+ if(all){ |
|
2079 |
+ destroyStructure(); |
|
2080 |
+ } |
|
2081 |
+ }; |
|
2082 |
+ |
|
2083 |
+ /* |
|
2084 |
+ * Removes inline styles added by fullpage.js |
|
2085 |
+ */ |
|
2086 |
+ function destroyStructure(){ |
|
2087 |
+ //reseting the `top` or `translate` properties to 0 |
|
2088 |
+ silentScroll(0); |
|
2089 |
+ |
|
2090 |
+ $(SECTION_NAV_SEL + ', ' + SLIDES_NAV_SEL + ', ' + SLIDES_ARROW_SEL).remove(); |
|
2091 |
+ |
|
2092 |
+ //removing inline styles |
|
2093 |
+ $(SECTION_SEL).css( { |
|
2094 |
+ 'height': '', |
|
2095 |
+ 'background-color' : '', |
|
2096 |
+ 'padding': '' |
|
2097 |
+ }); |
|
2098 |
+ |
|
2099 |
+ $(SLIDE_SEL).css( { |
|
2100 |
+ 'width': '' |
|
2101 |
+ }); |
|
2102 |
+ |
|
2103 |
+ container.css({ |
|
2104 |
+ 'height': '', |
|
2105 |
+ 'position': '', |
|
2106 |
+ '-ms-touch-action': '', |
|
2107 |
+ 'touch-action': '' |
|
2108 |
+ }); |
|
2109 |
+ |
|
2110 |
+ //removing added classes |
|
2111 |
+ $(SECTION_SEL + ', ' + SLIDE_SEL).each(function(){ |
|
2112 |
+ removeSlimScroll($(this)); |
|
2113 |
+ $(this).removeClass(TABLE + ' ' + ACTIVE); |
|
2114 |
+ }); |
|
2115 |
+ |
|
2116 |
+ removeAnimation(container); |
|
2117 |
+ |
|
2118 |
+ //Unwrapping content |
|
2119 |
+ container.find(TABLE_CELL_SEL + ', ' + SLIDES_CONTAINER_SEL + ', ' + SLIDES_WRAPPER_SEL).each(function(){ |
|
2120 |
+ //unwrap not being use in case there's no child element inside and its just text |
|
2121 |
+ $(this).replaceWith(this.childNodes); |
|
2122 |
+ }); |
|
2123 |
+ |
|
2124 |
+ //scrolling the page to the top with no animation |
|
2125 |
+ $htmlBody.scrollTop(0); |
|
2126 |
+ } |
|
2127 |
+ |
|
2128 |
+ /* |
|
2129 |
+ * Sets the state for a variable with multiple states (original, and temporal) |
|
2130 |
+ * Some variables such as `autoScrolling` or `recordHistory` might change automatically its state when using `responsive` or `autoScrolling:false`. |
|
2131 |
+ * This function is used to keep track of both states, the original and the temporal one. |
|
2132 |
+ * If type is not 'internal', then we assume the user is globally changing the variable. |
|
2133 |
+ */ |
|
2134 |
+ function setVariableState(variable, value, type){ |
|
2135 |
+ options[variable] = value; |
|
2136 |
+ if(type !== 'internal'){ |
|
2137 |
+ originals[variable] = value; |
|
2138 |
+ } |
|
2139 |
+ } |
|
2140 |
+ |
|
2141 |
+ /** |
|
2142 |
+ * Displays warnings |
|
2143 |
+ */ |
|
2144 |
+ function displayWarnings(){ |
|
2145 |
+ // Disable mutually exclusive settings |
|
2146 |
+ if (options.continuousVertical && |
|
2147 |
+ (options.loopTop || options.loopBottom)) { |
|
2148 |
+ options.continuousVertical = false; |
|
2149 |
+ showError('warn', 'Option `loopTop/loopBottom` is mutually exclusive with `continuousVertical`; `continuousVertical` disabled'); |
|
2150 |
+ } |
|
2151 |
+ if(options.continuousVertical && options.scrollBar){ |
|
2152 |
+ options.continuousVertical = false; |
|
2153 |
+ showError('warn', 'Option `scrollBar` is mutually exclusive with `continuousVertical`; `continuousVertical` disabled'); |
|
2154 |
+ } |
|
2155 |
+ |
|
2156 |
+ //anchors can not have the same value as any element ID or NAME |
|
2157 |
+ $.each(options.anchors, function(index, name){ |
|
2158 |
+ if($('#' + name).length || $('[name="'+name+'"]').length ){ |
|
2159 |
+ showError('error', 'data-anchor tags can not have the same value as any `id` element on the site (or `name` element for IE).'); |
|
2160 |
+ } |
|
2161 |
+ }); |
|
2162 |
+ } |
|
2163 |
+ |
|
2164 |
+ function showError(type, text){ |
|
2165 |
+ console && console[type] && console[type]('fullPage: ' + text); |
|
2166 |
+ } |
|
2167 |
+ }; |
|
2168 |
+})(jQuery, window, document, Math); |
0 | 2169 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,51 @@ |
1 |
+/** |
|
2 |
+ * fullPage 2.6.2 |
|
3 |
+ * https://github.com/alvarotrigo/fullPage.js |
|
4 |
+ * MIT licensed |
|
5 |
+ * |
|
6 |
+ * Copyright (C) 2015 alvarotrigo.com - A project by Alvaro Trigo |
|
7 |
+ */ |
|
8 |
+(function(d,h,k,m,H){var l=d(h),n=d(k);d.fn.fullpage=function(c){function Da(a){a.find(".fp-slides").after('<div class="fp-controlArrow fp-prev"></div><div class="fp-controlArrow fp-next"></div>');"#fff"!=c.controlArrowColor&&(a.find(".fp-controlArrow.fp-next").css("border-color","transparent transparent transparent "+c.controlArrowColor),a.find(".fp-controlArrow.fp-prev").css("border-color","transparent "+c.controlArrowColor+" transparent transparent"));c.loopHorizontal||a.find(".fp-controlArrow.fp-prev").hide()} |
|
9 |
+function Ea(){q.append('<div id="fp-nav"><ul></ul></div>');z=d("#fp-nav");z.addClass(function(){return c.showActiveTooltip?"fp-show-active "+c.navigationPosition:c.navigationPosition});for(var a=0;a<d(".fp-section").length;a++){var b="";c.anchors.length&&(b=c.anchors[a]);var b='<li><a href="#'+b+'"><span></span></a>',g=c.navigationTooltips[a];"undefined"!==typeof g&&""!==g&&(b+='<div class="fp-tooltip '+c.navigationPosition+'">'+g+"</div>");b+="</li>";z.find("ul").append(b)}}function ba(){d(".fp-section").each(function(){var a= |
|
10 |
+d(this).find(".fp-slide");a.length?a.each(function(){I(d(this))}):I(d(this))});d.isFunction(c.afterRender)&&c.afterRender.call(this)}function ca(){var a;if(!c.autoScrolling||c.scrollBar){for(var b=l.scrollTop(),g=0,p=m.abs(b-k.querySelectorAll(".fp-section")[0].offsetTop),e=k.querySelectorAll(".fp-section"),f=0;f<e.length;++f){var h=m.abs(b-e[f].offsetTop);h<p&&(g=f,p=h)}a=d(e).eq(g)}if(!c.autoScrolling||c.scrollBar){if(!a.hasClass("active")){T=!0;b=d(".fp-section.active");g=b.index(".fp-section")+ |
|
11 |
+1;p=U(a);e=a.data("anchor");f=a.index(".fp-section")+1;h=a.find(".fp-slide.active");if(h.length)var n=h.data("anchor"),q=h.index();t&&(a.addClass("active").siblings().removeClass("active"),d.isFunction(c.onLeave)&&c.onLeave.call(b,g,f,p),d.isFunction(c.afterLoad)&&c.afterLoad.call(a,e,f),J(e,f-1),c.anchors.length&&(A=e,V(q,n,e,f)));clearTimeout(da);da=setTimeout(function(){T=!1},100)}c.fitToSection&&(clearTimeout(ea),ea=setTimeout(function(){t&&(d(".fp-section.active").is(a)&&(v=!0),u(a),v=!1)},1E3))}} |
|
12 |
+function fa(a){return a.find(".fp-slides").length?a.find(".fp-slide.active").find(".fp-scrollable"):a.find(".fp-scrollable")}function K(a,b){if(w[a]){var c,d;"down"==a?(c="bottom",d=e.moveSectionDown):(c="top",d=e.moveSectionUp);if(0<b.length)if(c="top"===c?!b.scrollTop():"bottom"===c?b.scrollTop()+1+b.innerHeight()>=b[0].scrollHeight:void 0,c)d();else return!0;else d()}}function Fa(a){var b=a.originalEvent;if(!ga(a.target)&&W(b)){c.autoScrolling&&a.preventDefault();a=d(".fp-section.active");var g= |
|
13 |
+fa(a);t&&!B&&(b=ha(b),E=b.y,L=b.x,a.find(".fp-slides").length&&m.abs(M-L)>m.abs(F-E)?m.abs(M-L)>l.width()/100*c.touchSensitivity&&(M>L?w.right&&e.moveSlideRight():w.left&&e.moveSlideLeft()):c.autoScrolling&&m.abs(F-E)>l.height()/100*c.touchSensitivity&&(F>E?K("down",g):E>F&&K("up",g)))}}function ga(a,b){b=b||0;var g=d(a).parent();return b<c.normalScrollElementTouchThreshold&&g.is(c.normalScrollElements)?!0:b==c.normalScrollElementTouchThreshold?!1:ga(g,++b)}function W(a){return"undefined"===typeof a.pointerType|| |
|
14 |
+"mouse"!=a.pointerType}function Ga(a){a=a.originalEvent;c.fitToSection&&x.stop();W(a)&&(a=ha(a),F=a.y,M=a.x)}function ia(a,b){for(var c=0,d=a.slice(m.max(a.length-b,1)),e=0;e<d.length;e++)c+=d[e];return m.ceil(c/b)}function C(a){var b=(new Date).getTime();if(c.autoScrolling){a=h.event||a;var g=a.wheelDelta||-a.deltaY||-a.detail,p=m.max(-1,m.min(1,g));149<D.length&&D.shift();D.push(m.abs(g));c.scrollBar&&(a.preventDefault?a.preventDefault():a.returnValue=!1);a=d(".fp-section.active");a=fa(a);g=b-ja; |
|
15 |
+ja=b;200<g&&(D=[]);t&&(b=ia(D,10),g=ia(D,70),b>=g&&(0>p?K("down",a):K("up",a)));return!1}c.fitToSection&&x.stop()}function ka(a){var b=d(".fp-section.active").find(".fp-slides");if(b.length&&!B){var g=b.find(".fp-slide.active"),p=null,p="prev"===a?g.prev(".fp-slide"):g.next(".fp-slide");if(!p.length){if(!c.loopHorizontal)return;p="prev"===a?g.siblings(":last"):g.siblings(":first")}B=!0;G(b,p)}}function la(){d(".fp-slide.active").each(function(){X(d(this))})}function u(a,b,g){var p=a.position();if("undefined"!== |
|
16 |
+typeof p&&(b={element:a,callback:b,isMovementUp:g,dest:p,dtop:p.top,yMovement:U(a),anchorLink:a.data("anchor"),sectionIndex:a.index(".fp-section"),activeSlide:a.find(".fp-slide.active"),activeSection:d(".fp-section.active"),leavingSection:d(".fp-section.active").index(".fp-section")+1,localIsResizing:v},!(b.activeSection.is(a)&&!v||c.scrollBar&&l.scrollTop()===b.dtop))){if(b.activeSlide.length)var e=b.activeSlide.data("anchor"),f=b.activeSlide.index();c.autoScrolling&&c.continuousVertical&&"undefined"!== |
|
17 |
+typeof b.isMovementUp&&(!b.isMovementUp&&"up"==b.yMovement||b.isMovementUp&&"down"==b.yMovement)&&(b.isMovementUp?d(".fp-section.active").before(b.activeSection.nextAll(".fp-section")):d(".fp-section.active").after(b.activeSection.prevAll(".fp-section").get().reverse()),y(d(".fp-section.active").position().top),la(),b.wrapAroundElements=b.activeSection,b.dest=b.element.position(),b.dtop=b.dest.top,b.yMovement=U(b.element));a.addClass("active").siblings().removeClass("active");t=!1;V(f,e,b.anchorLink, |
|
18 |
+b.sectionIndex);d.isFunction(c.onLeave)&&!b.localIsResizing&&c.onLeave.call(b.activeSection,b.leavingSection,b.sectionIndex+1,b.yMovement);Ha(b);A=b.anchorLink;J(b.anchorLink,b.sectionIndex)}}function Ha(a){if(c.css3&&c.autoScrolling&&!c.scrollBar)ma("translate3d(0px, -"+a.dtop+"px, 0px)",!0),setTimeout(function(){na(a)},c.scrollingSpeed);else{var b=Ia(a);d(b.element).animate(b.options,c.scrollingSpeed,c.easing).promise().done(function(){na(a)})}}function Ia(a){var b={};c.autoScrolling&&!c.scrollBar? |
|
19 |
+(b.options={top:-a.dtop},b.element=".fullpage-wrapper"):(b.options={scrollTop:a.dtop},b.element="html, body");return b}function Ja(a){a.wrapAroundElements&&a.wrapAroundElements.length&&(a.isMovementUp?d(".fp-section:first").before(a.wrapAroundElements):d(".fp-section:last").after(a.wrapAroundElements),y(d(".fp-section.active").position().top),la())}function na(a){Ja(a);d.isFunction(c.afterLoad)&&!a.localIsResizing&&c.afterLoad.call(a.element,a.anchorLink,a.sectionIndex+1);t=!0;setTimeout(function(){d.isFunction(a.callback)&& |
|
20 |
+a.callback.call(this)},600)}function oa(){if(!T){var a=h.location.hash.replace("#","").split("/"),b=a[0],a=a[1];if(b.length){var c="undefined"===typeof A,d="undefined"===typeof A&&"undefined"===typeof a&&!B;(b&&b!==A&&!c||d||!B&&Y!=a)&&Z(b,a)}}}function Ka(a){t&&(a.pageY<N?e.moveSectionUp():a.pageY>N&&e.moveSectionDown());N=a.pageY}function G(a,b){var g=b.position(),e=b.index(),f=a.closest(".fp-section"),h=f.index(".fp-section"),k=f.data("anchor"),l=f.find(".fp-slidesNav"),m=pa(b),n=v;if(c.onSlideLeave){var q= |
|
21 |
+f.find(".fp-slide.active"),r=q.index(),t;t=r==e?"none":r>e?"left":"right";n||"none"===t||d.isFunction(c.onSlideLeave)&&c.onSlideLeave.call(q,k,h+1,r,t)}b.addClass("active").siblings().removeClass("active");!c.loopHorizontal&&c.controlArrows&&(f.find(".fp-controlArrow.fp-prev").toggle(0!==e),f.find(".fp-controlArrow.fp-next").toggle(!b.is(":last-child")));f.hasClass("active")&&V(e,m,k,h);var u=function(){n||d.isFunction(c.afterSlideLoad)&&c.afterSlideLoad.call(b,k,h+1,m,e);B=!1};c.css3?(g="translate3d(-"+ |
|
22 |
+g.left+"px, 0px, 0px)",qa(a.find(".fp-slidesContainer"),0<c.scrollingSpeed).css(ra(g)),setTimeout(function(){u()},c.scrollingSpeed,c.easing)):a.animate({scrollLeft:g.left},c.scrollingSpeed,c.easing,function(){u()});l.find(".active").removeClass("active");l.find("li").eq(e).find("a").addClass("active")}function sa(){ta();if(O){var a=d(k.activeElement);a.is("textarea")||a.is("input")||a.is("select")||(a=l.height(),m.abs(a-aa)>20*m.max(aa,a)/100&&(e.reBuild(!0),aa=a))}else clearTimeout(ua),ua=setTimeout(function(){e.reBuild(!0)}, |
|
23 |
+500)}function ta(){if(c.responsive){var a=f.hasClass("fp-responsive");l.width()<c.responsive?a||(e.setAutoScrolling(!1,"internal"),e.setFitToSection(!1,"internal"),d("#fp-nav").hide(),f.addClass("fp-responsive")):a&&(e.setAutoScrolling(P.autoScrolling,"internal"),e.setFitToSection(P.autoScrolling,"internal"),d("#fp-nav").show(),f.removeClass("fp-responsive"))}}function qa(a){var b="all "+c.scrollingSpeed+"ms "+c.easingcss3;a.removeClass("fp-notransition");return a.css({"-webkit-transition":b,transition:b})} |
|
24 |
+function La(a,b){if(825>a||900>b){var c=m.min(100*a/825,100*b/900).toFixed(2);q.css("font-size",c+"%")}else q.css("font-size","100%")}function J(a,b){c.menu&&(d(c.menu).find(".active").removeClass("active"),d(c.menu).find('[data-menuanchor="'+a+'"]').addClass("active"));c.navigation&&(d("#fp-nav").find(".active").removeClass("active"),a?d("#fp-nav").find('a[href="#'+a+'"]').addClass("active"):d("#fp-nav").find("li").eq(b).find("a").addClass("active"))}function U(a){var b=d(".fp-section.active").index(".fp-section"); |
|
25 |
+a=a.index(".fp-section");return b==a?"none":b>a?"up":"down"}function I(a){a.css("overflow","hidden");var b=a.closest(".fp-section"),d=a.find(".fp-scrollable"),e;d.length?e=d.get(0).scrollHeight:(e=a.get(0).scrollHeight,c.verticalCentered&&(e=a.find(".fp-tableCell").get(0).scrollHeight));b=r-parseInt(b.css("padding-bottom"))-parseInt(b.css("padding-top"));e>b?d.length?d.css("height",b+"px").parent().css("height",b+"px"):(c.verticalCentered?a.find(".fp-tableCell").wrapInner('<div class="fp-scrollable" />'): |
|
26 |
+a.wrapInner('<div class="fp-scrollable" />'),a.find(".fp-scrollable").slimScroll({allowPageScroll:!0,height:b+"px",size:"10px",alwaysVisible:!0})):va(a);a.css("overflow","")}function va(a){a.find(".fp-scrollable").children().first().unwrap().unwrap();a.find(".slimScrollBar").remove();a.find(".slimScrollRail").remove()}function wa(a){a.addClass("fp-table").wrapInner('<div class="fp-tableCell" style="height:'+xa(a)+'px;" />')}function xa(a){var b=r;if(c.paddingTop||c.paddingBottom)b=a,b.hasClass("fp-section")|| |
|
27 |
+(b=a.closest(".fp-section")),a=parseInt(b.css("padding-top"))+parseInt(b.css("padding-bottom")),b=r-a;return b}function ma(a,b){b?qa(f):f.addClass("fp-notransition");f.css(ra(a));setTimeout(function(){f.removeClass("fp-notransition")},10)}function Z(a,b){var c;"undefined"===typeof b&&(b=0);c=isNaN(a)?d('[data-anchor="'+a+'"]'):d(".fp-section").eq(a-1);a===A||c.hasClass("active")?ya(c,b):u(c,function(){ya(c,b)})}function ya(a,b){if("undefined"!=typeof b){var c=a.find(".fp-slides"),d=c.find('[data-anchor="'+ |
|
28 |
+b+'"]');d.length||(d=c.find(".fp-slide").eq(b));d.length&&G(c,d)}}function Ma(a,b){a.append('<div class="fp-slidesNav"><ul></ul></div>');var d=a.find(".fp-slidesNav");d.addClass(c.slidesNavPosition);for(var e=0;e<b;e++)d.find("ul").append('<li><a href="#"><span></span></a></li>');d.css("margin-left","-"+d.width()/2+"px");d.find("li").first().find("a").addClass("active")}function V(a,b,d,e){e="";c.anchors.length&&(a?("undefined"!==typeof d&&(e=d),"undefined"===typeof b&&(b=a),Y=b,za(e+"/"+b)):("undefined"!== |
|
29 |
+typeof a&&(Y=b),za(d)));Aa()}function za(a){if(c.recordHistory)location.hash=a;else if(O||Q)history.replaceState(H,H,"#"+a);else{var b=h.location.href.split("#")[0];h.location.replace(b+"#"+a)}}function pa(a){var b=a.data("anchor");a=a.index(".fp-slide");"undefined"===typeof b&&(b=a);return b}function Aa(){var a=d(".fp-section.active"),b=a.find(".fp-slide.active"),e=a.data("anchor"),f=pa(b),a=a.index(".fp-section"),a=String(a);c.anchors.length&&(a=e);b.length&&(a=a+"-"+f);a=a.replace("/","-").replace("#", |
|
30 |
+"");q[0].className=q[0].className.replace(RegExp("\\b\\s?fp-viewing-[^\\s]+\\b","g"),"");q.addClass("fp-viewing-"+a)}function Na(){var a=k.createElement("p"),b,c={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};k.body.insertBefore(a,null);for(var d in c)a.style[d]!==H&&(a.style[d]="translate3d(1px,1px,1px)",b=h.getComputedStyle(a).getPropertyValue(c[d]));k.body.removeChild(a);return b!==H&&0<b.length&&"none"!== |
|
31 |
+b}function Oa(){if(O||Q){var a=Ba();n.off("touchstart "+a.down).on("touchstart "+a.down,Ga);n.off("touchmove "+a.move).on("touchmove "+a.move,Fa)}}function Pa(){if(O||Q){var a=Ba();n.off("touchstart "+a.down);n.off("touchmove "+a.move)}}function Ba(){return h.PointerEvent?{down:"pointerdown",move:"pointermove"}:{down:"MSPointerDown",move:"MSPointerMove"}}function ha(a){var b=[];b.y="undefined"!==typeof a.pageY&&(a.pageY||a.pageX)?a.pageY:a.touches[0].pageY;b.x="undefined"!==typeof a.pageX&&(a.pageY|| |
|
32 |
+a.pageX)?a.pageX:a.touches[0].pageX;Q&&W(a)&&(b.y=a.touches[0].pageY,b.x=a.touches[0].pageX);return b}function X(a){e.setScrollingSpeed(0,"internal");G(a.closest(".fp-slides"),a);e.setScrollingSpeed(P.scrollingSpeed,"internal")}function y(a){c.scrollBar?f.scrollTop(a):c.css3?ma("translate3d(0px, -"+a+"px, 0px)",!1):f.css("top",-a)}function ra(a){return{"-webkit-transform":a,"-moz-transform":a,"-ms-transform":a,transform:a}}function Qa(){y(0);d("#fp-nav, .fp-slidesNav, .fp-controlArrow").remove(); |
|
33 |
+d(".fp-section").css({height:"","background-color":"",padding:""});d(".fp-slide").css({width:""});f.css({height:"",position:"","-ms-touch-action":"","touch-action":""});d(".fp-section, .fp-slide").each(function(){va(d(this));d(this).removeClass("fp-table active")});f.addClass("fp-notransition");f.find(".fp-tableCell, .fp-slidesContainer, .fp-slides").each(function(){d(this).replaceWith(this.childNodes)});x.scrollTop(0)}function R(a,b,d){c[a]=b;"internal"!==d&&(P[a]=b)}function S(a,b){console&&console[a]&& |
|
34 |
+console[a]("fullPage: "+b)}var x=d("html, body"),q=d("body"),e=d.fn.fullpage;c=d.extend({menu:!1,anchors:[],navigation:!1,navigationPosition:"right",navigationTooltips:[],showActiveTooltip:!1,slidesNavigation:!1,slidesNavPosition:"bottom",scrollBar:!1,css3:!0,scrollingSpeed:700,autoScrolling:!0,fitToSection:!0,easing:"easeInOutCubic",easingcss3:"ease",loopBottom:!1,loopTop:!1,loopHorizontal:!0,continuousVertical:!1,normalScrollElements:null,scrollOverflow:!1,touchSensitivity:5,normalScrollElementTouchThreshold:5, |
|
35 |
+keyboardScrolling:!0,animateAnchor:!0,recordHistory:!0,controlArrows:!0,controlArrowColor:"#fff",verticalCentered:!0,resize:!1,sectionsColor:[],paddingTop:0,paddingBottom:0,fixedElements:null,responsive:0,sectionSelector:".section",slideSelector:".slide",afterLoad:null,onLeave:null,afterRender:null,afterResize:null,afterReBuild:null,afterSlideLoad:null,onSlideLeave:null},c);(function(){c.continuousVertical&&(c.loopTop||c.loopBottom)&&(c.continuousVertical=!1,S("warn","Option `loopTop/loopBottom` is mutually exclusive with `continuousVertical`; `continuousVertical` disabled")); |
|
36 |
+c.continuousVertical&&c.scrollBar&&(c.continuousVertical=!1,S("warn","Option `scrollBar` is mutually exclusive with `continuousVertical`; `continuousVertical` disabled"));d.each(c.anchors,function(a,b){(d("#"+b).length||d('[name="'+b+'"]').length)&&S("error","data-anchor tags can not have the same value as any `id` element on the site (or `name` element for IE).")})})();d.extend(d.easing,{easeInOutCubic:function(a,b,c,d,e){return 1>(b/=e/2)?d/2*b*b*b+c:d/2*((b-=2)*b*b+2)+c}});d.extend(d.easing,{easeInQuart:function(a, |
|
37 |
+b,c,d,e){return d*(b/=e)*b*b*b+c}});e.setAutoScrolling=function(a,b){R("autoScrolling",a,b);var g=d(".fp-section.active");c.autoScrolling&&!c.scrollBar?(x.css({overflow:"hidden",height:"100%"}),e.setRecordHistory(c.recordHistory,"internal"),f.css({"-ms-touch-action":"none","touch-action":"none"}),g.length&&y(g.position().top)):(x.css({overflow:"visible",height:"initial"}),e.setRecordHistory(!1,"internal"),f.css({"-ms-touch-action":"","touch-action":""}),y(0),g.length&&x.scrollTop(g.position().top))}; |
|
38 |
+e.setRecordHistory=function(a,b){R("recordHistory",a,b)};e.setScrollingSpeed=function(a,b){R("scrollingSpeed",a,b)};e.setFitToSection=function(a,b){R("fitToSection",a,b)};e.setMouseWheelScrolling=function(a){a?k.addEventListener?(k.addEventListener("mousewheel",C,!1),k.addEventListener("wheel",C,!1)):k.attachEvent("onmousewheel",C):k.addEventListener?(k.removeEventListener("mousewheel",C,!1),k.removeEventListener("wheel",C,!1)):k.detachEvent("onmousewheel",C)};e.setAllowScrolling=function(a,b){"undefined"!= |
|
39 |
+typeof b?(b=b.replace(" ","").split(","),d.each(b,function(b,c){switch(c){case "up":w.up=a;break;case "down":w.down=a;break;case "left":w.left=a;break;case "right":w.right=a;break;case "all":e.setAllowScrolling(a)}})):a?(e.setMouseWheelScrolling(!0),Oa()):(e.setMouseWheelScrolling(!1),Pa())};e.setKeyboardScrolling=function(a){c.keyboardScrolling=a};e.moveSectionUp=function(){var a=d(".fp-section.active").prev(".fp-section");a.length||!c.loopTop&&!c.continuousVertical||(a=d(".fp-section").last()); |
|
40 |
+a.length&&u(a,null,!0)};e.moveSectionDown=function(){var a=d(".fp-section.active").next(".fp-section");a.length||!c.loopBottom&&!c.continuousVertical||(a=d(".fp-section").first());a.length&&u(a,null,!1)};e.moveTo=function(a,b){var c="",c=isNaN(a)?d('[data-anchor="'+a+'"]'):d(".fp-section").eq(a-1);"undefined"!==typeof b?Z(a,b):0<c.length&&u(c)};e.moveSlideRight=function(){ka("next")};e.moveSlideLeft=function(){ka("prev")};e.reBuild=function(a){if(!f.hasClass("fp-destroyed")){v=!0;var b=l.width(); |
|
41 |
+r=l.height();c.resize&&La(r,b);d(".fp-section").each(function(){var a=d(this).find(".fp-slides"),b=d(this).find(".fp-slide");c.verticalCentered&&d(this).find(".fp-tableCell").css("height",xa(d(this))+"px");d(this).css("height",r+"px");c.scrollOverflow&&(b.length?b.each(function(){I(d(this))}):I(d(this)));b.length&&G(a,a.find(".fp-slide.active"))});b=d(".fp-section.active");b.index(".fp-section")&&u(b);v=!1;d.isFunction(c.afterResize)&&a&&c.afterResize.call(f);d.isFunction(c.afterReBuild)&&!a&&c.afterReBuild.call(f)}}; |
|
42 |
+var B=!1,O=navigator.userAgent.match(/(iPhone|iPod|iPad|Android|playbook|silk|BlackBerry|BB10|Windows Phone|Tizen|Bada|webOS|IEMobile|Opera Mini)/),Q="ontouchstart"in h||0<navigator.msMaxTouchPoints||navigator.maxTouchPoints,f=d(this),r=l.height(),v=!1,A,Y,t=!0,D=[],z,w={up:!0,down:!0,left:!0,right:!0},P=d.extend(!0,{},c);e.setAllowScrolling(!0);f.removeClass("fp-destroyed");c.css3&&(c.css3=Na());d(this).length?(f.css({height:"100%",position:"relative"}),f.addClass("fullpage-wrapper")):S("error", |
|
43 |
+"Error! Fullpage.js needs to be initialized with a selector. For example: $('#myContainer').fullpage();");d(c.sectionSelector).each(function(){d(this).addClass("fp-section")});d(c.slideSelector).each(function(){d(this).addClass("fp-slide")});c.navigation&&Ea();d(".fp-section").each(function(a){var b=d(this),e=d(this).find(".fp-slide"),f=e.length;a||0!==d(".fp-section.active").length||d(this).addClass("active");d(this).css("height",r+"px");c.paddingTop&&d(this).css("padding-top",c.paddingTop);c.paddingBottom&& |
|
44 |
+d(this).css("padding-bottom",c.paddingBottom);"undefined"!==typeof c.sectionsColor[a]&&d(this).css("background-color",c.sectionsColor[a]);"undefined"!==typeof c.anchors[a]&&(d(this).attr("data-anchor",c.anchors[a]),d(this).hasClass("active")&&J(c.anchors[a],a));if(1<f){a=100*f;var h=100/f;e.wrapAll('<div class="fp-slidesContainer" />');e.parent().wrap('<div class="fp-slides" />');d(this).find(".fp-slidesContainer").css("width",a+"%");c.controlArrows&&Da(d(this));c.slidesNavigation&&Ma(d(this),f); |
|
45 |
+e.each(function(a){d(this).css("width",h+"%");c.verticalCentered&&wa(d(this))});b=b.find(".fp-slide.active");b.length?X(b):e.eq(0).addClass("active")}else c.verticalCentered&&wa(d(this))}).promise().done(function(){e.setAutoScrolling(c.autoScrolling,"internal");var a=d(".fp-section.active").find(".fp-slide.active");a.length&&(0!==d(".fp-section.active").index(".fp-section")||0===d(".fp-section.active").index(".fp-section")&&0!==a.index())&&X(a);c.fixedElements&&c.css3&&d(c.fixedElements).appendTo(q); |
|
46 |
+c.navigation&&(z.css("margin-top","-"+z.height()/2+"px"),z.find("li").eq(d(".fp-section.active").index(".fp-section")).find("a").addClass("active"));c.menu&&c.css3&&d(c.menu).closest(".fullpage-wrapper").length&&d(c.menu).appendTo(q);c.scrollOverflow?("complete"===k.readyState&&ba(),l.on("load",ba)):d.isFunction(c.afterRender)&&c.afterRender.call(f);ta();if(!c.animateAnchor&&(a=h.location.hash.replace("#","").split("/")[0],a.length)){var b=d('[data-anchor="'+a+'"]');b.length&&(c.autoScrolling?y(b.position().top): |
|
47 |
+(y(0),x.scrollTop(b.position().top)),J(a,null),d.isFunction(c.afterLoad)&&c.afterLoad.call(b,a,b.index(".fp-section")+1),b.addClass("active").siblings().removeClass("active"))}Aa();l.on("load",function(){var a=h.location.hash.replace("#","").split("/"),b=a[0],a=a[1];b&&Z(b,a)})});var da,ea,T=!1;l.on("scroll",ca);var F=0,M=0,E=0,L=0,ja=(new Date).getTime();l.on("hashchange",oa);n.keydown(function(a){clearTimeout(Ca);var b=d(k.activeElement);b.is("textarea")||b.is("input")||b.is("select")||!c.keyboardScrolling|| |
|
48 |
+!c.autoScrolling||(-1<d.inArray(a.which,[40,38,32,33,34])&&a.preventDefault(),Ca=setTimeout(function(){var b=a.shiftKey;switch(a.which){case 38:case 33:e.moveSectionUp();break;case 32:if(b){e.moveSectionUp();break}case 40:case 34:e.moveSectionDown();break;case 36:e.moveTo(1);break;case 35:e.moveTo(d(".fp-section").length);break;case 37:e.moveSlideLeft();break;case 39:e.moveSlideRight()}},150))});var Ca;f.mousedown(function(a){2==a.which&&(N=a.pageY,f.on("mousemove",Ka))});f.mouseup(function(a){2== |
|
49 |
+a.which&&f.off("mousemove")});var N=0;n.on("click touchstart","#fp-nav a",function(a){a.preventDefault();a=d(this).parent().index();u(d(".fp-section").eq(a))});n.on("click touchstart",".fp-slidesNav a",function(a){a.preventDefault();a=d(this).closest(".fp-section").find(".fp-slides");var b=a.find(".fp-slide").eq(d(this).closest("li").index());G(a,b)});c.normalScrollElements&&(n.on("mouseenter",c.normalScrollElements,function(){e.setMouseWheelScrolling(!1)}),n.on("mouseleave",c.normalScrollElements, |
|
50 |
+function(){e.setMouseWheelScrolling(!0)}));d(".fp-section").on("click touchstart",".fp-controlArrow",function(){d(this).hasClass("fp-prev")?e.moveSlideLeft():e.moveSlideRight()});l.resize(sa);var aa=r,ua;e.destroy=function(a){e.setAutoScrolling(!1,"internal");e.setAllowScrolling(!1);e.setKeyboardScrolling(!1);f.addClass("fp-destroyed");l.off("scroll",ca).off("hashchange",oa).off("resize",sa);n.off("click","#fp-nav a").off("mouseenter","#fp-nav li").off("mouseleave","#fp-nav li").off("click",".fp-slidesNav a").off("mouseover", |
|
51 |
+c.normalScrollElements).off("mouseout",c.normalScrollElements);d(".fp-section").off("click",".fp-controlArrow");a&&Qa()}}})(jQuery,window,document,Math); |
0 | 52 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,6 @@ |
1 |
+/*! jQuery UI - v1.9.2 - 2014-03-21 |
|
2 |
+* http://jqueryui.com |
|
3 |
+* Includes: jquery.ui.effect.js |
|
4 |
+* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */ |
|
5 |
+ |
|
6 |
+jQuery.effects||function(e,t){var i=e.uiBackCompat!==!1,a="ui-effects-";e.effects={effect:{}},function(t,i){function a(e,t,i){var a=c[t.type]||{};return null==e?i||!t.def?null:t.def:(e=a.floor?~~e:parseFloat(e),isNaN(e)?t.def:a.mod?(e+a.mod)%a.mod:0>e?0:e>a.max?a.max:e)}function s(e){var a=u(),s=a._rgba=[];return e=e.toLowerCase(),m(l,function(t,n){var r,o=n.re.exec(e),h=o&&n.parse(o),l=n.space||"rgba";return h?(r=a[l](h),a[d[l].cache]=r[d[l].cache],s=a._rgba=r._rgba,!1):i}),s.length?("0,0,0,0"===s.join()&&t.extend(s,r.transparent),a):r[e]}function n(e,t,i){return i=(i+1)%1,1>6*i?e+6*(t-e)*i:1>2*i?t:2>3*i?e+6*(t-e)*(2/3-i):e}var r,o="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor".split(" "),h=/^([\-+])=\s*(\d+\.?\d*)/,l=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],u=t.Color=function(e,i,a,s){return new t.Color.fn.parse(e,i,a,s)},d={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},c={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},p=u.support={},f=t("<p>")[0],m=t.each;f.style.cssText="background-color:rgba(1,1,1,.5)",p.rgba=f.style.backgroundColor.indexOf("rgba")>-1,m(d,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),u.fn=t.extend(u.prototype,{parse:function(n,o,h,l){if(n===i)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=t(n).css(o),o=i);var c=this,p=t.type(n),f=this._rgba=[];return o!==i&&(n=[n,o,h,l],p="array"),"string"===p?this.parse(s(n)||r._default):"array"===p?(m(d.rgba.props,function(e,t){f[t.idx]=a(n[t.idx],t)}),this):"object"===p?(n instanceof u?m(d,function(e,t){n[t.cache]&&(c[t.cache]=n[t.cache].slice())}):m(d,function(t,i){var s=i.cache;m(i.props,function(e,t){if(!c[s]&&i.to){if("alpha"===e||null==n[e])return;c[s]=i.to(c._rgba)}c[s][t.idx]=a(n[e],t,!0)}),c[s]&&0>e.inArray(null,c[s].slice(0,3))&&(c[s][3]=1,i.from&&(c._rgba=i.from(c[s])))}),this):i},is:function(e){var t=u(e),a=!0,s=this;return m(d,function(e,n){var r,o=t[n.cache];return o&&(r=s[n.cache]||n.to&&n.to(s._rgba)||[],m(n.props,function(e,t){return null!=o[t.idx]?a=o[t.idx]===r[t.idx]:i})),a}),a},_space:function(){var e=[],t=this;return m(d,function(i,a){t[a.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var i=u(e),s=i._space(),n=d[s],r=0===this.alpha()?u("transparent"):this,o=r[n.cache]||n.to(r._rgba),h=o.slice();return i=i[n.cache],m(n.props,function(e,s){var n=s.idx,r=o[n],l=i[n],u=c[s.type]||{};null!==l&&(null===r?h[n]=l:(u.mod&&(l-r>u.mod/2?r+=u.mod:r-l>u.mod/2&&(r-=u.mod)),h[n]=a((l-r)*t+r,s)))}),this[s](h)},blend:function(e){if(1===this._rgba[3])return this;var i=this._rgba.slice(),a=i.pop(),s=u(e)._rgba;return u(t.map(i,function(e,t){return(1-a)*s[t]+a*e}))},toRgbaString:function(){var e="rgba(",i=t.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),e="rgb("),e+i.join()+")"},toHslaString:function(){var e="hsla(",i=t.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop(),e="hsl("),e+i.join()+")"},toHexString:function(e){var i=this._rgba.slice(),a=i.pop();return e&&i.push(~~(255*a)),"#"+t.map(i,function(e){return e=(e||0).toString(16),1===e.length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),u.fn.parse.prototype=u.fn,d.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,a=e[0]/255,s=e[1]/255,n=e[2]/255,r=e[3],o=Math.max(a,s,n),h=Math.min(a,s,n),l=o-h,u=o+h,d=.5*u;return t=h===o?0:a===o?60*(s-n)/l+360:s===o?60*(n-a)/l+120:60*(a-s)/l+240,i=0===d||1===d?d:.5>=d?l/u:l/(2-u),[Math.round(t)%360,i,d,null==r?1:r]},d.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],a=e[2],s=e[3],r=.5>=a?a*(1+i):a+i-a*i,o=2*a-r;return[Math.round(255*n(o,r,t+1/3)),Math.round(255*n(o,r,t)),Math.round(255*n(o,r,t-1/3)),s]},m(d,function(e,s){var n=s.props,r=s.cache,o=s.to,l=s.from;u.fn[e]=function(e){if(o&&!this[r]&&(this[r]=o(this._rgba)),e===i)return this[r].slice();var s,h=t.type(e),d="array"===h||"object"===h?e:arguments,c=this[r].slice();return m(n,function(e,t){var i=d["object"===h?e:t.idx];null==i&&(i=c[t.idx]),c[t.idx]=a(i,t)}),l?(s=u(l(c)),s[r]=c,s):u(c)},m(n,function(i,a){u.fn[i]||(u.fn[i]=function(s){var n,r=t.type(s),o="alpha"===i?this._hsla?"hsla":"rgba":e,l=this[o](),u=l[a.idx];return"undefined"===r?u:("function"===r&&(s=s.call(this,u),r=t.type(s)),null==s&&a.empty?this:("string"===r&&(n=h.exec(s),n&&(s=u+parseFloat(n[2])*("+"===n[1]?1:-1))),l[a.idx]=s,this[o](l)))})})}),m(o,function(e,i){t.cssHooks[i]={set:function(e,a){var n,r,o="";if("string"!==t.type(a)||(n=s(a))){if(a=u(n||a),!p.rgba&&1!==a._rgba[3]){for(r="backgroundColor"===i?e.parentNode:e;(""===o||"transparent"===o)&&r&&r.style;)try{o=t.css(r,"backgroundColor"),r=r.parentNode}catch(h){}a=a.blend(o&&"transparent"!==o?o:"_default")}a=a.toRgbaString()}try{e.style[i]=a}catch(l){}}},t.fx.step[i]=function(e){e.colorInit||(e.start=u(e.elem,i),e.end=u(e.end),e.colorInit=!0),t.cssHooks[i].set(e.elem,e.start.transition(e.end,e.pos))}}),t.cssHooks.borderColor={expand:function(e){var t={};return m(["Top","Right","Bottom","Left"],function(i,a){t["border"+a+"Color"]=e}),t}},r=t.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(){function i(){var t,i,a=this.ownerDocument.defaultView?this.ownerDocument.defaultView.getComputedStyle(this,null):this.currentStyle,s={};if(a&&a.length&&a[0]&&a[a[0]])for(i=a.length;i--;)t=a[i],"string"==typeof a[t]&&(s[e.camelCase(t)]=a[t]);else for(t in a)"string"==typeof a[t]&&(s[t]=a[t]);return s}function a(t,i){var a,s,r={};for(a in i)s=i[a],t[a]!==s&&(n[a]||(e.fx.step[a]||!isNaN(parseFloat(s)))&&(r[a]=s));return r}var s=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,i){e.fx.step[i]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(jQuery.style(e.elem,i,e.end),e.setAttr=!0)}}),e.effects.animateClass=function(t,n,r,o){var h=e.speed(n,r,o);return this.queue(function(){var n,r=e(this),o=r.attr("class")||"",l=h.children?r.find("*").andSelf():r;l=l.map(function(){var t=e(this);return{el:t,start:i.call(this)}}),n=function(){e.each(s,function(e,i){t[i]&&r[i+"Class"](t[i])})},n(),l=l.map(function(){return this.end=i.call(this.el[0]),this.diff=a(this.start,this.end),this}),r.attr("class",o),l=l.map(function(){var t=this,i=e.Deferred(),a=jQuery.extend({},h,{queue:!1,complete:function(){i.resolve(t)}});return this.el.animate(this.diff,a),i.promise()}),e.when.apply(e,l.get()).done(function(){n(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),h.complete.call(r[0])})})},e.fn.extend({_addClass:e.fn.addClass,addClass:function(t,i,a,s){return i?e.effects.animateClass.call(this,{add:t},i,a,s):this._addClass(t)},_removeClass:e.fn.removeClass,removeClass:function(t,i,a,s){return i?e.effects.animateClass.call(this,{remove:t},i,a,s):this._removeClass(t)},_toggleClass:e.fn.toggleClass,toggleClass:function(i,a,s,n,r){return"boolean"==typeof a||a===t?s?e.effects.animateClass.call(this,a?{add:i}:{remove:i},s,n,r):this._toggleClass(i,a):e.effects.animateClass.call(this,{toggle:i},a,s,n)},switchClass:function(t,i,a,s,n){return e.effects.animateClass.call(this,{add:i,remove:t},a,s,n)}})}(),function(){function s(t,i,a,s){return e.isPlainObject(t)&&(i=t,t=t.effect),t={effect:t},null==i&&(i={}),e.isFunction(i)&&(s=i,a=null,i={}),("number"==typeof i||e.fx.speeds[i])&&(s=a,a=i,i={}),e.isFunction(a)&&(s=a,a=null),i&&e.extend(t,i),a=a||i.duration,t.duration=e.fx.off?0:"number"==typeof a?a:a in e.fx.speeds?e.fx.speeds[a]:e.fx.speeds._default,t.complete=s||i.complete,t}function n(t){return!t||"number"==typeof t||e.fx.speeds[t]?!0:"string"!=typeof t||e.effects.effect[t]?!1:i&&e.effects[t]?!1:!0}e.extend(e.effects,{version:"1.9.2",save:function(e,t){for(var i=0;t.length>i;i++)null!==t[i]&&e.data(a+t[i],e[0].style[t[i]])},restore:function(e,i){var s,n;for(n=0;i.length>n;n++)null!==i[n]&&(s=e.data(a+i[n]),s===t&&(s=""),e.css(i[n],s))},setMode:function(e,t){return"toggle"===t&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var i,a;switch(e[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=e[0]/t.height}switch(e[1]){case"left":a=0;break;case"center":a=.5;break;case"right":a=1;break;default:a=e[1]/t.width}return{x:a,y:i}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var i={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},a=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),s={width:t.width(),height:t.height()},n=document.activeElement;try{n.id}catch(r){n=document.body}return t.wrap(a),(t[0]===n||e.contains(t[0],n))&&e(n).focus(),a=t.parent(),"static"===t.css("position")?(a.css({position:"relative"}),t.css({position:"relative"})):(e.extend(i,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,a){i[a]=t.css(a),isNaN(parseInt(i[a],10))&&(i[a]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(s),a.css(i).show()},removeWrapper:function(t){var i=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===i||e.contains(t[0],i))&&e(i).focus()),t},setTransition:function(t,i,a,s){return s=s||{},e.each(i,function(e,i){var n=t.cssUnit(i);n[0]>0&&(s[i]=n[0]*a+n[1])}),s}}),e.fn.extend({effect:function(){function t(t){function i(){e.isFunction(n)&&n.call(s[0]),e.isFunction(t)&&t()}var s=e(this),n=a.complete,r=a.mode;(s.is(":hidden")?"hide"===r:"show"===r)?i():o.call(s[0],a,i)}var a=s.apply(this,arguments),n=a.mode,r=a.queue,o=e.effects.effect[a.effect],h=!o&&i&&e.effects[a.effect];return e.fx.off||!o&&!h?n?this[n](a.duration,a.complete):this.each(function(){a.complete&&a.complete.call(this)}):o?r===!1?this.each(t):this.queue(r||"fx",t):h.call(this,{options:a,duration:a.duration,callback:a.complete,mode:a.mode})},_show:e.fn.show,show:function(e){if(n(e))return this._show.apply(this,arguments);var t=s.apply(this,arguments);return t.mode="show",this.effect.call(this,t)},_hide:e.fn.hide,hide:function(e){if(n(e))return this._hide.apply(this,arguments);var t=s.apply(this,arguments);return t.mode="hide",this.effect.call(this,t)},__toggle:e.fn.toggle,toggle:function(t){if(n(t)||"boolean"==typeof t||e.isFunction(t))return this.__toggle.apply(this,arguments);var i=s.apply(this,arguments);return i.mode="toggle",this.effect.call(this,i)},cssUnit:function(t){var i=this.css(t),a=[];return e.each(["em","px","%","pt"],function(e,t){i.indexOf(t)>0&&(a=[parseFloat(i),t])}),a}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,i){t[i]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,i=4;((t=Math.pow(2,--i))-1)/11>e;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*t-2)/22-e,2)}}),e.each(t,function(t,i){e.easing["easeIn"+t]=i,e.easing["easeOut"+t]=function(e){return 1-i(1-e)},e.easing["easeInOut"+t]=function(e){return.5>e?i(2*e)/2:1-i(-2*e+2)/2}})}()}(jQuery); |
0 | 7 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,497 @@ |
1 |
+/*! Copyright (c) 2011 Piotr Rochala (http://rocha.la) |
|
2 |
+ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) |
|
3 |
+ * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. |
|
4 |
+ * |
|
5 |
+ * Version: 1.3.2 (modified for fullpage.js) |
|
6 |
+ * |
|
7 |
+ */ |
|
8 |
+(function($) { |
|
9 |
+ |
|
10 |
+ jQuery.fn.extend({ |
|
11 |
+ slimScroll: function(options) { |
|
12 |
+ |
|
13 |
+ var defaults = { |
|
14 |
+ |
|
15 |
+ // width in pixels of the visible scroll area |
|
16 |
+ width : 'auto', |
|
17 |
+ |
|
18 |
+ // height in pixels of the visible scroll area |
|
19 |
+ height : '250px', |
|
20 |
+ |
|
21 |
+ // width in pixels of the scrollbar and rail |
|
22 |
+ size : '7px', |
|
23 |
+ |
|
24 |
+ // scrollbar color, accepts any hex/color value |
|
25 |
+ color: '#000', |
|
26 |
+ |
|
27 |
+ // scrollbar position - left/right |
|
28 |
+ position : 'right', |
|
29 |
+ |
|
30 |
+ // distance in pixels between the side edge and the scrollbar |
|
31 |
+ distance : '1px', |
|
32 |
+ |
|
33 |
+ // default scroll position on load - top / bottom / $('selector') |
|
34 |
+ start : 'top', |
|
35 |
+ |
|
36 |
+ // sets scrollbar opacity |
|
37 |
+ opacity : .4, |
|
38 |
+ |
|
39 |
+ // enables always-on mode for the scrollbar |
|
40 |
+ alwaysVisible : false, |
|
41 |
+ |
|
42 |
+ // check if we should hide the scrollbar when user is hovering over |
|
43 |
+ disableFadeOut : false, |
|
44 |
+ |
|
45 |
+ // sets visibility of the rail |
|
46 |
+ railVisible : false, |
|
47 |
+ |
|
48 |
+ // sets rail color |
|
49 |
+ railColor : '#333', |
|
50 |
+ |
|
51 |
+ // sets rail opacity |
|
52 |
+ railOpacity : .2, |
|
53 |
+ |
|
54 |
+ // whether we should use jQuery UI Draggable to enable bar dragging |
|
55 |
+ railDraggable : true, |
|
56 |
+ |
|
57 |
+ // defautlt CSS class of the slimscroll rail |
|
58 |
+ railClass : 'slimScrollRail', |
|
59 |
+ |
|
60 |
+ // defautlt CSS class of the slimscroll bar |
|
61 |
+ barClass : 'slimScrollBar', |
|
62 |
+ |
|
63 |
+ // defautlt CSS class of the slimscroll wrapper |
|
64 |
+ wrapperClass : 'slimScrollDiv', |
|
65 |
+ |
|
66 |
+ // check if mousewheel should scroll the window if we reach top/bottom |
|
67 |
+ allowPageScroll : false, |
|
68 |
+ |
|
69 |
+ // scroll amount applied to each mouse wheel step |
|
70 |
+ wheelStep : 20, |
|
71 |
+ |
|
72 |
+ // scroll amount applied when user is using gestures |
|
73 |
+ touchScrollStep : 200, |
|
74 |
+ |
|
75 |
+ // sets border radius |
|
76 |
+ borderRadius: '7px', |
|
77 |
+ |
|
78 |
+ // sets border radius of the rail |
|
79 |
+ railBorderRadius : '7px' |
|
80 |
+ }; |
|
81 |
+ |
|
82 |
+ var o = $.extend(defaults, options); |
|
83 |
+ |
|
84 |
+ // do it for every element that matches selector |
|
85 |
+ this.each(function(){ |
|
86 |
+ |
|
87 |
+ var isOverPanel, isOverBar, isDragg, queueHide, touchDif, |
|
88 |
+ barHeight, percentScroll, lastScroll, |
|
89 |
+ divS = '<div></div>', |
|
90 |
+ minBarHeight = 30, |
|
91 |
+ releaseScroll = false; |
|
92 |
+ |
|
93 |
+ // used in event handlers and for better minification |
|
94 |
+ var me = $(this); |
|
95 |
+ |
|
96 |
+ // ensure we are not binding it again |
|
97 |
+ if (me.parent().hasClass(o.wrapperClass)) |
|
98 |
+ { |
|
99 |
+ // start from last bar position |
|
100 |
+ var offset = me.scrollTop(); |
|
101 |
+ |
|
102 |
+ // find bar and rail |
|
103 |
+ bar = me.parent().find('.' + o.barClass); |
|
104 |
+ rail = me.parent().find('.' + o.railClass); |
|
105 |
+ |
|
106 |
+ getBarHeight(); |
|
107 |
+ |
|
108 |
+ // check if we should scroll existing instance |
|
109 |
+ if ($.isPlainObject(options)) |
|
110 |
+ { |
|
111 |
+ // Pass height: auto to an existing slimscroll object to force a resize after contents have changed |
|
112 |
+ if ( 'height' in options && options.height == 'auto' ) { |
|
113 |
+ me.parent().css('height', 'auto'); |
|
114 |
+ me.css('height', 'auto'); |
|
115 |
+ var height = me.parent().parent().height(); |
|
116 |
+ me.parent().css('height', height); |
|
117 |
+ me.css('height', height); |
|
118 |
+ } |
|
119 |
+ |
|
120 |
+ if ('scrollTo' in options) |
|
121 |
+ { |
|
122 |
+ // jump to a static point |
|
123 |
+ offset = parseInt(o.scrollTo); |
|
124 |
+ } |
|
125 |
+ else if ('scrollBy' in options) |
|
126 |
+ { |
|
127 |
+ // jump by value pixels |
|
128 |
+ offset += parseInt(o.scrollBy); |
|
129 |
+ } |
|
130 |
+ else if ('destroy' in options) |
|
131 |
+ { |
|
132 |
+ // clear slimscroll mouse event listeners |
|
133 |
+ detachWheel(); |
|
134 |
+ |
|
135 |
+ // remove slimscroll elements |
|
136 |
+ bar.remove(); |
|
137 |
+ rail.remove(); |
|
138 |
+ me.unwrap(); |
|
139 |
+ return; |
|
140 |
+ } |
|
141 |
+ |
|
142 |
+ // scroll content by the given offset |
|
143 |
+ scrollContent(offset, false, true); |
|
144 |
+ } |
|
145 |
+ |
|
146 |
+ return; |
|
147 |
+ } |
|
148 |
+ |
|
149 |
+ // optionally set height to the parent's height |
|
150 |
+ o.height = (options.height == 'auto') ? me.parent().height() : options.height; |
|
151 |
+ |
|
152 |
+ // wrap content |
|
153 |
+ var wrapper = $(divS) |
|
154 |
+ .addClass(o.wrapperClass) |
|
155 |
+ .css({ |
|
156 |
+ position: 'relative', |
|
157 |
+ overflow: 'hidden', |
|
158 |
+ width: o.width, |
|
159 |
+ height: o.height |
|
160 |
+ }); |
|
161 |
+ |
|
162 |
+ // update style for the div |
|
163 |
+ me.css({ |
|
164 |
+ overflow: 'hidden', |
|
165 |
+ width: o.width, |
|
166 |
+ height: o.height |
|
167 |
+ }); |
|
168 |
+ |
|
169 |
+ // create scrollbar rail |
|
170 |
+ var rail = $(divS) |
|
171 |
+ .addClass(o.railClass) |
|
172 |
+ .css({ |
|
173 |
+ width: o.size, |
|
174 |
+ height: '100%', |
|
175 |
+ position: 'absolute', |
|
176 |
+ top: 0, |
|
177 |
+ display: (o.alwaysVisible && o.railVisible) ? 'block' : 'none', |
|
178 |
+ 'border-radius': o.railBorderRadius, |
|
179 |
+ background: o.railColor, |
|
180 |
+ opacity: o.railOpacity, |
|
181 |
+ zIndex: 90 |
|
182 |
+ }); |
|
183 |
+ |
|
184 |
+ // create scrollbar |
|
185 |
+ var bar = $(divS) |
|
186 |
+ .addClass(o.barClass) |
|
187 |
+ .css({ |
|
188 |
+ background: o.color, |
|
189 |
+ width: o.size, |
|
190 |
+ position: 'absolute', |
|
191 |
+ top: 0, |
|
192 |
+ opacity: o.opacity, |
|
193 |
+ display: o.alwaysVisible ? 'block' : 'none', |
|
194 |
+ 'border-radius' : o.borderRadius, |
|
195 |
+ BorderRadius: o.borderRadius, |
|
196 |
+ MozBorderRadius: o.borderRadius, |
|
197 |
+ WebkitBorderRadius: o.borderRadius, |
|
198 |
+ zIndex: 99 |
|
199 |
+ }); |
|
200 |
+ |
|
201 |
+ // set position |
|
202 |
+ var posCss = (o.position == 'right') ? { right: o.distance } : { left: o.distance }; |
|
203 |
+ rail.css(posCss); |
|
204 |
+ bar.css(posCss); |
|
205 |
+ |
|
206 |
+ // wrap it |
|
207 |
+ me.wrap(wrapper); |
|
208 |
+ |
|
209 |
+ // append to parent div |
|
210 |
+ me.parent().append(bar); |
|
211 |
+ me.parent().append(rail); |
|
212 |
+ |
|
213 |
+ // make it draggable and no longer dependent on the jqueryUI |
|
214 |
+ if (o.railDraggable){ |
|
215 |
+ bar.bind("mousedown", function(e) { |
|
216 |
+ var $doc = $(document); |
|
217 |
+ isDragg = true; |
|
218 |
+ t = parseFloat(bar.css('top')); |
|
219 |
+ pageY = e.pageY; |
|
220 |
+ |
|
221 |
+ $doc.bind("mousemove.slimscroll", function(e){ |
|
222 |
+ currTop = t + e.pageY - pageY; |
|
223 |
+ bar.css('top', currTop); |
|
224 |
+ scrollContent(0, bar.position().top, false);// scroll content |
|
225 |
+ }); |
|
226 |
+ |
|
227 |
+ $doc.bind("mouseup.slimscroll", function(e) { |
|
228 |
+ isDragg = false;hideBar(); |
|
229 |
+ $doc.unbind('.slimscroll'); |
|
230 |
+ }); |
|
231 |
+ return false; |
|
232 |
+ }).bind("selectstart.slimscroll", function(e){ |
|
233 |
+ e.stopPropagation(); |
|
234 |
+ e.preventDefault(); |
|
235 |
+ return false; |
|
236 |
+ }); |
|
237 |
+ } |
|
238 |
+ |
|
239 |
+ // on rail over |
|
240 |
+ rail.hover(function(){ |
|
241 |
+ showBar(); |
|
242 |
+ }, function(){ |
|
243 |
+ hideBar(); |
|
244 |
+ }); |
|
245 |
+ |
|
246 |
+ // on bar over |
|
247 |
+ bar.hover(function(){ |
|
248 |
+ isOverBar = true; |
|
249 |
+ }, function(){ |
|
250 |
+ isOverBar = false; |
|
251 |
+ }); |
|
252 |
+ |
|
253 |
+ // allow scrolling on page load |
|
254 |
+ // based on hack in http://stackoverflow.com/a/6593995/1547641 |
|
255 |
+ // Chrome seems to return an rgba() value while other browsers return |
|
256 |
+ // the "transparent" value. |
|
257 |
+ if ( |
|
258 |
+ |
|
259 |
+ me.css('background-color') == 'transparent' || |
|
260 |
+ me.css('background-color') == 'rgba(0, 0, 0, 0)' |
|
261 |
+ ) { |
|
262 |
+ isOverPanel = true; |
|
263 |
+ showBar(); |
|
264 |
+ hideBar(); |
|
265 |
+ } |
|
266 |
+ else { |
|
267 |
+ isOverPanel = false; |
|
268 |
+ hideBar(); |
|
269 |
+ } |
|
270 |
+ |
|
271 |
+ // show on parent mouseover |
|
272 |
+ me.hover(function(){ |
|
273 |
+ isOverPanel = true; |
|
274 |
+ showBar(); |
|
275 |
+ hideBar(); |
|
276 |
+ }, function(){ |
|
277 |
+ isOverPanel = false; |
|
278 |
+ hideBar(); |
|
279 |
+ }); |
|
280 |
+ |
|
281 |
+ // support for mobile |
|
282 |
+ me.bind('touchstart', function(e,b){ |
|
283 |
+ if (e.originalEvent.touches.length) |
|
284 |
+ { |
|
285 |
+ // record where touch started |
|
286 |
+ touchDif = e.originalEvent.touches[0].pageY; |
|
287 |
+ } |
|
288 |
+ }); |
|
289 |
+ |
|
290 |
+ me.bind('touchmove', function(e){ |
|
291 |
+ // prevent scrolling the page if necessary |
|
292 |
+ if(!releaseScroll) |
|
293 |
+ { |
|
294 |
+ e.originalEvent.preventDefault(); |
|
295 |
+ } |
|
296 |
+ if (e.originalEvent.touches.length) |
|
297 |
+ { |
|
298 |
+ // see how far user swiped |
|
299 |
+ var diff = (touchDif - e.originalEvent.touches[0].pageY) / o.touchScrollStep; |
|
300 |
+ // scroll content |
|
301 |
+ scrollContent(diff, true); |
|
302 |
+ touchDif = e.originalEvent.touches[0].pageY; |
|
303 |
+ } |
|
304 |
+ }); |
|
305 |
+ |
|
306 |
+ // set up initial height |
|
307 |
+ getBarHeight(); |
|
308 |
+ |
|
309 |
+ // check start position |
|
310 |
+ if (o.start === 'bottom') |
|
311 |
+ { |
|
312 |
+ // scroll content to bottom |
|
313 |
+ bar.css({ top: me.outerHeight() - bar.outerHeight() }); |
|
314 |
+ scrollContent(0, true); |
|
315 |
+ } |
|
316 |
+ else if (o.start !== 'top') |
|
317 |
+ { |
|
318 |
+ // assume jQuery selector |
|
319 |
+ scrollContent($(o.start).position().top, null, true); |
|
320 |
+ |
|
321 |
+ // make sure bar stays hidden |
|
322 |
+ if (!o.alwaysVisible) { bar.hide(); } |
|
323 |
+ } |
|
324 |
+ |
|
325 |
+ // attach scroll events |
|
326 |
+ attachWheel(); |
|
327 |
+ |
|
328 |
+ function _onWheel(e) |
|
329 |
+ { |
|
330 |
+ // use mouse wheel only when mouse is over |
|
331 |
+ if (!isOverPanel) { return; } |
|
332 |
+ |
|
333 |
+ var e = e || window.event; |
|
334 |
+ |
|
335 |
+ var delta = 0; |
|
336 |
+ if (e.wheelDelta) { delta = -e.wheelDelta/120; } |
|
337 |
+ if (e.detail) { delta = e.detail / 3; } |
|
338 |
+ |
|
339 |
+ var target = e.target || e.srcTarget || e.srcElement; |
|
340 |
+ if ($(target).closest('.' + o.wrapperClass).is(me.parent())) { |
|
341 |
+ // scroll content |
|
342 |
+ scrollContent(delta, true); |
|
343 |
+ } |
|
344 |
+ |
|
345 |
+ // stop window scroll |
|
346 |
+ if (e.preventDefault && !releaseScroll) { e.preventDefault(); } |
|
347 |
+ if (!releaseScroll) { e.returnValue = false; } |
|
348 |
+ } |
|
349 |
+ |
|
350 |
+ function scrollContent(y, isWheel, isJump) |
|
351 |
+ { |
|
352 |
+ releaseScroll = false; |
|
353 |
+ var delta = y; |
|
354 |
+ var maxTop = me.outerHeight() - bar.outerHeight(); |
|
355 |
+ |
|
356 |
+ if (isWheel) |
|
357 |
+ { |
|
358 |
+ // move bar with mouse wheel |
|
359 |
+ delta = parseInt(bar.css('top')) + y * parseInt(o.wheelStep) / 100 * bar.outerHeight(); |
|
360 |
+ |
|
361 |
+ // move bar, make sure it doesn't go out |
|
362 |
+ delta = Math.min(Math.max(delta, 0), maxTop); |
|
363 |
+ |
|
364 |
+ // if scrolling down, make sure a fractional change to the |
|
365 |
+ // scroll position isn't rounded away when the scrollbar's CSS is set |
|
366 |
+ // this flooring of delta would happened automatically when |
|
367 |
+ // bar.css is set below, but we floor here for clarity |
|
368 |
+ delta = (y > 0) ? Math.ceil(delta) : Math.floor(delta); |
|
369 |
+ |
|
370 |
+ // scroll the scrollbar |
|
371 |
+ bar.css({ top: delta + 'px' }); |
|
372 |
+ } |
|
373 |
+ |
|
374 |
+ // calculate actual scroll amount |
|
375 |
+ percentScroll = parseInt(bar.css('top')) / (me.outerHeight() - bar.outerHeight()); |
|
376 |
+ delta = percentScroll * (me[0].scrollHeight - me.outerHeight()); |
|
377 |
+ |
|
378 |
+ if (isJump) |
|
379 |
+ { |
|
380 |
+ delta = y; |
|
381 |
+ var offsetTop = delta / me[0].scrollHeight * me.outerHeight(); |
|
382 |
+ offsetTop = Math.min(Math.max(offsetTop, 0), maxTop); |
|
383 |
+ bar.css({ top: offsetTop + 'px' }); |
|
384 |
+ } |
|
385 |
+ |
|
386 |
+ // scroll content |
|
387 |
+ me.scrollTop(delta); |
|
388 |
+ |
|
389 |
+ // fire scrolling event |
|
390 |
+ me.trigger('slimscrolling', ~~delta); |
|
391 |
+ |
|
392 |
+ // ensure bar is visible |
|
393 |
+ showBar(); |
|
394 |
+ |
|
395 |
+ // trigger hide when scroll is stopped |
|
396 |
+ hideBar(); |
|
397 |
+ } |
|
398 |
+ |
|
399 |
+ function attachWheel() |
|
400 |
+ { |
|
401 |
+ if (window.addEventListener) |
|
402 |
+ { |
|
403 |
+ this.addEventListener('DOMMouseScroll', _onWheel, false ); |
|
404 |
+ this.addEventListener('mousewheel', _onWheel, false ); |
|
405 |
+ } |
|
406 |
+ else |
|
407 |
+ { |
|
408 |
+ document.attachEvent("onmousewheel", _onWheel) |
|
409 |
+ } |
|
410 |
+ } |
|
411 |
+ |
|
412 |
+ function detachWheel() |
|
413 |
+ { |
|
414 |
+ if (window.removeEventListener) |
|
415 |
+ { |
|
416 |
+ this.removeEventListener('DOMMouseScroll', _onWheel); |
|
417 |
+ this.removeEventListener('mousewheel', _onWheel); |
|
418 |
+ } |
|
419 |
+ else |
|
420 |
+ { |
|
421 |
+ document.detachEvent('onmousewheel', _onWheel); |
|
422 |
+ } |
|
423 |
+ } |
|
424 |
+ |
|
425 |
+ function getBarHeight() |
|
426 |
+ { |
|
427 |
+ // calculate scrollbar height and make sure it is not too small |
|
428 |
+ barHeight = Math.max((me.outerHeight() / me[0].scrollHeight) * me.outerHeight(), minBarHeight); |
|
429 |
+ bar.css({ height: barHeight + 'px' }); |
|
430 |
+ |
|
431 |
+ // hide scrollbar if content is not long enough |
|
432 |
+ var display = barHeight == me.outerHeight() ? 'none' : 'block'; |
|
433 |
+ bar.css({ display: display }); |
|
434 |
+ } |
|
435 |
+ |
|
436 |
+ function showBar() |
|
437 |
+ { |
|
438 |
+ // recalculate bar height |
|
439 |
+ getBarHeight(); |
|
440 |
+ clearTimeout(queueHide); |
|
441 |
+ |
|
442 |
+ // when bar reached top or bottom |
|
443 |
+ if (percentScroll == ~~percentScroll) |
|
444 |
+ { |
|
445 |
+ //release wheel |
|
446 |
+ releaseScroll = o.allowPageScroll; |
|
447 |
+ |
|
448 |
+ // publish approporiate event |
|
449 |
+ if (lastScroll != percentScroll) |
|
450 |
+ { |
|
451 |
+ var msg = (~~percentScroll == 0) ? 'top' : 'bottom'; |
|
452 |
+ me.trigger('slimscroll', msg); |
|
453 |
+ } |
|
454 |
+ } |
|
455 |
+ else |
|
456 |
+ { |
|
457 |
+ releaseScroll = false; |
|
458 |
+ } |
|
459 |
+ lastScroll = percentScroll; |
|
460 |
+ |
|
461 |
+ // show only when required |
|
462 |
+ if(barHeight >= me.outerHeight()) { |
|
463 |
+ //allow window scroll |
|
464 |
+ releaseScroll = true; |
|
465 |
+ return; |
|
466 |
+ } |
|
467 |
+ bar.stop(true,true).fadeIn('fast'); |
|
468 |
+ if (o.railVisible) { rail.stop(true,true).fadeIn('fast'); } |
|
469 |
+ } |
|
470 |
+ |
|
471 |
+ function hideBar() |
|
472 |
+ { |
|
473 |
+ // only hide when options allow it |
|
474 |
+ if (!o.alwaysVisible) |
|
475 |
+ { |
|
476 |
+ queueHide = setTimeout(function(){ |
|
477 |
+ if (!(o.disableFadeOut && isOverPanel) && !isOverBar && !isDragg) |
|
478 |
+ { |
|
479 |
+ bar.fadeOut('slow'); |
|
480 |
+ rail.fadeOut('slow'); |
|
481 |
+ } |
|
482 |
+ }, 1000); |
|
483 |
+ } |
|
484 |
+ } |
|
485 |
+ |
|
486 |
+ }); |
|
487 |
+ |
|
488 |
+ // maintain chainability |
|
489 |
+ return this; |
|
490 |
+ } |
|
491 |
+ }); |
|
492 |
+ |
|
493 |
+ jQuery.fn.extend({ |
|
494 |
+ slimscroll: jQuery.fn.slimScroll |
|
495 |
+ }); |
|
496 |
+ |
|
497 |
+})(jQuery); |
|
0 | 498 |
\ No newline at end of file |
1 | 499 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,16 @@ |
1 |
+/*! Copyright (c) 2011 Piotr Rochala (http://rocha.la) |
|
2 |
+ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) |
|
3 |
+ * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. |
|
4 |
+ * |
|
5 |
+ * Version: 1.3.2 (modified for fullpage.js) |
|
6 |
+ * |
|
7 |
+ */ |
|
8 |
+(function(f){jQuery.fn.extend({slimScroll:function(g){var a=f.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},g);this.each(function(){function s(d){d=d||window.event; |
|
9 |
+var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);f(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&m(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}function m(d,f,g){k=!1;var e=d,h=b.outerHeight()-c.outerHeight();f&&(e=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),e=Math.min(Math.max(e,0),h),e=0<d?Math.ceil(e):Math.floor(e),c.css({top:e+"px"}));l=parseInt(c.css("top"))/(b.outerHeight()-c.outerHeight()); |
|
10 |
+e=l*(b[0].scrollHeight-b.outerHeight());g&&(e=d,d=e/b[0].scrollHeight*b.outerHeight(),d=Math.min(Math.max(d,0),h),c.css({top:d+"px"}));b.scrollTop(e);b.trigger("slimscrolling",~~e);u();p()}function C(){window.addEventListener?(this.addEventListener("DOMMouseScroll",s,!1),this.addEventListener("mousewheel",s,!1)):document.attachEvent("onmousewheel",s)}function v(){r=Math.max(b.outerHeight()/b[0].scrollHeight*b.outerHeight(),D);c.css({height:r+"px"});var a=r==b.outerHeight()?"none":"block";c.css({display:a})} |
|
11 |
+function u(){v();clearTimeout(A);l==~~l?(k=a.allowPageScroll,B!=l&&b.trigger("slimscroll",0==~~l?"top":"bottom")):k=!1;B=l;r>=b.outerHeight()?k=!0:(c.stop(!0,!0).fadeIn("fast"),a.railVisible&&h.stop(!0,!0).fadeIn("fast"))}function p(){a.alwaysVisible||(A=setTimeout(function(){a.disableFadeOut&&w||x||y||(c.fadeOut("slow"),h.fadeOut("slow"))},1E3))}var w,x,y,A,z,r,l,B,D=30,k=!1,b=f(this);if(b.parent().hasClass(a.wrapperClass)){var n=b.scrollTop(),c=b.parent().find("."+a.barClass),h=b.parent().find("."+ |
|
12 |
+a.railClass);v();if(f.isPlainObject(g)){if("height"in g&&"auto"==g.height){b.parent().css("height","auto");b.css("height","auto");var q=b.parent().parent().height();b.parent().css("height",q);b.css("height",q)}if("scrollTo"in g)n=parseInt(a.scrollTo);else if("scrollBy"in g)n+=parseInt(a.scrollBy);else if("destroy"in g){c.remove();h.remove();b.unwrap();return}m(n,!1,!0)}}else{a.height="auto"==g.height?b.parent().height():g.height;n=f("<div></div>").addClass(a.wrapperClass).css({position:"relative", |
|
13 |
+overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden",width:a.width,height:a.height});var h=f("<div></div>").addClass(a.railClass).css({width:a.size,height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.railBorderRadius,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=f("<div></div>").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible? |
|
14 |
+"block":"none","border-radius":a.borderRadius,BorderRadius:a.borderRadius,MozBorderRadius:a.borderRadius,WebkitBorderRadius:a.borderRadius,zIndex:99}),q="right"==a.position?{right:a.distance}:{left:a.distance};h.css(q);c.css(q);b.wrap(n);b.parent().append(c);b.parent().append(h);a.railDraggable&&c.bind("mousedown",function(a){var b=f(document);y=!0;t=parseFloat(c.css("top"));pageY=a.pageY;b.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY;c.css("top",currTop);m(0,c.position().top,!1)}); |
|
15 |
+b.bind("mouseup.slimscroll",function(a){y=!1;p();b.unbind(".slimscroll")});return!1}).bind("selectstart.slimscroll",function(a){a.stopPropagation();a.preventDefault();return!1});h.hover(function(){u()},function(){p()});c.hover(function(){x=!0},function(){x=!1});b.hover(function(){w=!0;u();p()},function(){w=!1;p()});b.bind("touchstart",function(a,b){a.originalEvent.touches.length&&(z=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){k||b.originalEvent.preventDefault();b.originalEvent.touches.length&& |
|
16 |
+(m((z-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0),z=b.originalEvent.touches[0].pageY)});v();"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),m(0,!0)):"top"!==a.start&&(m(f(a.start).position().top,null,!0),a.alwaysVisible||c.hide());C()}});return this}});jQuery.fn.extend({slimscroll:jQuery.fn.slimScroll})})(jQuery); |
|
0 | 17 |
\ No newline at end of file |
1 | 18 |
deleted file mode 100644 |
... | ... |
@@ -1,37 +0,0 @@ |
1 |
-Copyright 2006, 2014 jQuery Foundation and other contributors, |
|
2 |
-https://jquery.org/ |
|
3 |
- |
|
4 |
-This software consists of voluntary contributions made by many |
|
5 |
-individuals. For exact contribution history, see the revision history |
|
6 |
-available at https://github.com/jquery/jquery-mousewheel |
|
7 |
- |
|
8 |
-The following license applies to all parts of this software except as |
|
9 |
-documented below: |
|
10 |
- |
|
11 |
-==== |
|
12 |
- |
|
13 |
-Permission is hereby granted, free of charge, to any person obtaining |
|
14 |
-a copy of this software and associated documentation files (the |
|
15 |
-"Software"), to deal in the Software without restriction, including |
|
16 |
-without limitation the rights to use, copy, modify, merge, publish, |
|
17 |
-distribute, sublicense, and/or sell copies of the Software, and to |
|
18 |
-permit persons to whom the Software is furnished to do so, subject to |
|
19 |
-the following conditions: |
|
20 |
- |
|
21 |
-The above copyright notice and this permission notice shall be |
|
22 |
-included in all copies or substantial portions of the Software. |
|
23 |
- |
|
24 |
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|
25 |
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|
26 |
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
27 |
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
|
28 |
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
|
29 |
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
|
30 |
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
31 |
- |
|
32 |
-==== |
|
33 |
- |
|
34 |
-All files located in the node_modules and external directories are |
|
35 |
-externally maintained libraries used by this software which have their |
|
36 |
-own licenses; we recommend you read them, as their terms may differ from |
|
37 |
-the terms above. |
38 | 0 |
deleted file mode 100644 |
... | ... |
@@ -1,76 +0,0 @@ |
1 |
-# jQuery Mouse Wheel Plugin |
|
2 |
- |
|
3 |
-A [jQuery](http://jquery.com/) plugin that adds cross-browser mouse wheel support with delta normalization. |
|
4 |
- |
|
5 |
-In order to use the plugin, simply bind the `mousewheel` event to an element. |
|
6 |
- |
|
7 |
-It also provides two helper methods called `mousewheel` and `unmousewheel` |
|
8 |
-that act just like other event helper methods in jQuery. |
|
9 |
- |
|
10 |
-The event object is updated with the normalized `deltaX` and `deltaY` properties. |
|
11 |
-In addition there is a new property on the event object called `deltaFactor`. Multiply |
|
12 |
-the `deltaFactor` by `deltaX` or `deltaY` to get the scroll distance that the browser |
|
13 |
-has reported. |
|
14 |
- |
|
15 |
-Here is an example of using both the bind and helper method syntax: |
|
16 |
- |
|
17 |
-```js |
|
18 |
-// using on |
|
19 |
-$('#my_elem').on('mousewheel', function(event) { |
|
20 |
- console.log(event.deltaX, event.deltaY, event.deltaFactor); |
|
21 |
-}); |
|
22 |
- |
|
23 |
-// using the event helper |
|
24 |
-$('#my_elem').mousewheel(function(event) { |
|
25 |
- console.log(event.deltaX, event.deltaY, event.deltaFactor); |
|
26 |
-}); |
|
27 |
-``` |
|
28 |
- |
|
29 |
-The old behavior of adding three arguments (`delta`, `deltaX`, and `deltaY`) to the |
|
30 |
-event handler is now deprecated and will be removed in later releases. |
|
31 |
- |
|
32 |
- |
|
33 |
-## The Deltas... |
|
34 |
- |
|
35 |
-The combination of Browsers, Operating Systems, and Devices offer a huge range of possible delta values. In fact if the user |
|
36 |
-uses a trackpad and then a physical mouse wheel the delta values can differ wildly. This plugin normalizes those |
|
37 |
-values so you get a whole number starting at +-1 and going up in increments of +-1 according to the force or |
|
38 |
-acceleration that is used. This number has the potential to be in the thousands depending on the device. |
|
39 |
-Check out some of the data collected from users [here](http://mousewheeldatacollector.herokuapp.com/). |
|
40 |
- |
|
41 |
-### Getting the scroll distance |
|
42 |
- |
|
43 |
-In some use-cases we prefer to have the normalized delta but in others we want to know how far the browser should |
|
44 |
-scroll based on the users input. This can be done by multiplying the `deltaFactor` by the `deltaX` or `deltaY` |
|
45 |
-event property to find the scroll distance the browser reported. |
|
46 |
- |
|
47 |
-The `deltaFactor` property was added to the event object in 3.1.5 so that the actual reported delta value can be |
|
48 |
-extracted. This is a non-standard property. |
|
49 |
- |
|
50 |
- |
|
51 |
-## Using with [Browserify](http://browserify.org) |
|
52 |
- |
|
53 |
-Support for browserify is baked in. |
|
54 |
- |
|
55 |
-```bash |
|
56 |
-npm install jquery-mousewheel |
|
57 |
-npm install jquery-browserify |
|
58 |
-``` |
|
59 |
- |
|
60 |
-In your server-side node.js code: |
|
61 |
- |
|
62 |
-```js |
|
63 |
-var express = require('express'); |
|
64 |
-var app = express.createServer(); |
|
65 |
- |
|
66 |
-app.use(require('browserify')({ |
|
67 |
- require : [ 'jquery-browserify', 'jquery-mousewheel' ] |
|
68 |
-})); |
|
69 |
-``` |
|
70 |
- |
|
71 |
-In your browser-side javascript: |
|
72 |
- |
|
73 |
-```js |
|
74 |
-var $ = require('jquery-browserify'); |
|
75 |
-require('jquery-mousewheel')($); |
|
76 |
-``` |
4 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,221 +0,0 @@ |
1 |
-/*! |
|
2 |
- * jQuery Mousewheel 3.1.12 |
|
3 |
- * |
|
4 |
- * Copyright 2014 jQuery Foundation and other contributors |
|
5 |
- * Released under the MIT license. |
|
6 |
- * http://jquery.org/license |
|
7 |
- */ |
|
8 |
- |
|
9 |
-(function (factory) { |
|
10 |
- if ( typeof define === 'function' && define.amd ) { |
|
11 |
- // AMD. Register as an anonymous module. |
|
12 |
- define(['jquery'], factory); |
|
13 |
- } else if (typeof exports === 'object') { |
|
14 |
- // Node/CommonJS style for Browserify |
|
15 |
- module.exports = factory; |
|
16 |
- } else { |
|
17 |
- // Browser globals |
|
18 |
- factory(jQuery); |
|
19 |
- } |
|
20 |
-}(function ($) { |
|
21 |
- |
|
22 |
- var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'], |
|
23 |
- toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ? |
|
24 |
- ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'], |
|
25 |
- slice = Array.prototype.slice, |
|
26 |
- nullLowestDeltaTimeout, lowestDelta; |
|
27 |
- |
|
28 |
- if ( $.event.fixHooks ) { |
|
29 |
- for ( var i = toFix.length; i; ) { |
|
30 |
- $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks; |
|
31 |
- } |
|
32 |
- } |
|
33 |
- |
|
34 |
- var special = $.event.special.mousewheel = { |
|
35 |
- version: '3.1.12', |
|
36 |
- |
|
37 |
- setup: function() { |
|
38 |
- if ( this.addEventListener ) { |
|
39 |
- for ( var i = toBind.length; i; ) { |
|
40 |
- this.addEventListener( toBind[--i], handler, false ); |
|
41 |
- } |
|
42 |
- } else { |
|
43 |
- this.onmousewheel = handler; |
|
44 |
- } |
|
45 |
- // Store the line height and page height for this particular element |
|
46 |
- $.data(this, 'mousewheel-line-height', special.getLineHeight(this)); |
|
47 |
- $.data(this, 'mousewheel-page-height', special.getPageHeight(this)); |
|
48 |
- }, |
|
49 |
- |
|
50 |
- teardown: function() { |
|
51 |
- if ( this.removeEventListener ) { |
|
52 |
- for ( var i = toBind.length; i; ) { |
|
53 |
- this.removeEventListener( toBind[--i], handler, false ); |
|
54 |
- } |
|
55 |
- } else { |
|
56 |
- this.onmousewheel = null; |
|
57 |
- } |
|
58 |
- // Clean up the data we added to the element |
|
59 |
- $.removeData(this, 'mousewheel-line-height'); |
|
60 |
- $.removeData(this, 'mousewheel-page-height'); |
|
61 |
- }, |
|
62 |
- |
|
63 |
- getLineHeight: function(elem) { |
|
64 |
- var $elem = $(elem), |
|
65 |
- $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent'](); |
|
66 |
- if (!$parent.length) { |
|
67 |
- $parent = $('body'); |
|
68 |
- } |
|
69 |
- return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16; |
|
70 |
- }, |
|
71 |
- |
|
72 |
- getPageHeight: function(elem) { |
|
73 |
- return $(elem).height(); |
|
74 |
- }, |
|
75 |
- |
|
76 |
- settings: { |
|
77 |
- adjustOldDeltas: true, // see shouldAdjustOldDeltas() below |
|
78 |
- normalizeOffset: true // calls getBoundingClientRect for each event |
|
79 |
- } |
|
80 |
- }; |
|
81 |
- |
|
82 |
- $.fn.extend({ |
|
83 |
- mousewheel: function(fn) { |
|
84 |
- return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel'); |
|
85 |
- }, |
|
86 |
- |
|
87 |
- unmousewheel: function(fn) { |
|
88 |
- return this.unbind('mousewheel', fn); |
|
89 |
- } |
|
90 |
- }); |
|
91 |
- |
|
92 |
- |
|
93 |
- function handler(event) { |
|
94 |
- var orgEvent = event || window.event, |
|
95 |
- args = slice.call(arguments, 1), |
|
96 |
- delta = 0, |
|
97 |
- deltaX = 0, |
|
98 |
- deltaY = 0, |
|
99 |
- absDelta = 0, |
|
100 |
- offsetX = 0, |
|
101 |
- offsetY = 0; |
|
102 |
- event = $.event.fix(orgEvent); |
|
103 |
- event.type = 'mousewheel'; |
|
104 |
- |
|
105 |
- // Old school scrollwheel delta |
|
106 |
- if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; } |
|
107 |
- if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; } |
|
108 |
- if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; } |
|
109 |
- if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; } |
|
110 |
- |
|
111 |
- // Firefox < 17 horizontal scrolling related to DOMMouseScroll event |
|
112 |
- if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) { |
|
113 |
- deltaX = deltaY * -1; |
|
114 |
- deltaY = 0; |
|
115 |
- } |
|
116 |
- |
|
117 |
- // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy |
|
118 |
- delta = deltaY === 0 ? deltaX : deltaY; |
|
119 |
- |
|
120 |
- // New school wheel delta (wheel event) |
|
121 |
- if ( 'deltaY' in orgEvent ) { |
|
122 |
- deltaY = orgEvent.deltaY * -1; |
|
123 |
- delta = deltaY; |
|
124 |
- } |
|
125 |
- if ( 'deltaX' in orgEvent ) { |
|
126 |
- deltaX = orgEvent.deltaX; |
|
127 |
- if ( deltaY === 0 ) { delta = deltaX * -1; } |
|
128 |
- } |
|
129 |
- |
|
130 |
- // No change actually happened, no reason to go any further |
|
131 |
- if ( deltaY === 0 && deltaX === 0 ) { return; } |
|
132 |
- |
|
133 |
- // Need to convert lines and pages to pixels if we aren't already in pixels |
|
134 |
- // There are three delta modes: |
|
135 |
- // * deltaMode 0 is by pixels, nothing to do |
|
136 |
- // * deltaMode 1 is by lines |
|
137 |
- // * deltaMode 2 is by pages |
|
138 |
- if ( orgEvent.deltaMode === 1 ) { |
|
139 |
- var lineHeight = $.data(this, 'mousewheel-line-height'); |
|
140 |
- delta *= lineHeight; |
|
141 |
- deltaY *= lineHeight; |
|
142 |
- deltaX *= lineHeight; |
|
143 |
- } else if ( orgEvent.deltaMode === 2 ) { |
|
144 |
- var pageHeight = $.data(this, 'mousewheel-page-height'); |
|
145 |
- delta *= pageHeight; |
|
146 |
- deltaY *= pageHeight; |
|
147 |
- deltaX *= pageHeight; |
|
148 |
- } |
|
149 |
- |
|
150 |
- // Store lowest absolute delta to normalize the delta values |
|
151 |
- absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) ); |
|
152 |
- |
|
153 |
- if ( !lowestDelta || absDelta < lowestDelta ) { |
|
154 |
- lowestDelta = absDelta; |
|
155 |
- |
|
156 |
- // Adjust older deltas if necessary |
|
157 |
- if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) { |
|
158 |
- lowestDelta /= 40; |
|
159 |
- } |
|
160 |
- } |
|
161 |
- |
|
162 |
- // Adjust older deltas if necessary |
|
163 |
- if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) { |
|
164 |
- // Divide all the things by 40! |
|
165 |
- delta /= 40; |
|
166 |
- deltaX /= 40; |
|
167 |
- deltaY /= 40; |
|
168 |
- } |
|
169 |
- |
|
170 |
- // Get a whole, normalized value for the deltas |
|
171 |
- delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta); |
|
172 |
- deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta); |
|
173 |
- deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta); |
|
174 |
- |
|
175 |
- // Normalise offsetX and offsetY properties |
|
176 |
- if ( special.settings.normalizeOffset && this.getBoundingClientRect ) { |
|
177 |
- var boundingRect = this.getBoundingClientRect(); |
|
178 |
- offsetX = event.clientX - boundingRect.left; |
|
179 |
- offsetY = event.clientY - boundingRect.top; |
|
180 |
- } |
|
181 |
- |
|
182 |
- // Add information to the event object |
|
183 |
- event.deltaX = deltaX; |
|
184 |
- event.deltaY = deltaY; |
|
185 |
- event.deltaFactor = lowestDelta; |
|
186 |
- event.offsetX = offsetX; |
|
187 |
- event.offsetY = offsetY; |
|
188 |
- // Go ahead and set deltaMode to 0 since we converted to pixels |
|
189 |
- // Although this is a little odd since we overwrite the deltaX/Y |
|
190 |
- // properties with normalized deltas. |
|
191 |
- event.deltaMode = 0; |
|
192 |
- |
|
193 |
- // Add event and delta to the front of the arguments |
|
194 |
- args.unshift(event, delta, deltaX, deltaY); |
|
195 |
- |
|
196 |
- // Clearout lowestDelta after sometime to better |
|
197 |
- // handle multiple device types that give different |
|
198 |
- // a different lowestDelta |
|
199 |
- // Ex: trackpad = 3 and mouse wheel = 120 |
|
200 |
- if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); } |
|
201 |
- nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200); |
|
202 |
- |
|
203 |
- return ($.event.dispatch || $.event.handle).apply(this, args); |
|
204 |
- } |
|
205 |
- |
|
206 |
- function nullLowestDelta() { |
|
207 |
- lowestDelta = null; |
|
208 |
- } |
|
209 |
- |
|
210 |
- function shouldAdjustOldDeltas(orgEvent, absDelta) { |
|
211 |
- // If this is an older event and the delta is divisable by 120, |
|
212 |
- // then we are assuming that the browser is treating this as an |
|
213 |
- // older mouse wheel event and that we should divide the deltas |
|
214 |
- // by 40 to try and get a more usable deltaFactor. |
|
215 |
- // Side note, this actually impacts the reported scroll distance |
|
216 |
- // in older browsers and can cause scrolling to be slower than native. |
|
217 |
- // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false. |
|
218 |
- return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0; |
|
219 |
- } |
|
220 |
- |
|
221 |
-})); |
222 | 0 |
deleted file mode 100644 |
... | ... |
@@ -1,8 +0,0 @@ |
1 |
-/*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh) |
|
2 |
- * Licensed under the MIT License (LICENSE.txt). |
|
3 |
- * |
|
4 |
- * Version: 3.1.12 |
|
5 |
- * |
|
6 |
- * Requires: jQuery 1.2.2+ |
|
7 |
- */ |
|
8 |
-!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})}); |
|
9 | 0 |
\ No newline at end of file |