YITH WooCommerce Zoom Magnifier - Version 1.3.6

Version Description

Download this release

Release Info

Developer yithemes
Plugin Icon 128x128 YITH WooCommerce Zoom Magnifier
Version 1.3.6
Comparing to
See all releases

Code changes from version 1.3.5 to 1.3.6

README.txt CHANGED
@@ -1,173 +1,178 @@
1
- === YITH WooCommerce Zoom Magnifier ===
2
-
3
- Contributors: yithemes
4
- Tags: zoom, magnifier, slider, carousel, woocommerce
5
- Requires at least: 4.0
6
- Tested up to: 4.9.4
7
- Stable tag: 1.3.5
8
- License: GPLv2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
- Documentation: https://docs.yithemes.com/yith-woocommerce-zoom-magnifier/
11
-
12
- YITH WooCommerce Zoom Magnifier add zoom effect to product images and a customizable image slider.
13
-
14
- == Description ==
15
-
16
- = Improve the user experience, improve your sales =
17
-
18
- Offer to your visitors a chance to inspect in detail the quality of your products. With YITH WooCommerce Zoom Magnifier you can add a zoom effect to all your product images.
19
- The Wordpress plugin also adds a slider below the featured image with your product gallery images.
20
-
21
- = Main features =
22
-
23
- * Show a bigger size product image on mouseover.
24
- * Customize zoom area width and height and the size of the image to show as zoomed image.
25
- * Enable or disable it on mobile devices.
26
- * Add a slider showing product image thumbnails.
27
- * Customize the slider behavior.
28
-
29
- For a more detailed list of options and features of the plugin, please look at the [official documentation](https://docs.yithemes.com/yith-woocommerce-zoom-magnifier/ "Yith WooCommerce Zoom Magnifier official documentation").
30
-
31
- Discover all the features of the plugin and install it in your theme: the result will be extremely satisfying.
32
-
33
- == Installation ==
34
- Important: First of all, you have to download and activate WooCommerce plugin, which is mandatory for Yith WooCommerce Zoom Magnifier to be working.
35
-
36
- 1. Unzip the downloaded zip file.
37
- 2. Upload the plugin folder into the `wp-content/plugins/` directory of your WordPress site.
38
- 3. Activate `YITH WooCommerce Zoom Magnifier` from Plugins page
39
-
40
- = Configuration =
41
-
42
- YITH WooCommerce Zoom Magnifier will add a new tab called "Zoom Magnifier" in "YIT Plugins" menu item. There, you will find all Yithemes plugins with quick access to plugin setting page.
43
-
44
- == Screenshots ==
45
-
46
- 1. The General plugin settings page. You can disable the plugin for mobile devices.
47
- 2. The Magnifier settings page. Choose the size of the zoom area, the size of the image to be shown in zoom area and the its position (on the right or over the image).
48
- 3. The slider settings page. You can choose to use the slider for product image thumbnails, set how many images to show within the slider, and the behavior of the slider, choosing if circular, infinite or standard carousel.
49
- 4. The zoom applied to a product image, showing zoomed image on the right side.
50
- 5. The zoom applied to a product image, showing zoomed image over the same image.
51
- 6. Choose how many items the slider should show, the image thumbnails will fit the available width.
52
-
53
- == Changelog ==
54
-
55
- = Version 1.3.5 - Released: Oct 23, 2018 =
56
-
57
- * New: Support to WooCommerce 3.5.0
58
- * Update: plugin framework
59
- * Update: plugin description
60
- * Update: plugin links
61
- * Dev: extra class if featured audio plugin is enabled
62
-
63
- = Version 1.3.4 - Released: June 26, 2018 =
64
-
65
- * Fix: click thumbnails and zoom them
66
-
67
- = Version 1.3.3 - Released: June 22, 2018 =
68
-
69
- * Update: documentation link
70
- * Fix: choosing variation
71
- * Dev: include 'wp-admin/includes/plugin.php'
72
-
73
- = Version 1.3.2 - Released: Mar 06, 2018 =
74
-
75
- * New: support to WooCommerce 3.3.3
76
- * Update: plugin framework 3.0.13
77
- * Fix: Wrong documentation link.
78
- * Fix: Remove old plugin framework.
79
-
80
- = Version 1.3.1 - Released: Feb 07, 2018 =
81
-
82
- * New: support to WooCommerce 3.3.1
83
- * New: support to WordPress 4.9.4
84
- * Update: plugin framework 3.0.12
85
-
86
- = Version 1.3.0 - Released: Dec 11, 2017 =
87
-
88
- * Update: YITH Plugin Framework to version 3.0
89
- * New: support for WooCommerce 3.2.3
90
- * New: tested up to WordPress 4.9
91
-
92
- = Version 1.2.30 - Released: Aug 11, 2017 =
93
-
94
- * New: support for WooCommerce 3.1.
95
- * New: tested up to WordPress 4.8.
96
- * Update: YITH Plugin Framework.
97
-
98
- = Version 1.2.29 - Released: Apr 30, 2017 =
99
-
100
- * Update: YITH Plugin Framework.
101
- * Tweak: tested up to WordPress 4.7.4.
102
- * Tweak: changed plugin tags.
103
-
104
- = Version 1.2.28 - Released: Apr 06, 2017 =
105
-
106
- * Fix: Javascript error when a product variation do not have its own image set.
107
-
108
- = Version 1.2.27 - Released: Apr 05, 2017 =
109
-
110
- * Fix: Variation images not shown properly.
111
-
112
- = Version 1.2.26 - Released: Mar 28, 2017 =
113
-
114
- * Fix: YITH Plugin Framework initialization that prevents the plugin update.
115
-
116
- = Version 1.2.25 - Released: Mar 08, 2017 =
117
-
118
- * Fix: removed unused class.yith-wcmg.php file
119
- * Fix: removed hook 'admin_print_footer_scripts' in class.yith-wcmg-admin.php
120
-
121
- = Version 1.2.24 - Released: Mar 06, 2017 =
122
-
123
- * New: Support to WooCommerce 2.7.0-RC1
124
- * Update: YITH Plugin Framework
125
-
126
- = Version 1.2.23 - Released: Jan 16, 2017 =
127
-
128
- * New: WordPress 4.7 ready
129
-
130
- = Version 1.2.22 - Released: Nov 08, 2016 =
131
-
132
- * Updated: Compatibility to WordPress up to 4.6.x
133
- * Updated: YITH Plugin-fw
134
-
135
- = Version 1.2.21 - Released: Aug 09, 2016 =
136
-
137
- * Fixed: Javascript error on property 'msie'
138
-
139
- = Version 1.2.20 - Released: Jun 13, 2016 =
140
-
141
- * Added: spanish localization
142
- * Updated: WooCommerce 2.6 100% compatible
143
-
144
- = Version 1.2.19 - Released: May 04, 2016 =
145
-
146
- * Fixed: missing YITH Plugin FW files
147
-
148
- == Suggestions ==
149
-
150
- If you have suggestions about how to improve YITH WooCommerce Zoom Magnifier, you can [write us](mailto:plugins@yithemes.com "Your Inspiration Themes") so we can bundle them into YITH Zoom WooCommerce Magnifier.
151
-
152
- == Translators ==
153
-
154
- = Available Languages =
155
- * English (Default)
156
- * Italian
157
- * Spanish
158
-
159
- If you have created your own language pack, or have an update for an existing one, you can send [gettext PO and MO file](http://codex.wordpress.org/Translating_WordPress "Translating WordPress")
160
- [use](https://yithemes.com/contact/ "Your Inspiration Themes") so we can bundle it into YITH WooCommerce Zoom Magnfier Languages.
161
-
162
- == Documentation ==
163
-
164
- Full documentation is available [here](https://docs.yithemes.com/yith-woocommerce-zoom-magnifier/).
165
-
166
- == Upgrade notice ==
167
-
168
- = Version 1.3.2 - Released: Mar 06, 2018 =
169
-
170
- * New: support to WooCommerce 3.3.3
171
- * Update: plugin framework 3.0.13
172
- * Fix: Wrong documentation link.
 
 
 
 
 
173
  * Fix: Remove old plugin framework.
1
+ === YITH WooCommerce Zoom Magnifier ===
2
+
3
+ Contributors: yithemes
4
+ Tags: zoom, magnifier, slider, carousel, woocommerce
5
+ Requires at least: 4.0
6
+ Tested up to: 5.0.0
7
+ Stable tag: 1.3.6
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+ Documentation: https://docs.yithemes.com/yith-woocommerce-zoom-magnifier/
11
+
12
+ YITH WooCommerce Zoom Magnifier add zoom effect to product images and a customizable image slider.
13
+
14
+ == Description ==
15
+
16
+ = Improve the user experience, improve your sales =
17
+
18
+ Offer to your visitors a chance to inspect in detail the quality of your products. With YITH WooCommerce Zoom Magnifier you can add a zoom effect to all your product images.
19
+ The Wordpress plugin also adds a slider below the featured image with your product gallery images.
20
+
21
+ = Main features =
22
+
23
+ * Show a bigger size product image on mouseover.
24
+ * Customize zoom area width and height and the size of the image to show as zoomed image.
25
+ * Enable or disable it on mobile devices.
26
+ * Add a slider showing product image thumbnails.
27
+ * Customize the slider behavior.
28
+
29
+ For a more detailed list of options and features of the plugin, please look at the [official documentation](https://docs.yithemes.com/yith-woocommerce-zoom-magnifier/ "Yith WooCommerce Zoom Magnifier official documentation").
30
+
31
+ Discover all the features of the plugin and install it in your theme: the result will be extremely satisfying.
32
+
33
+ == Installation ==
34
+ Important: First of all, you have to download and activate WooCommerce plugin, which is mandatory for Yith WooCommerce Zoom Magnifier to be working.
35
+
36
+ 1. Unzip the downloaded zip file.
37
+ 2. Upload the plugin folder into the `wp-content/plugins/` directory of your WordPress site.
38
+ 3. Activate `YITH WooCommerce Zoom Magnifier` from Plugins page
39
+
40
+ = Configuration =
41
+
42
+ YITH WooCommerce Zoom Magnifier will add a new tab called "Zoom Magnifier" in "YIT Plugins" menu item. There, you will find all Yithemes plugins with quick access to plugin setting page.
43
+
44
+ == Screenshots ==
45
+
46
+ 1. The General plugin settings page. You can disable the plugin for mobile devices.
47
+ 2. The Magnifier settings page. Choose the size of the zoom area, the size of the image to be shown in zoom area and the its position (on the right or over the image).
48
+ 3. The slider settings page. You can choose to use the slider for product image thumbnails, set how many images to show within the slider, and the behavior of the slider, choosing if circular, infinite or standard carousel.
49
+ 4. The zoom applied to a product image, showing zoomed image on the right side.
50
+ 5. The zoom applied to a product image, showing zoomed image over the same image.
51
+ 6. Choose how many items the slider should show, the image thumbnails will fit the available width.
52
+
53
+ == Changelog ==
54
+
55
+ = Version 1.3.6 - Released: Dec 12, 2018 =
56
+
57
+ * New: Support to WordPress 5.0
58
+ * Update: plugin framework version 3.1.10
59
+
60
+ = Version 1.3.5 - Released: Oct 23, 2018 =
61
+
62
+ * New: Support to WooCommerce 3.5.0
63
+ * Update: plugin framework
64
+ * Update: plugin description
65
+ * Update: plugin links
66
+ * Dev: extra class if featured audio plugin is enabled
67
+
68
+ = Version 1.3.4 - Released: June 26, 2018 =
69
+
70
+ * Fix: click thumbnails and zoom them
71
+
72
+ = Version 1.3.3 - Released: June 22, 2018 =
73
+
74
+ * Update: documentation link
75
+ * Fix: choosing variation
76
+ * Dev: include 'wp-admin/includes/plugin.php'
77
+
78
+ = Version 1.3.2 - Released: Mar 06, 2018 =
79
+
80
+ * New: support to WooCommerce 3.3.3
81
+ * Update: plugin framework 3.0.13
82
+ * Fix: Wrong documentation link.
83
+ * Fix: Remove old plugin framework.
84
+
85
+ = Version 1.3.1 - Released: Feb 07, 2018 =
86
+
87
+ * New: support to WooCommerce 3.3.1
88
+ * New: support to WordPress 4.9.4
89
+ * Update: plugin framework 3.0.12
90
+
91
+ = Version 1.3.0 - Released: Dec 11, 2017 =
92
+
93
+ * Update: YITH Plugin Framework to version 3.0
94
+ * New: support for WooCommerce 3.2.3
95
+ * New: tested up to WordPress 4.9
96
+
97
+ = Version 1.2.30 - Released: Aug 11, 2017 =
98
+
99
+ * New: support for WooCommerce 3.1.
100
+ * New: tested up to WordPress 4.8.
101
+ * Update: YITH Plugin Framework.
102
+
103
+ = Version 1.2.29 - Released: Apr 30, 2017 =
104
+
105
+ * Update: YITH Plugin Framework.
106
+ * Tweak: tested up to WordPress 4.7.4.
107
+ * Tweak: changed plugin tags.
108
+
109
+ = Version 1.2.28 - Released: Apr 06, 2017 =
110
+
111
+ * Fix: Javascript error when a product variation do not have its own image set.
112
+
113
+ = Version 1.2.27 - Released: Apr 05, 2017 =
114
+
115
+ * Fix: Variation images not shown properly.
116
+
117
+ = Version 1.2.26 - Released: Mar 28, 2017 =
118
+
119
+ * Fix: YITH Plugin Framework initialization that prevents the plugin update.
120
+
121
+ = Version 1.2.25 - Released: Mar 08, 2017 =
122
+
123
+ * Fix: removed unused class.yith-wcmg.php file
124
+ * Fix: removed hook 'admin_print_footer_scripts' in class.yith-wcmg-admin.php
125
+
126
+ = Version 1.2.24 - Released: Mar 06, 2017 =
127
+
128
+ * New: Support to WooCommerce 2.7.0-RC1
129
+ * Update: YITH Plugin Framework
130
+
131
+ = Version 1.2.23 - Released: Jan 16, 2017 =
132
+
133
+ * New: WordPress 4.7 ready
134
+
135
+ = Version 1.2.22 - Released: Nov 08, 2016 =
136
+
137
+ * Updated: Compatibility to WordPress up to 4.6.x
138
+ * Updated: YITH Plugin-fw
139
+
140
+ = Version 1.2.21 - Released: Aug 09, 2016 =
141
+
142
+ * Fixed: Javascript error on property 'msie'
143
+
144
+ = Version 1.2.20 - Released: Jun 13, 2016 =
145
+
146
+ * Added: spanish localization
147
+ * Updated: WooCommerce 2.6 100% compatible
148
+
149
+ = Version 1.2.19 - Released: May 04, 2016 =
150
+
151
+ * Fixed: missing YITH Plugin FW files
152
+
153
+ == Suggestions ==
154
+
155
+ If you have suggestions about how to improve YITH WooCommerce Zoom Magnifier, you can [write us](mailto:plugins@yithemes.com "Your Inspiration Themes") so we can bundle them into YITH Zoom WooCommerce Magnifier.
156
+
157
+ == Translators ==
158
+
159
+ = Available Languages =
160
+ * English (Default)
161
+ * Italian
162
+ * Spanish
163
+
164
+ If you have created your own language pack, or have an update for an existing one, you can send [gettext PO and MO file](http://codex.wordpress.org/Translating_WordPress "Translating WordPress")
165
+ [use](https://yithemes.com/contact/ "Your Inspiration Themes") so we can bundle it into YITH WooCommerce Zoom Magnfier Languages.
166
+
167
+ == Documentation ==
168
+
169
+ Full documentation is available [here](https://docs.yithemes.com/yith-woocommerce-zoom-magnifier/).
170
+
171
+ == Upgrade notice ==
172
+
173
+ = Version 1.3.2 - Released: Mar 06, 2018 =
174
+
175
+ * New: support to WooCommerce 3.3.3
176
+ * Update: plugin framework 3.0.13
177
+ * Fix: Wrong documentation link.
178
  * Fix: Remove old plugin framework.
assets/css/admin.css CHANGED
@@ -1,20 +1,20 @@
1
- .yith_woocommerce_slider {
2
- width: 300px;
3
- float: left
4
- }
5
- .yith_woocommerce_slider_value {
6
- margin-top: -5px;
7
- margin-left: 10px;
8
- width: 50px;
9
- float: left;
10
- text-align: center;
11
- font-weight: bold;
12
- }
13
-
14
- .yith_banner {
15
- margin-top: 10px;
16
- }
17
-
18
- #eg-wrap .select_fake {/* solve back-end conflict with Essential Grid */
19
- height: 24px;
20
  }
1
+ .yith_woocommerce_slider {
2
+ width: 300px;
3
+ float: left
4
+ }
5
+ .yith_woocommerce_slider_value {
6
+ margin-top: -5px;
7
+ margin-left: 10px;
8
+ width: 50px;
9
+ float: left;
10
+ text-align: center;
11
+ font-weight: bold;
12
+ }
13
+
14
+ .yith_banner {
15
+ margin-top: 10px;
16
+ }
17
+
18
+ #eg-wrap .select_fake {/* solve back-end conflict with Essential Grid */
19
+ height: 24px;
20
  }
assets/css/frontend.css CHANGED
@@ -1,65 +1,65 @@
1
- /* gallery */
2
- .yith_magnifier_gallery {
3
- margin: 0;
4
- padding: 0;
5
- }
6
-
7
- .yith_magnifier_gallery li {
8
- position: relative;
9
- float: left;
10
- display: block;
11
- }
12
-
13
- .yith_magnifier_gallery li.last {
14
- margin-right: 0;
15
- }
16
-
17
- .yith_magnifier_gallery li a {
18
- width: 100% !important;
19
- display: block;
20
- margin-top: 10px;
21
- height: auto !important;
22
- }
23
-
24
- /* next/prev */
25
- .single-product.woocommerce .thumbnails {
26
- position: relative;
27
- }
28
-
29
- .single-product.woocommerce .thumbnails #slider-prev,
30
- .single-product.woocommerce .thumbnails #slider-next {
31
- display: none !important;
32
- cursor: pointer;
33
- width: 27px;
34
- height: 26px;
35
- background: url('../images/slider-arrow.png') no-repeat left center;
36
- position: absolute;
37
- top: 48%;
38
- margin-top: -2px;
39
- }
40
-
41
- .single-product.woocommerce .thumbnails #slider-prev {
42
- background-position: left center;
43
- left: 0px;
44
- }
45
-
46
- .single-product.woocommerce .thumbnails #slider-next {
47
- background-position: right center;
48
- right: 0px;
49
- }
50
-
51
- .single-product.woocommerce .thumbnails:hover #slider-prev,
52
- .single-product.woocommerce .thumbnails:hover #slider-next {
53
- display: block !important;
54
- }
55
-
56
- span.onsale {
57
- z-index: 10000
58
- }
59
-
60
- div.pp_woocommerce a.pp_expand {
61
- display: inline;
62
- bottom: 10px;
63
- top: initial;
64
- left: 10px;
65
  }
1
+ /* gallery */
2
+ .yith_magnifier_gallery {
3
+ margin: 0;
4
+ padding: 0;
5
+ }
6
+
7
+ .yith_magnifier_gallery li {
8
+ position: relative;
9
+ float: left;
10
+ display: block;
11
+ }
12
+
13
+ .yith_magnifier_gallery li.last {
14
+ margin-right: 0;
15
+ }
16
+
17
+ .yith_magnifier_gallery li a {
18
+ width: 100% !important;
19
+ display: block;
20
+ margin-top: 10px;
21
+ height: auto !important;
22
+ }
23
+
24
+ /* next/prev */
25
+ .single-product.woocommerce .thumbnails {
26
+ position: relative;
27
+ }
28
+
29
+ .single-product.woocommerce .thumbnails #slider-prev,
30
+ .single-product.woocommerce .thumbnails #slider-next {
31
+ display: none !important;
32
+ cursor: pointer;
33
+ width: 27px;
34
+ height: 26px;
35
+ background: url('../images/slider-arrow.png') no-repeat left center;
36
+ position: absolute;
37
+ top: 48%;
38
+ margin-top: -2px;
39
+ }
40
+
41
+ .single-product.woocommerce .thumbnails #slider-prev {
42
+ background-position: left center;
43
+ left: 0px;
44
+ }
45
+
46
+ .single-product.woocommerce .thumbnails #slider-next {
47
+ background-position: right center;
48
+ right: 0px;
49
+ }
50
+
51
+ .single-product.woocommerce .thumbnails:hover #slider-prev,
52
+ .single-product.woocommerce .thumbnails:hover #slider-next {
53
+ display: block !important;
54
+ }
55
+
56
+ span.onsale {
57
+ z-index: 10000
58
+ }
59
+
60
+ div.pp_woocommerce a.pp_expand {
61
+ display: inline;
62
+ bottom: 10px;
63
+ top: initial;
64
+ left: 10px;
65
  }
assets/css/yith_magnifier.css CHANGED
@@ -1,70 +1,70 @@
1
- .yith_magnifier_zoom_wrap {
2
- top: 0;
3
- position: relative;
4
- }
5
-
6
- .yith_magnifier_loading {
7
- color:white;
8
- background:#222;
9
- padding:3px;
10
- border:1px solid #000;
11
- position: absolute;
12
- text-align: center;
13
- top: 10%;
14
- z-index: 9999;
15
- }
16
-
17
- .yith_magnifier_zoom {
18
- position: relative;
19
- display: block;
20
- }
21
-
22
- .yith_magnifier_zoom img {
23
- display: block;
24
- }
25
-
26
- .yith_magnifier_mousetrap {
27
- z-index: 999;
28
- position: absolute;
29
- width: 0px;
30
- height :0px;
31
- left: 0;
32
- top: 0;
33
- }
34
-
35
- /* ie fix */
36
- .ie .yith_magnifier_mousetrap {
37
- background-image: url(".");
38
- }
39
-
40
- .yith_magnifier_lens {
41
- display: none;
42
- z-index:98;
43
- position:absolute;
44
- overflow: hidden;
45
-
46
- border: 1px solid #ccc;
47
- }
48
-
49
- .yith_magnifier_lens img {
50
- width: auto !important;
51
- max-width: none !important;
52
-
53
- -webkit-transition: all ease-in-out 0s !important;
54
- -moz-transition: all ease-in-out 0s !important;
55
- -o-transition: all ease-in-out 0s !important;
56
- transition: all ease-in-out 0s !important;
57
- }
58
-
59
- .yith_magnifier_zoom_magnifier {
60
- display:none;
61
- position:absolute;
62
- z-index: 99;
63
-
64
- border:4px solid #ccc;
65
- overflow:hidden;
66
- }
67
-
68
- .yith_magnifier_gallery {
69
- list-style: none;
70
- }
1
+ .yith_magnifier_zoom_wrap {
2
+ top: 0;
3
+ position: relative;
4
+ }
5
+
6
+ .yith_magnifier_loading {
7
+ color:white;
8
+ background:#222;
9
+ padding:3px;
10
+ border:1px solid #000;
11
+ position: absolute;
12
+ text-align: center;
13
+ top: 10%;
14
+ z-index: 9999;
15
+ }
16
+
17
+ .yith_magnifier_zoom {
18
+ position: relative;
19
+ display: block;
20
+ }
21
+
22
+ .yith_magnifier_zoom img {
23
+ display: block;
24
+ }
25
+
26
+ .yith_magnifier_mousetrap {
27
+ z-index: 999;
28
+ position: absolute;
29
+ width: 0px;
30
+ height :0px;
31
+ left: 0;
32
+ top: 0;
33
+ }
34
+
35
+ /* ie fix */
36
+ .ie .yith_magnifier_mousetrap {
37
+ background-image: url(".");
38
+ }
39
+
40
+ .yith_magnifier_lens {
41
+ display: none;
42
+ z-index:98;
43
+ position:absolute;
44
+ overflow: hidden;
45
+
46
+ border: 1px solid #ccc;
47
+ }
48
+
49
+ .yith_magnifier_lens img {
50
+ width: auto !important;
51
+ max-width: none !important;
52
+
53
+ -webkit-transition: all ease-in-out 0s !important;
54
+ -moz-transition: all ease-in-out 0s !important;
55
+ -o-transition: all ease-in-out 0s !important;
56
+ transition: all ease-in-out 0s !important;
57
+ }
58
+
59
+ .yith_magnifier_zoom_magnifier {
60
+ display:none;
61
+ position:absolute;
62
+ z-index: 99;
63
+
64
+ border:4px solid #ccc;
65
+ overflow:hidden;
66
+ }
67
+
68
+ .yith_magnifier_gallery {
69
+ list-style: none;
70
+ }
assets/js/jquery.carouFredSel.js CHANGED
@@ -1,4254 +1,4254 @@
1
- /*
2
- * jQuery carouFredSel 6.2.1
3
- * Demo's and documentation:
4
- * caroufredsel.dev7studios.com
5
- *
6
- * Copyright (c) 2013 Fred Heusschen
7
- * www.frebsite.nl
8
- *
9
- * Dual licensed under the MIT and GPL licenses.
10
- * http://en.wikipedia.org/wiki/MIT_License
11
- * http://en.wikipedia.org/wiki/GNU_General_Public_License
12
- */
13
-
14
-
15
- (function($) {
16
-
17
-
18
- // LOCAL
19
-
20
- if ( $.fn.carouFredSel )
21
- {
22
- return;
23
- }
24
-
25
- $.fn.caroufredsel = $.fn.carouFredSel = function(options, configs)
26
- {
27
-
28
- // no element
29
- if (this.length == 0)
30
- {
31
- debug( true, 'No element found for "' + this.selector + '".' );
32
- return this;
33
- }
34
-
35
- // multiple elements
36
- if (this.length > 1)
37
- {
38
- return this.each(function() {
39
- $(this).carouFredSel(options, configs);
40
- });
41
- }
42
-
43
-
44
- var $cfs = this,
45
- $tt0 = this[0],
46
- starting_position = false;
47
-
48
- if ($cfs.data('_cfs_isCarousel'))
49
- {
50
- starting_position = $cfs.triggerHandler('_cfs_triggerEvent', 'currentPosition');
51
- $cfs.trigger('_cfs_triggerEvent', ['destroy', true]);
52
- }
53
-
54
- var FN = {};
55
-
56
- FN._init = function(o, setOrig, start)
57
- {
58
- o = go_getObject($tt0, o);
59
-
60
- o.items = go_getItemsObject($tt0, o.items);
61
- o.scroll = go_getScrollObject($tt0, o.scroll);
62
- o.auto = go_getAutoObject($tt0, o.auto);
63
- o.prev = go_getPrevNextObject($tt0, o.prev);
64
- o.next = go_getPrevNextObject($tt0, o.next);
65
- o.pagination = go_getPaginationObject($tt0, o.pagination);
66
- o.swipe = go_getSwipeObject($tt0, o.swipe);
67
- o.mousewheel = go_getMousewheelObject($tt0, o.mousewheel);
68
-
69
- if (setOrig)
70
- {
71
- opts_orig = $.extend(true, {}, $.fn.carouFredSel.defaults, o);
72
- }
73
-
74
- opts = $.extend(true, {}, $.fn.carouFredSel.defaults, o);
75
- opts.d = cf_getDimensions(opts);
76
-
77
- crsl.direction = (opts.direction == 'up' || opts.direction == 'left') ? 'next' : 'prev';
78
-
79
- var a_itm = $cfs.children(),
80
- avail_primary = ms_getParentSize($wrp, opts, 'width');
81
-
82
- if (is_true(opts.cookie))
83
- {
84
- opts.cookie = 'caroufredsel_cookie_' + conf.serialNumber;
85
- }
86
-
87
- opts.maxDimension = ms_getMaxDimension(opts, avail_primary);
88
-
89
- // complement items and sizes
90
- opts.items = in_complementItems(opts.items, opts, a_itm, start);
91
- opts[opts.d['width']] = in_complementPrimarySize(opts[opts.d['width']], opts, a_itm);
92
- opts[opts.d['height']] = in_complementSecondarySize(opts[opts.d['height']], opts, a_itm);
93
-
94
- // primary size not set for a responsive carousel
95
- if (opts.responsive)
96
- {
97
- if (!is_percentage(opts[opts.d['width']]))
98
- {
99
- opts[opts.d['width']] = '100%';
100
- }
101
- }
102
-
103
- // primary size is percentage
104
- if (is_percentage(opts[opts.d['width']]))
105
- {
106
- crsl.upDateOnWindowResize = true;
107
- crsl.primarySizePercentage = opts[opts.d['width']];
108
- opts[opts.d['width']] = ms_getPercentage(avail_primary, crsl.primarySizePercentage);
109
- if (!opts.items.visible)
110
- {
111
- opts.items.visibleConf.variable = true;
112
- }
113
- }
114
-
115
- if (opts.responsive)
116
- {
117
- opts.usePadding = false;
118
- opts.padding = [0, 0, 0, 0];
119
- opts.align = false;
120
- opts.items.visibleConf.variable = false;
121
- }
122
- else
123
- {
124
- // visible-items not set
125
- if (!opts.items.visible)
126
- {
127
- opts = in_complementVisibleItems(opts, avail_primary);
128
- }
129
-
130
- // primary size not set -> calculate it or set to "variable"
131
- if (!opts[opts.d['width']])
132
- {
133
- if (!opts.items.visibleConf.variable && is_number(opts.items[opts.d['width']]) && opts.items.filter == '*')
134
- {
135
- opts[opts.d['width']] = opts.items.visible * opts.items[opts.d['width']];
136
- opts.align = false;
137
- }
138
- else
139
- {
140
- opts[opts.d['width']] = 'variable';
141
- }
142
- }
143
- // align not set -> set to center if primary size is number
144
- if (is_undefined(opts.align))
145
- {
146
- opts.align = (is_number(opts[opts.d['width']]))
147
- ? 'center'
148
- : false;
149
- }
150
- // set variabe visible-items
151
- if (opts.items.visibleConf.variable)
152
- {
153
- opts.items.visible = gn_getVisibleItemsNext(a_itm, opts, 0);
154
- }
155
- }
156
-
157
- // set visible items by filter
158
- if (opts.items.filter != '*' && !opts.items.visibleConf.variable)
159
- {
160
- opts.items.visibleConf.org = opts.items.visible;
161
- opts.items.visible = gn_getVisibleItemsNextFilter(a_itm, opts, 0);
162
- }
163
-
164
- opts.items.visible = cf_getItemsAdjust(opts.items.visible, opts, opts.items.visibleConf.adjust, $tt0);
165
- opts.items.visibleConf.old = opts.items.visible;
166
-
167
- if (opts.responsive)
168
- {
169
- if (!opts.items.visibleConf.min)
170
- {
171
- opts.items.visibleConf.min = opts.items.visible;
172
- }
173
- if (!opts.items.visibleConf.max)
174
- {
175
- opts.items.visibleConf.max = opts.items.visible;
176
- }
177
- opts = in_getResponsiveValues(opts, a_itm, avail_primary);
178
- }
179
- else
180
- {
181
- opts.padding = cf_getPadding(opts.padding);
182
-
183
- if (opts.align == 'top')
184
- {
185
- opts.align = 'left';
186
- }
187
- else if (opts.align == 'bottom')
188
- {
189
- opts.align = 'right';
190
- }
191
-
192
- switch (opts.align)
193
- {
194
- // align: center, left or right
195
- case 'center':
196
- case 'left':
197
- case 'right':
198
- if (opts[opts.d['width']] != 'variable')
199
- {
200
- opts = in_getAlignPadding(opts, a_itm);
201
- opts.usePadding = true;
202
- }
203
- break;
204
-
205
- // padding
206
- default:
207
- opts.align = false;
208
- opts.usePadding = (
209
- opts.padding[0] == 0 &&
210
- opts.padding[1] == 0 &&
211
- opts.padding[2] == 0 &&
212
- opts.padding[3] == 0
213
- ) ? false : true;
214
- break;
215
- }
216
- }
217
-
218
- if (!is_number(opts.scroll.duration))
219
- {
220
- opts.scroll.duration = 500;
221
- }
222
- if (is_undefined(opts.scroll.items))
223
- {
224
- opts.scroll.items = (opts.responsive || opts.items.visibleConf.variable || opts.items.filter != '*')
225
- ? 'visible'
226
- : opts.items.visible;
227
- }
228
-
229
- opts.auto = $.extend(true, {}, opts.scroll, opts.auto);
230
- opts.prev = $.extend(true, {}, opts.scroll, opts.prev);
231
- opts.next = $.extend(true, {}, opts.scroll, opts.next);
232
- opts.pagination = $.extend(true, {}, opts.scroll, opts.pagination);
233
- // swipe and mousewheel extend later on, per direction
234
-
235
- opts.auto = go_complementAutoObject($tt0, opts.auto);
236
- opts.prev = go_complementPrevNextObject($tt0, opts.prev);
237
- opts.next = go_complementPrevNextObject($tt0, opts.next);
238
- opts.pagination = go_complementPaginationObject($tt0, opts.pagination);
239
- opts.swipe = go_complementSwipeObject($tt0, opts.swipe);
240
- opts.mousewheel = go_complementMousewheelObject($tt0, opts.mousewheel);
241
-
242
- if (opts.synchronise)
243
- {
244
- opts.synchronise = cf_getSynchArr(opts.synchronise);
245
- }
246
-
247
-
248
- // DEPRECATED
249
- if (opts.auto.onPauseStart)
250
- {
251
- opts.auto.onTimeoutStart = opts.auto.onPauseStart;
252
- deprecated('auto.onPauseStart', 'auto.onTimeoutStart');
253
- }
254
- if (opts.auto.onPausePause)
255
- {
256
- opts.auto.onTimeoutPause = opts.auto.onPausePause;
257
- deprecated('auto.onPausePause', 'auto.onTimeoutPause');
258
- }
259
- if (opts.auto.onPauseEnd)
260
- {
261
- opts.auto.onTimeoutEnd = opts.auto.onPauseEnd;
262
- deprecated('auto.onPauseEnd', 'auto.onTimeoutEnd');
263
- }
264
- if (opts.auto.pauseDuration)
265
- {
266
- opts.auto.timeoutDuration = opts.auto.pauseDuration;
267
- deprecated('auto.pauseDuration', 'auto.timeoutDuration');
268
- }
269
- // /DEPRECATED
270
-
271
-
272
- }; // /init
273
-
274
-
275
- FN._build = function() {
276
- $cfs.data('_cfs_isCarousel', true);
277
-
278
- var a_itm = $cfs.children(),
279
- orgCSS = in_mapCss($cfs, ['textAlign', 'float', 'position', 'top', 'right', 'bottom', 'left', 'zIndex', 'width', 'height', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft']),
280
- newPosition = 'relative';
281
-
282
- switch (orgCSS.position)
283
- {
284
- case 'absolute':
285
- case 'fixed':
286
- newPosition = orgCSS.position;
287
- break;
288
- }
289
-
290
- if (conf.wrapper == 'parent')
291
- {
292
- sz_storeOrigCss($wrp);
293
- }
294
- else
295
- {
296
- $wrp.css(orgCSS);
297
- }
298
- $wrp.css({
299
- 'overflow' : 'hidden',
300
- 'position' : newPosition
301
- });
302
-
303
- sz_storeOrigCss($cfs);
304
- $cfs.data('_cfs_origCssZindex', orgCSS.zIndex);
305
- $cfs.css({
306
- 'textAlign' : 'left',
307
- 'float' : 'none',
308
- 'position' : 'absolute',
309
- 'top' : 0,
310
- 'right' : 'auto',
311
- 'bottom' : 'auto',
312
- 'left' : 0,
313
- 'marginTop' : 0,
314
- 'marginRight' : 0,
315
- 'marginBottom' : 0,
316
- 'marginLeft' : 0
317
- });
318
-
319
- sz_storeMargin(a_itm, opts);
320
- sz_storeOrigCss(a_itm);
321
- if (opts.responsive)
322
- {
323
- sz_setResponsiveSizes(opts, a_itm);
324
- }
325
-
326
- }; // /build
327
-
328
-
329
- FN._bind_events = function() {
330
- FN._unbind_events();
331
-
332
-
333
- // stop event
334
- $cfs.bind(cf_e('stop', conf), function(e, imm) {
335
- e.stopPropagation();
336
-
337
- // button
338
- if (!crsl.isStopped)
339
- {
340
- if (opts.auto.button)
341
- {
342
- opts.auto.button.addClass(cf_c('stopped', conf));
343
- }
344
- }
345
-
346
- // set stopped
347
- crsl.isStopped = true;
348
-
349
- if (opts.auto.play)
350
- {
351
- opts.auto.play = false;
352
- $cfs.trigger(cf_e('pause', conf), imm);
353
- }
354
- return true;
355
- });
356
-
357
-
358
- // finish event
359
- $cfs.bind(cf_e('finish', conf), function(e) {
360
- e.stopPropagation();
361
- if (crsl.isScrolling)
362
- {
363
- sc_stopScroll(scrl);
364
- }
365
- return true;
366
- });
367
-
368
-
369
- // pause event
370
- $cfs.bind(cf_e('pause', conf), function(e, imm, res) {
371
- e.stopPropagation();
372
- tmrs = sc_clearTimers(tmrs);
373
-
374
- // immediately pause
375
- if (imm && crsl.isScrolling)
376
- {
377
- scrl.isStopped = true;
378
- var nst = getTime() - scrl.startTime;
379
- scrl.duration -= nst;
380
- if (scrl.pre)
381
- {
382
- scrl.pre.duration -= nst;
383
- }
384
- if (scrl.post)
385
- {
386
- scrl.post.duration -= nst;
387
- }
388
- sc_stopScroll(scrl, false);
389
- }
390
-
391
- // update remaining pause-time
392
- if (!crsl.isPaused && !crsl.isScrolling)
393
- {
394
- if (res)
395
- {
396
- tmrs.timePassed += getTime() - tmrs.startTime;
397
- }
398
- }
399
-
400
- // button
401
- if (!crsl.isPaused)
402
- {
403
- if (opts.auto.button)
404
- {
405
- opts.auto.button.addClass(cf_c('paused', conf));
406
- }
407
- }
408
-
409
- // set paused
410
- crsl.isPaused = true;
411
-
412
- // pause pause callback
413
- if (opts.auto.onTimeoutPause)
414
- {
415
- var dur1 = opts.auto.timeoutDuration - tmrs.timePassed,
416
- perc = 100 - Math.ceil( dur1 * 100 / opts.auto.timeoutDuration );
417
-
418
- opts.auto.onTimeoutPause.call($tt0, perc, dur1);
419
- }
420
- return true;
421
- });
422
-
423
-
424
- // play event
425
- $cfs.bind(cf_e('play', conf), function(e, dir, del, res) {
426
- e.stopPropagation();
427
- tmrs = sc_clearTimers(tmrs);
428
-
429
- // sort params
430
- var v = [dir, del, res],
431
- t = ['string', 'number', 'boolean'],
432
- a = cf_sortParams(v, t);
433
-
434
- dir = a[0];
435
- del = a[1];
436
- res = a[2];
437
-
438
- if (dir != 'prev' && dir != 'next')
439
- {
440
- dir = crsl.direction;
441
- }
442
- if (!is_number(del))
443
- {
444
- del = 0;
445
- }
446
- if (!is_boolean(res))
447
- {
448
- res = false;
449
- }
450
-
451
- // stopped?
452
- if (res)
453
- {
454
- crsl.isStopped = false;
455
- opts.auto.play = true;
456
- }
457
- if (!opts.auto.play)
458
- {
459
- e.stopImmediatePropagation();
460
- return debug(conf, 'Carousel stopped: Not scrolling.');
461
- }
462
-
463
- // button
464
- if (crsl.isPaused)
465
- {
466
- if (opts.auto.button)
467
- {
468
- opts.auto.button.removeClass(cf_c('stopped', conf));
469
- opts.auto.button.removeClass(cf_c('paused', conf));
470
- }
471
- }
472
-
473
- // set playing
474
- crsl.isPaused = false;
475
- tmrs.startTime = getTime();
476
-
477
- // timeout the scrolling
478
- var dur1 = opts.auto.timeoutDuration + del;
479
- dur2 = dur1 - tmrs.timePassed;
480
- perc = 100 - Math.ceil(dur2 * 100 / dur1);
481
-
482
- if (opts.auto.progress)
483
- {
484
- tmrs.progress = setInterval(function() {
485
- var pasd = getTime() - tmrs.startTime + tmrs.timePassed,
486
- perc = Math.ceil(pasd * 100 / dur1);
487
- opts.auto.progress.updater.call(opts.auto.progress.bar[0], perc);
488
- }, opts.auto.progress.interval);
489
- }
490
-
491
- tmrs.auto = setTimeout(function() {
492
- if (opts.auto.progress)
493
- {
494
- opts.auto.progress.updater.call(opts.auto.progress.bar[0], 100);
495
- }
496
- if (opts.auto.onTimeoutEnd)
497
- {
498
- opts.auto.onTimeoutEnd.call($tt0, perc, dur2);
499
- }
500
- if (crsl.isScrolling)
501
- {
502
- $cfs.trigger(cf_e('play', conf), dir);
503
- }
504
- else
505
- {
506
- $cfs.trigger(cf_e(dir, conf), opts.auto);
507
- }
508
- }, dur2);
509
-
510
- // pause start callback
511
- if (opts.auto.onTimeoutStart)
512
- {
513
- opts.auto.onTimeoutStart.call($tt0, perc, dur2);
514
- }
515
-
516
- return true;
517
- });
518
-
519
-
520
- // resume event
521
- $cfs.bind(cf_e('resume', conf), function(e) {
522
- e.stopPropagation();
523
- if (scrl.isStopped)
524
- {
525
- scrl.isStopped = false;
526
- crsl.isPaused = false;
527
- crsl.isScrolling = true;
528
- scrl.startTime = getTime();
529
- sc_startScroll(scrl, conf);
530
- }
531
- else
532
- {
533
- $cfs.trigger(cf_e('play', conf));
534
- }
535
- return true;
536
- });
537
-
538
-
539
- // prev + next events
540
- $cfs.bind(cf_e('prev', conf)+' '+cf_e('next', conf), function(e, obj, num, clb, que) {
541
- e.stopPropagation();
542
-
543
- // stopped or hidden carousel, don't scroll, don't queue
544
- if (crsl.isStopped || $cfs.is(':hidden'))
545
- {
546
- e.stopImmediatePropagation();
547
- return debug(conf, 'Carousel stopped or hidden: Not scrolling.');
548
- }
549
-
550
- // not enough items
551
- var minimum = (is_number(opts.items.minimum)) ? opts.items.minimum : opts.items.visible + 1;
552
- if (minimum > itms.total)
553
- {
554
- e.stopImmediatePropagation();
555
- return debug(conf, 'Not enough items ('+itms.total+' total, '+minimum+' needed): Not scrolling.');
556
- }
557
-
558
- // get config
559
- var v = [obj, num, clb, que],
560
- t = ['object', 'number/string', 'function', 'boolean'],
561
- a = cf_sortParams(v, t);
562
-
563
- obj = a[0];
564
- num = a[1];
565
- clb = a[2];
566
- que = a[3];
567
-
568
- var eType = e.type.slice(conf.events.prefix.length);
569
-
570
- if (!is_object(obj))
571
- {
572
- obj = {};
573
- }
574
- if (is_function(clb))
575
- {
576
- obj.onAfter = clb;
577
- }
578
- if (is_boolean(que))
579
- {
580
- obj.queue = que;
581
- }
582
- obj = $.extend(true, {}, opts[eType], obj);
583
-
584
- // test conditions callback
585
- if (obj.conditions && !obj.conditions.call($tt0, eType))
586
- {
587
- e.stopImmediatePropagation();
588
- return debug(conf, 'Callback "conditions" returned false.');
589
- }
590
-
591
- if (!is_number(num))
592
- {
593
- if (opts.items.filter != '*')
594
- {
595
- num = 'visible';
596
- }
597
- else
598
- {
599
- var arr = [num, obj.items, opts[eType].items];
600
- for (var a = 0, l = arr.length; a < l; a++)
601
- {
602
- if (is_number(arr[a]) || arr[a] == 'page' || arr[a] == 'visible') {
603
- num = arr[a];
604
- break;
605
- }
606
- }
607
- }
608
- switch(num) {
609
- case 'page':
610
- e.stopImmediatePropagation();
611
- return $cfs.triggerHandler(cf_e(eType+'Page', conf), [obj, clb]);
612
- break;
613
-
614
- case 'visible':
615
- if (!opts.items.visibleConf.variable && opts.items.filter == '*')
616
- {
617
- num = opts.items.visible;
618
- }
619
- break;
620
- }
621
- }
622
-
623
- // resume animation, add current to queue
624
- if (scrl.isStopped)
625
- {
626
- $cfs.trigger(cf_e('resume', conf));
627
- $cfs.trigger(cf_e('queue', conf), [eType, [obj, num, clb]]);
628
- e.stopImmediatePropagation();
629
- return debug(conf, 'Carousel resumed scrolling.');
630
- }
631
-
632
- // queue if scrolling
633
- if (obj.duration > 0)
634
- {
635
- if (crsl.isScrolling)
636
- {
637
- if (obj.queue)
638
- {
639
- if (obj.queue == 'last')
640
- {
641
- queu = [];
642
- }
643
- if (obj.queue != 'first' || queu.length == 0)
644
- {
645
- $cfs.trigger(cf_e('queue', conf), [eType, [obj, num, clb]]);
646
- }
647
- }
648
- e.stopImmediatePropagation();
649
- return debug(conf, 'Carousel currently scrolling.');
650
- }
651
- }
652
-
653
- tmrs.timePassed = 0;
654
- $cfs.trigger(cf_e('slide_'+eType, conf), [obj, num]);
655
-
656
- // synchronise
657
- if (opts.synchronise)
658
- {
659
- var s = opts.synchronise,
660
- c = [obj, num];
661
-
662
- for (var j = 0, l = s.length; j < l; j++) {
663
- var d = eType;
664
- if (!s[j][2])
665
- {
666
- d = (d == 'prev') ? 'next' : 'prev';
667
- }
668
- if (!s[j][1])
669
- {
670
- c[0] = s[j][0].triggerHandler('_cfs_triggerEvent', ['configuration', d]);
671
- }
672
- c[1] = num + s[j][3];
673
- s[j][0].trigger('_cfs_triggerEvent', ['slide_'+d, c]);
674
- }
675
- }
676
- return true;
677
- });
678
-
679
-
680
- // prev event
681
- $cfs.bind(cf_e('slide_prev', conf), function(e, sO, nI) {
682
- e.stopPropagation();
683
- var a_itm = $cfs.children();
684
-
685
- // non-circular at start, scroll to end
686
- if (!opts.circular)
687
- {
688
- if (itms.first == 0)
689
- {
690
- if (opts.infinite)
691
- {
692
- $cfs.trigger(cf_e('next', conf), itms.total-1);
693
- }
694
- return e.stopImmediatePropagation();
695
- }
696
- }
697
-
698
- sz_resetMargin(a_itm, opts);
699
-
700
- // find number of items to scroll
701
- if (!is_number(nI))
702
- {
703
- if (opts.items.visibleConf.variable)
704
- {
705
- nI = gn_getVisibleItemsPrev(a_itm, opts, itms.total-1);
706
- }
707
- else if (opts.items.filter != '*')
708
- {
709
- var xI = (is_number(sO.items)) ? sO.items : gn_getVisibleOrg($cfs, opts);
710
- nI = gn_getScrollItemsPrevFilter(a_itm, opts, itms.total-1, xI);
711
- }
712
- else
713
- {
714
- nI = opts.items.visible;
715
- }
716
- nI = cf_getAdjust(nI, opts, sO.items, $tt0);
717
- }
718
-
719
- // prevent non-circular from scrolling to far
720
- if (!opts.circular)
721
- {
722
- if (itms.total - nI < itms.first)
723
- {
724
- nI = itms.total - itms.first;
725
- }
726
- }
727
-
728
- // set new number of visible items
729
- opts.items.visibleConf.old = opts.items.visible;
730
- if (opts.items.visibleConf.variable)
731
- {
732
- var vI = cf_getItemsAdjust(gn_getVisibleItemsNext(a_itm, opts, itms.total-nI), opts, opts.items.visibleConf.adjust, $tt0);
733
- if (opts.items.visible+nI <= vI && nI < itms.total)
734
- {
735
- nI++;
736
- vI = cf_getItemsAdjust(gn_getVisibleItemsNext(a_itm, opts, itms.total-nI), opts, opts.items.visibleConf.adjust, $tt0);
737
- }
738
- opts.items.visible = vI;
739
- }
740
- else if (opts.items.filter != '*')
741
- {
742
- var vI = gn_getVisibleItemsNextFilter(a_itm, opts, itms.total-nI);
743
- opts.items.visible = cf_getItemsAdjust(vI, opts, opts.items.visibleConf.adjust, $tt0);
744
- }
745
-
746
- sz_resetMargin(a_itm, opts, true);
747
-
748
- // scroll 0, don't scroll
749
- if (nI == 0)
750
- {
751
- e.stopImmediatePropagation();
752
- return debug(conf, '0 items to scroll: Not scrolling.');
753
- }
754
- debug(conf, 'Scrolling '+nI+' items backward.');
755
-
756
-
757
- // save new config
758
- itms.first += nI;
759
- while (itms.first >= itms.total)
760
- {
761
- itms.first -= itms.total;
762
- }
763
-
764
- // non-circular callback
765
- if (!opts.circular)
766
- {
767
- if (itms.first == 0 && sO.onEnd)
768
- {
769
- sO.onEnd.call($tt0, 'prev');
770
- }
771
- if (!opts.infinite)
772
- {
773
- nv_enableNavi(opts, itms.first, conf);
774
- }
775
- }
776
-
777
- // rearrange items
778
- $cfs.children().slice(itms.total-nI, itms.total).prependTo($cfs);
779
- if (itms.total < opts.items.visible + nI)
780
- {
781
- $cfs.children().slice(0, (opts.items.visible+nI)-itms.total).clone(true).appendTo($cfs);
782
- }
783
-
784
- // the needed items
785
- var a_itm = $cfs.children(),
786
- i_old = gi_getOldItemsPrev(a_itm, opts, nI),
787
- i_new = gi_getNewItemsPrev(a_itm, opts),
788
- i_cur_l = a_itm.eq(nI-1),
789
- i_old_l = i_old.last(),
790
- i_new_l = i_new.last();
791
-
792
- sz_resetMargin(a_itm, opts);
793
-
794
- var pL = 0,
795
- pR = 0;
796
-
797
- if (opts.align)
798
- {
799
- var p = cf_getAlignPadding(i_new, opts);
800
- pL = p[0];
801
- pR = p[1];
802
- }
803
- var oL = (pL < 0) ? opts.padding[opts.d[3]] : 0;
804
-
805
- // hide items for fx directscroll
806
- var hiddenitems = false,
807
- i_skp = $();
808
- if (opts.items.visible < nI)
809
- {
810
- i_skp = a_itm.slice(opts.items.visibleConf.old, nI);
811
- if (sO.fx == 'directscroll')
812
- {
813
- var orgW = opts.items[opts.d['width']];
814
- hiddenitems = i_skp;
815
- i_cur_l = i_new_l;
816
- sc_hideHiddenItems(hiddenitems);
817
- opts.items[opts.d['width']] = 'variable';
818
- }
819
- }
820
- // save new sizes
821
- var $cf2 = false,
822
- i_siz = ms_getTotalSize(a_itm.slice(0, nI), opts, 'width'),
823
- w_siz = cf_mapWrapperSizes(ms_getSizes(i_new, opts, true), opts, !opts.usePadding),
824
- i_siz_vis = 0,
825
- a_cfs = {},
826
- a_wsz = {},
827
- a_cur = {},
828
- a_old = {},
829
- a_new = {},
830
- a_lef = {},
831
- a_lef_vis = {},
832
- a_dur = sc_getDuration(sO, opts, nI, i_siz);
833
-
834
- switch(sO.fx)
835
- {
836
- case 'cover':
837
- case 'cover-fade':
838
- i_siz_vis = ms_getTotalSize(a_itm.slice(0, opts.items.visible), opts, 'width');
839
- break;
840
- }
841
-
842
- if (hiddenitems)
843
- {
844
- opts.items[opts.d['width']] = orgW;
845
- }
846
-
847
- sz_resetMargin(a_itm, opts, true);
848
- if (pR >= 0)
849
- {
850
- sz_resetMargin(i_old_l, opts, opts.padding[opts.d[1]]);
851
- }
852
- if (pL >= 0)
853
- {
854
- sz_resetMargin(i_cur_l, opts, opts.padding[opts.d[3]]);
855
- }
856
-
857
- if (opts.align)
858
- {
859
- opts.padding[opts.d[1]] = pR;
860
- opts.padding[opts.d[3]] = pL;
861
- }
862
-
863
- a_lef[opts.d['left']] = -(i_siz - oL);
864
- a_lef_vis[opts.d['left']] = -(i_siz_vis - oL);
865
- a_wsz[opts.d['left']] = w_siz[opts.d['width']];
866
-
867
- // scrolling functions
868
- var _s_wrapper = function() {},
869
- _a_wrapper = function() {},
870
- _s_paddingold = function() {},
871
- _a_paddingold = function() {},
872
- _s_paddingnew = function() {},
873
- _a_paddingnew = function() {},
874
- _s_paddingcur = function() {},
875
- _a_paddingcur = function() {},
876
- _onafter = function() {},
877
- _moveitems = function() {},
878
- _position = function() {};
879
-
880
- // clone carousel
881
- switch(sO.fx)
882
- {
883
- case 'crossfade':
884
- case 'cover':
885
- case 'cover-fade':
886
- case 'uncover':
887
- case 'uncover-fade':
888
- $cf2 = $cfs.clone(true).appendTo($wrp);
889
- break;
890
- }
891
- switch(sO.fx)
892
- {
893
- case 'crossfade':
894
- case 'uncover':
895
- case 'uncover-fade':
896
- $cf2.children().slice(0, nI).remove();
897
- $cf2.children().slice(opts.items.visibleConf.old).remove();
898
- break;
899
-
900
- case 'cover':
901
- case 'cover-fade':
902
- $cf2.children().slice(opts.items.visible).remove();
903
- $cf2.css(a_lef_vis);
904
- break;
905
- }
906
-
907
- $cfs.css(a_lef);
908
-
909
- // reset all scrolls
910
- scrl = sc_setScroll(a_dur, sO.easing, conf);
911
-
912
- // animate / set carousel
913
- a_cfs[opts.d['left']] = (opts.usePadding) ? opts.padding[opts.d[3]] : 0;
914
-
915
- // animate / set wrapper
916
- if (opts[opts.d['width']] == 'variable' || opts[opts.d['height']] == 'variable')
917
- {
918
- _s_wrapper = function() {
919
- $wrp.css(w_siz);
920
- };
921
- _a_wrapper = function() {
922
- scrl.anims.push([$wrp, w_siz]);
923
- };
924
- }
925
-
926
- // animate / set items
927
- if (opts.usePadding)
928
- {
929
- if (i_new_l.not(i_cur_l).length)
930
- {
931
- a_cur[opts.d['marginRight']] = i_cur_l.data('_cfs_origCssMargin');
932
-
933
- if (pL < 0)
934
- {
935
- i_cur_l.css(a_cur);
936
- }
937
- else
938
- {
939
- _s_paddingcur = function() {
940
- i_cur_l.css(a_cur);
941
- };
942
- _a_paddingcur = function() {
943
- scrl.anims.push([i_cur_l, a_cur]);
944
- };
945
- }
946
- }
947
- switch(sO.fx)
948
- {
949
- case 'cover':
950
- case 'cover-fade':
951
- $cf2.children().eq(nI-1).css(a_cur);
952
- break;
953
- }
954
-
955
- if (i_new_l.not(i_old_l).length)
956
- {
957
- a_old[opts.d['marginRight']] = i_old_l.data('_cfs_origCssMargin');
958
- _s_paddingold = function() {
959
- i_old_l.css(a_old);
960
- };
961
- _a_paddingold = function() {
962
- scrl.anims.push([i_old_l, a_old]);
963
- };
964
- }
965
-
966
- if (pR >= 0)
967
- {
968
- a_new[opts.d['marginRight']] = i_new_l.data('_cfs_origCssMargin') + opts.padding[opts.d[1]];
969
- _s_paddingnew = function() {
970
- i_new_l.css(a_new);
971
- };
972
- _a_paddingnew = function() {
973
- scrl.anims.push([i_new_l, a_new]);
974
- };
975
- }
976
- }
977
-
978
- // set position
979
- _position = function() {
980
- $cfs.css(a_cfs);
981
- };
982
-
983
-
984
- var overFill = opts.items.visible+nI-itms.total;
985
-
986
- // rearrange items
987
- _moveitems = function() {
988
- if (overFill > 0)
989
- {
990
- $cfs.children().slice(itms.total).remove();
991
- i_old = $( $cfs.children().slice(itms.total-(opts.items.visible-overFill)).get().concat( $cfs.children().slice(0, overFill).get() ) );
992
- }
993
- sc_showHiddenItems(hiddenitems);
994
-
995
- if (opts.usePadding)
996
- {
997
- var l_itm = $cfs.children().eq(opts.items.visible+nI-1);
998
- l_itm.css(opts.d['marginRight'], l_itm.data('_cfs_origCssMargin'));
999
- }
1000
- };
1001
-
1002
-
1003
- var cb_arguments = sc_mapCallbackArguments(i_old, i_skp, i_new, nI, 'prev', a_dur, w_siz);
1004
-
1005
- // fire onAfter callbacks
1006
- _onafter = function() {
1007
- sc_afterScroll($cfs, $cf2, sO);
1008
- crsl.isScrolling = false;
1009
- clbk.onAfter = sc_fireCallbacks($tt0, sO, 'onAfter', cb_arguments, clbk);
1010
- queu = sc_fireQueue($cfs, queu, conf);
1011
-
1012
- if (!crsl.isPaused)
1013
- {
1014
- $cfs.trigger(cf_e('play', conf));
1015
- }
1016
- };
1017
-
1018
- // fire onBefore callback
1019
- crsl.isScrolling = true;
1020
- tmrs = sc_clearTimers(tmrs);
1021
- clbk.onBefore = sc_fireCallbacks($tt0, sO, 'onBefore', cb_arguments, clbk);
1022
-
1023
- switch(sO.fx)
1024
- {
1025
- case 'none':
1026
- $cfs.css(a_cfs);
1027
- _s_wrapper();
1028
- _s_paddingold();
1029
- _s_paddingnew();
1030
- _s_paddingcur();
1031
- _position();
1032
- _moveitems();
1033
- _onafter();
1034
- break;
1035
-
1036
- case 'fade':
1037
- scrl.anims.push([$cfs, { 'opacity': 0 }, function() {
1038
- _s_wrapper();
1039
- _s_paddingold();
1040
- _s_paddingnew();
1041
- _s_paddingcur();
1042
- _position();
1043
- _moveitems();
1044
- scrl = sc_setScroll(a_dur, sO.easing, conf);
1045
- scrl.anims.push([$cfs, { 'opacity': 1 }, _onafter]);
1046
- sc_startScroll(scrl, conf);
1047
- }]);
1048
- break;
1049
-
1050
- case 'crossfade':
1051
- $cfs.css({ 'opacity': 0 });
1052
- scrl.anims.push([$cf2, { 'opacity': 0 }]);
1053
- scrl.anims.push([$cfs, { 'opacity': 1 }, _onafter]);
1054
- _a_wrapper();
1055
- _s_paddingold();
1056
- _s_paddingnew();
1057
- _s_paddingcur();
1058
- _position();
1059
- _moveitems();
1060
- break;
1061
-
1062
- case 'cover':
1063
- scrl.anims.push([$cf2, a_cfs, function() {
1064
- _s_paddingold();
1065
- _s_paddingnew();
1066
- _s_paddingcur();
1067
- _position();
1068
- _moveitems();
1069
- _onafter();
1070
- }]);
1071
- _a_wrapper();
1072
- break;
1073
-
1074
- case 'cover-fade':
1075
- scrl.anims.push([$cfs, { 'opacity': 0 }]);
1076
- scrl.anims.push([$cf2, a_cfs, function() {
1077
- _s_paddingold();
1078
- _s_paddingnew();
1079
- _s_paddingcur();
1080
- _position();
1081
- _moveitems();
1082
- _onafter();
1083
- }]);
1084
- _a_wrapper();
1085
- break;
1086
-
1087
- case 'uncover':
1088
- scrl.anims.push([$cf2, a_wsz, _onafter]);
1089
- _a_wrapper();
1090
- _s_paddingold();
1091
- _s_paddingnew();
1092
- _s_paddingcur();
1093
- _position();
1094
- _moveitems();
1095
- break;
1096
-
1097
- case 'uncover-fade':
1098
- $cfs.css({ 'opacity': 0 });
1099
- scrl.anims.push([$cfs, { 'opacity': 1 }]);
1100
- scrl.anims.push([$cf2, a_wsz, _onafter]);
1101
- _a_wrapper();
1102
- _s_paddingold();
1103
- _s_paddingnew();
1104
- _s_paddingcur();
1105
- _position();
1106
- _moveitems();
1107
- break;
1108
-
1109
- default:
1110
- scrl.anims.push([$cfs, a_cfs, function() {
1111
- _moveitems();
1112
- _onafter();
1113
- }]);
1114
- _a_wrapper();
1115
- _a_paddingold();
1116
- _a_paddingnew();
1117
- _a_paddingcur();
1118
- break;
1119
- }
1120
-
1121
- sc_startScroll(scrl, conf);
1122
- cf_setCookie(opts.cookie, $cfs, conf);
1123
-
1124
- $cfs.trigger(cf_e('updatePageStatus', conf), [false, w_siz]);
1125
-
1126
- return true;
1127
- });
1128
-
1129
-
1130
- // next event
1131
- $cfs.bind(cf_e('slide_next', conf), function(e, sO, nI) {
1132
- e.stopPropagation();
1133
- var a_itm = $cfs.children();
1134
-
1135
- // non-circular at end, scroll to start
1136
- if (!opts.circular)
1137
- {
1138
- if (itms.first == opts.items.visible)
1139
- {
1140
- if (opts.infinite)
1141
- {
1142
- $cfs.trigger(cf_e('prev', conf), itms.total-1);
1143
- }
1144
- return e.stopImmediatePropagation();
1145
- }
1146
- }
1147
-
1148
- sz_resetMargin(a_itm, opts);
1149
-
1150
- // find number of items to scroll
1151
- if (!is_number(nI))
1152
- {
1153
- if (opts.items.filter != '*')
1154
- {
1155
- var xI = (is_number(sO.items)) ? sO.items : gn_getVisibleOrg($cfs, opts);
1156
- nI = gn_getScrollItemsNextFilter(a_itm, opts, 0, xI);
1157
- }
1158
- else
1159
- {
1160
- nI = opts.items.visible;
1161
- }
1162
- nI = cf_getAdjust(nI, opts, sO.items, $tt0);
1163
- }
1164
-
1165
- var lastItemNr = (itms.first == 0) ? itms.total : itms.first;
1166
-
1167
- // prevent non-circular from scrolling to far
1168
- if (!opts.circular)
1169
- {
1170
- if (opts.items.visibleConf.variable)
1171
- {
1172
- var vI = gn_getVisibleItemsNext(a_itm, opts, nI),
1173
- xI = gn_getVisibleItemsPrev(a_itm, opts, lastItemNr-1);
1174
- }
1175
- else
1176
- {
1177
- var vI = opts.items.visible,
1178
- xI = opts.items.visible;
1179
- }
1180
-
1181
- if (nI + vI > lastItemNr)
1182
- {
1183
- nI = lastItemNr - xI;
1184
- }
1185
- }
1186
-
1187
- // set new number of visible items
1188
- opts.items.visibleConf.old = opts.items.visible;
1189
- if (opts.items.visibleConf.variable)
1190
- {
1191
- var vI = cf_getItemsAdjust(gn_getVisibleItemsNextTestCircular(a_itm, opts, nI, lastItemNr), opts, opts.items.visibleConf.adjust, $tt0);
1192
- while (opts.items.visible-nI >= vI && nI < itms.total)
1193
- {
1194
- nI++;
1195
- vI = cf_getItemsAdjust(gn_getVisibleItemsNextTestCircular(a_itm, opts, nI, lastItemNr), opts, opts.items.visibleConf.adjust, $tt0);
1196
- }
1197
- opts.items.visible = vI;
1198
- }
1199
- else if (opts.items.filter != '*')
1200
- {
1201
- var vI = gn_getVisibleItemsNextFilter(a_itm, opts, nI);
1202
- opts.items.visible = cf_getItemsAdjust(vI, opts, opts.items.visibleConf.adjust, $tt0);
1203
- }
1204
-
1205
- sz_resetMargin(a_itm, opts, true);
1206
-
1207
- // scroll 0, don't scroll
1208
- if (nI == 0)
1209
- {
1210
- e.stopImmediatePropagation();
1211
- return debug(conf, '0 items to scroll: Not scrolling.');
1212
- }
1213
- debug(conf, 'Scrolling '+nI+' items forward.');
1214
-
1215
-
1216
- // save new config
1217
- itms.first -= nI;
1218
- while (itms.first < 0)
1219
- {
1220
- itms.first += itms.total;
1221
- }
1222
-
1223
- // non-circular callback
1224
- if (!opts.circular)
1225
- {
1226
- if (itms.first == opts.items.visible && sO.onEnd)
1227
- {
1228
- sO.onEnd.call($tt0, 'next');
1229
- }
1230
- if (!opts.infinite)
1231
- {
1232
- nv_enableNavi(opts, itms.first, conf);
1233
- }
1234
- }
1235
-
1236
- // rearrange items
1237
- if (itms.total < opts.items.visible+nI)
1238
- {
1239
- $cfs.children().slice(0, (opts.items.visible+nI)-itms.total).clone(true).appendTo($cfs);
1240
- }
1241
-
1242
- // the needed items
1243
- var a_itm = $cfs.children(),
1244
- i_old = gi_getOldItemsNext(a_itm, opts),
1245
- i_new = gi_getNewItemsNext(a_itm, opts, nI),
1246
- i_cur_l = a_itm.eq(nI-1),
1247
- i_old_l = i_old.last(),
1248
- i_new_l = i_new.last();
1249
-
1250
- sz_resetMargin(a_itm, opts);
1251
-
1252
- var pL = 0,
1253
- pR = 0;
1254
-
1255
- if (opts.align)
1256
- {
1257
- var p = cf_getAlignPadding(i_new, opts);
1258
- pL = p[0];
1259
- pR = p[1];
1260
- }
1261
-
1262
- // hide items for fx directscroll
1263
- var hiddenitems = false,
1264
- i_skp = $();
1265
- if (opts.items.visibleConf.old < nI)
1266
- {
1267
- i_skp = a_itm.slice(opts.items.visibleConf.old, nI);
1268
- if (sO.fx == 'directscroll')
1269
- {
1270
- var orgW = opts.items[opts.d['width']];
1271
- hiddenitems = i_skp;
1272
- i_cur_l = i_old_l;
1273
- sc_hideHiddenItems(hiddenitems);
1274
- opts.items[opts.d['width']] = 'variable';
1275
- }
1276
- }
1277
- // save new sizes
1278
- var $cf2 = false,
1279
- i_siz = ms_getTotalSize(a_itm.slice(0, nI), opts, 'width'),
1280
- w_siz = cf_mapWrapperSizes(ms_getSizes(i_new, opts, true), opts, !opts.usePadding),
1281
- i_siz_vis = 0,
1282
- a_cfs = {},
1283
- a_cfs_vis = {},
1284
- a_cur = {},
1285
- a_old = {},
1286
- a_lef = {},
1287
- a_dur = sc_getDuration(sO, opts, nI, i_siz);
1288
-
1289
- switch(sO.fx)
1290
- {
1291
- case 'uncover':
1292
- case 'uncover-fade':
1293
- i_siz_vis = ms_getTotalSize(a_itm.slice(0, opts.items.visibleConf.old), opts, 'width');
1294
- break;
1295
- }
1296
-
1297
- if (hiddenitems)
1298
- {
1299
- opts.items[opts.d['width']] = orgW;
1300
- }
1301
-
1302
- if (opts.align)
1303
- {
1304
- if (opts.padding[opts.d[1]] < 0)
1305
- {
1306
- opts.padding[opts.d[1]] = 0;
1307
- }
1308
- }
1309
- sz_resetMargin(a_itm, opts, true);
1310
- sz_resetMargin(i_old_l, opts, opts.padding[opts.d[1]]);
1311
-
1312
- if (opts.align)
1313
- {
1314
- opts.padding[opts.d[1]] = pR;
1315
- opts.padding[opts.d[3]] = pL;
1316
- }
1317
-
1318
- a_lef[opts.d['left']] = (opts.usePadding) ? opts.padding[opts.d[3]] : 0;
1319
-
1320
- // scrolling functions
1321
- var _s_wrapper = function() {},
1322
- _a_wrapper = function() {},
1323
- _s_paddingold = function() {},
1324
- _a_paddingold = function() {},
1325
- _s_paddingcur = function() {},
1326
- _a_paddingcur = function() {},
1327
- _onafter = function() {},
1328
- _moveitems = function() {},
1329
- _position = function() {};
1330
-
1331
- // clone carousel
1332
- switch(sO.fx)
1333
- {
1334
- case 'crossfade':
1335
- case 'cover':
1336
- case 'cover-fade':
1337
- case 'uncover':
1338
- case 'uncover-fade':
1339
- $cf2 = $cfs.clone(true).appendTo($wrp);
1340
- $cf2.children().slice(opts.items.visibleConf.old).remove();
1341
- break;
1342
- }
1343
- switch(sO.fx)
1344
- {
1345
- case 'crossfade':
1346
- case 'cover':
1347
- case 'cover-fade':
1348
- $cfs.css('zIndex', 1);
1349
- $cf2.css('zIndex', 0);
1350
- break;
1351
- }
1352
-
1353
- // reset all scrolls
1354
- scrl = sc_setScroll(a_dur, sO.easing, conf);
1355
-
1356
- // animate / set carousel
1357
- a_cfs[opts.d['left']] = -i_siz;
1358
- a_cfs_vis[opts.d['left']] = -i_siz_vis;
1359
-
1360
- if (pL < 0)
1361
- {
1362
- a_cfs[opts.d['left']] += pL;
1363
- }
1364
-
1365
- // animate / set wrapper
1366
- if (opts[opts.d['width']] == 'variable' || opts[opts.d['height']] == 'variable')
1367
- {
1368
- _s_wrapper = function() {
1369
- $wrp.css(w_siz);
1370
- };
1371
- _a_wrapper = function() {
1372
- scrl.anims.push([$wrp, w_siz]);
1373
- };
1374
- }
1375
-
1376
- // animate / set items
1377
- if (opts.usePadding)
1378
- {
1379
- var i_new_l_m = i_new_l.data('_cfs_origCssMargin');
1380
-
1381
- if (pR >= 0)
1382
- {
1383
- i_new_l_m += opts.padding[opts.d[1]];
1384
- }
1385
- i_new_l.css(opts.d['marginRight'], i_new_l_m);
1386
-
1387
- if (i_cur_l.not(i_old_l).length)
1388
- {
1389
- a_old[opts.d['marginRight']] = i_old_l.data('_cfs_origCssMargin');
1390
- }
1391
- _s_paddingold = function() {
1392
- i_old_l.css(a_old);
1393
- };
1394
- _a_paddingold = function() {
1395
- scrl.anims.push([i_old_l, a_old]);
1396
- };
1397
-
1398
- var i_cur_l_m = i_cur_l.data('_cfs_origCssMargin');
1399
- if (pL > 0)
1400
- {
1401
- i_cur_l_m += opts.padding[opts.d[3]];
1402
- }
1403
-
1404
- a_cur[opts.d['marginRight']] = i_cur_l_m;
1405
-
1406
- _s_paddingcur = function() {
1407
- i_cur_l.css(a_cur);
1408
- };
1409
- _a_paddingcur = function() {
1410
- scrl.anims.push([i_cur_l, a_cur]);
1411
- };
1412
- }
1413
-
1414
- // set position
1415
- _position = function() {
1416
- $cfs.css(a_lef);
1417
- };
1418
-
1419
-
1420
- var overFill = opts.items.visible+nI-itms.total;
1421
-
1422
- // rearrange items
1423
- _moveitems = function() {
1424
- if (overFill > 0)
1425
- {
1426
- $cfs.children().slice(itms.total).remove();
1427
- }
1428
- var l_itm = $cfs.children().slice(0, nI).appendTo($cfs).last();
1429
- if (overFill > 0)
1430
- {
1431
- i_new = gi_getCurrentItems(a_itm, opts);
1432
- }
1433
- sc_showHiddenItems(hiddenitems);
1434
-
1435
- if (opts.usePadding)
1436
- {
1437
- if (itms.total < opts.items.visible+nI) {
1438
- var i_cur_l = $cfs.children().eq(opts.items.visible-1);
1439
- i_cur_l.css(opts.d['marginRight'], i_cur_l.data('_cfs_origCssMargin') + opts.padding[opts.d[1]]);
1440
- }
1441
- l_itm.css(opts.d['marginRight'], l_itm.data('_cfs_origCssMargin'));
1442
- }
1443
- };
1444
-
1445
-
1446
- var cb_arguments = sc_mapCallbackArguments(i_old, i_skp, i_new, nI, 'next', a_dur, w_siz);
1447
-
1448
- // fire onAfter callbacks
1449
- _onafter = function() {
1450
- $cfs.css('zIndex', $cfs.data('_cfs_origCssZindex'));
1451
- sc_afterScroll($cfs, $cf2, sO);
1452
- crsl.isScrolling = false;
1453
- clbk.onAfter = sc_fireCallbacks($tt0, sO, 'onAfter', cb_arguments, clbk);
1454
- queu = sc_fireQueue($cfs, queu, conf);
1455
-
1456
- if (!crsl.isPaused)
1457
- {
1458
- $cfs.trigger(cf_e('play', conf));
1459
- }
1460
- };
1461
-
1462
- // fire onBefore callbacks
1463
- crsl.isScrolling = true;
1464
- tmrs = sc_clearTimers(tmrs);
1465
- clbk.onBefore = sc_fireCallbacks($tt0, sO, 'onBefore', cb_arguments, clbk);
1466
-
1467
- switch(sO.fx)
1468
- {
1469
- case 'none':
1470
- $cfs.css(a_cfs);
1471
- _s_wrapper();
1472
- _s_paddingold();
1473
- _s_paddingcur();
1474
- _position();
1475
- _moveitems();
1476
- _onafter();
1477
- break;
1478
-
1479
- case 'fade':
1480
- scrl.anims.push([$cfs, { 'opacity': 0 }, function() {
1481
- _s_wrapper();
1482
- _s_paddingold();
1483
- _s_paddingcur();
1484
- _position();
1485
- _moveitems();
1486
- scrl = sc_setScroll(a_dur, sO.easing, conf);
1487
- scrl.anims.push([$cfs, { 'opacity': 1 }, _onafter]);
1488
- sc_startScroll(scrl, conf);
1489
- }]);
1490
- break;
1491
-
1492
- case 'crossfade':
1493
- $cfs.css({ 'opacity': 0 });
1494
- scrl.anims.push([$cf2, { 'opacity': 0 }]);
1495
- scrl.anims.push([$cfs, { 'opacity': 1 }, _onafter]);
1496
- _a_wrapper();
1497
- _s_paddingold();
1498
- _s_paddingcur();
1499
- _position();
1500
- _moveitems();
1501
- break;
1502
-
1503
- case 'cover':
1504
- $cfs.css(opts.d['left'], $wrp[opts.d['width']]());
1505
- scrl.anims.push([$cfs, a_lef, _onafter]);
1506
- _a_wrapper();
1507
- _s_paddingold();
1508
- _s_paddingcur();
1509
- _moveitems();
1510
- break;
1511
-
1512
- case 'cover-fade':
1513
- $cfs.css(opts.d['left'], $wrp[opts.d['width']]());
1514
- scrl.anims.push([$cf2, { 'opacity': 0 }]);
1515
- scrl.anims.push([$cfs, a_lef, _onafter]);
1516
- _a_wrapper();
1517
- _s_paddingold();
1518
- _s_paddingcur();
1519
- _moveitems();
1520
- break;
1521
-
1522
- case 'uncover':
1523
- scrl.anims.push([$cf2, a_cfs_vis, _onafter]);
1524
- _a_wrapper();
1525
- _s_paddingold();
1526
- _s_paddingcur();
1527
- _position();
1528
- _moveitems();
1529
- break;
1530
-
1531
- case 'uncover-fade':
1532
- $cfs.css({ 'opacity': 0 });
1533
- scrl.anims.push([$cfs, { 'opacity': 1 }]);
1534
- scrl.anims.push([$cf2, a_cfs_vis, _onafter]);
1535
- _a_wrapper();
1536
- _s_paddingold();
1537
- _s_paddingcur();
1538
- _position();
1539
- _moveitems();
1540
- break;
1541
-
1542
- default:
1543
- scrl.anims.push([$cfs, a_cfs, function() {
1544
- _position();
1545
- _moveitems();
1546
- _onafter();
1547
- }]);
1548
- _a_wrapper();
1549
- _a_paddingold();
1550
- _a_paddingcur();
1551
- break;
1552
- }
1553
-
1554
- sc_startScroll(scrl, conf);
1555
- cf_setCookie(opts.cookie, $cfs, conf);
1556
-
1557
- $cfs.trigger(cf_e('updatePageStatus', conf), [false, w_siz]);
1558
-
1559
- return true;
1560
- });
1561
-
1562
-
1563
- // slideTo event
1564
- $cfs.bind(cf_e('slideTo', conf), function(e, num, dev, org, obj, dir, clb) {
1565
- e.stopPropagation();
1566
-
1567
- var v = [num, dev, org, obj, dir, clb],
1568
- t = ['string/number/object', 'number', 'boolean', 'object', 'string', 'function'],
1569
- a = cf_sortParams(v, t);
1570
-
1571
- obj = a[3];
1572
- dir = a[4];
1573
- clb = a[5];
1574
-
1575
- num = gn_getItemIndex(a[0], a[1], a[2], itms, $cfs);
1576
-
1577
- if (num == 0)
1578
- {
1579
- return false;
1580
- }
1581
- if (!is_object(obj))
1582
- {
1583
- obj = false;
1584
- }
1585
-
1586
- if (dir != 'prev' && dir != 'next')
1587
- {
1588
- if (opts.circular)
1589
- {
1590
- dir = (num <= itms.total / 2) ? 'next' : 'prev';
1591
- }
1592
- else
1593
- {
1594
- dir = (itms.first == 0 || itms.first > num) ? 'next' : 'prev';
1595
- }
1596
- }
1597
-
1598
- if (dir == 'prev')
1599
- {
1600
- num = itms.total-num;
1601
- }
1602
- $cfs.trigger(cf_e(dir, conf), [obj, num, clb]);
1603
-
1604
- return true;
1605
- });
1606
-
1607
-
1608
- // prevPage event
1609
- $cfs.bind(cf_e('prevPage', conf), function(e, obj, clb) {
1610
- e.stopPropagation();
1611
- var cur = $cfs.triggerHandler(cf_e('currentPage', conf));
1612
- return $cfs.triggerHandler(cf_e('slideToPage', conf), [cur-1, obj, 'prev', clb]);
1613
- });
1614
-
1615
-
1616
- // nextPage event
1617
- $cfs.bind(cf_e('nextPage', conf), function(e, obj, clb) {
1618
- e.stopPropagation();
1619
- var cur = $cfs.triggerHandler(cf_e('currentPage', conf));
1620
- return $cfs.triggerHandler(cf_e('slideToPage', conf), [cur+1, obj, 'next', clb]);
1621
- });
1622
-
1623
-
1624
- // slideToPage event
1625
- $cfs.bind(cf_e('slideToPage', conf), function(e, pag, obj, dir, clb) {
1626
- e.stopPropagation();
1627
- if (!is_number(pag))
1628
- {
1629
- pag = $cfs.triggerHandler(cf_e('currentPage', conf));
1630
- }
1631
- var ipp = opts.pagination.items || opts.items.visible,
1632
- max = Math.ceil(itms.total / ipp)-1;
1633
-
1634
- if (pag < 0)
1635
- {
1636
- pag = max;
1637
- }
1638
- if (pag > max)
1639
- {
1640
- pag = 0;
1641
- }
1642
- return $cfs.triggerHandler(cf_e('slideTo', conf), [pag*ipp, 0, true, obj, dir, clb]);
1643
- });
1644
-
1645
- // jumpToStart event
1646
- $cfs.bind(cf_e('jumpToStart', conf), function(e, s) {
1647
- e.stopPropagation();
1648
- if (s)
1649
- {
1650
- s = gn_getItemIndex(s, 0, true, itms, $cfs);
1651
- }
1652
- else
1653
- {
1654
- s = 0;
1655
- }
1656
-
1657
- s += itms.first;
1658
- if (s != 0)
1659
- {
1660
- if (itms.total > 0)
1661
- {
1662
- while (s > itms.total)
1663
- {
1664
- s -= itms.total;
1665
- }
1666
- }
1667
- $cfs.prepend($cfs.children().slice(s, itms.total));
1668
- }
1669
- return true;
1670
- });
1671
-
1672
-
1673
- // synchronise event
1674
- $cfs.bind(cf_e('synchronise', conf), function(e, s) {
1675
- e.stopPropagation();
1676
- if (s)
1677
- {
1678
- s = cf_getSynchArr(s);
1679
- }
1680
- else if (opts.synchronise)
1681
- {
1682
- s = opts.synchronise;
1683
- }
1684
- else
1685
- {
1686
- return debug(conf, 'No carousel to synchronise.');
1687
- }
1688
-
1689
- var n = $cfs.triggerHandler(cf_e('currentPosition', conf)),
1690
- x = true;
1691
-
1692
- for (var j = 0, l = s.length; j < l; j++)
1693
- {
1694
- if (!s[j][0].triggerHandler(cf_e('slideTo', conf), [n, s[j][3], true]))
1695
- {
1696
- x = false;
1697
- }
1698
- }
1699
- return x;
1700
- });
1701
-
1702
-
1703
- // queue event
1704
- $cfs.bind(cf_e('queue', conf), function(e, dir, opt) {
1705
- e.stopPropagation();
1706
- if (is_function(dir))
1707
- {
1708
- dir.call($tt0, queu);
1709
- }
1710
- else if (is_array(dir))
1711
- {
1712
- queu = dir;
1713
- }
1714
- else if (!is_undefined(dir))
1715
- {
1716
- queu.push([dir, opt]);
1717
- }
1718
- return queu;
1719
- });
1720
-
1721
-
1722
- // insertItem event
1723
- $cfs.bind(cf_e('insertItem', conf), function(e, itm, num, org, dev) {
1724
- e.stopPropagation();
1725
-
1726
- var v = [itm, num, org, dev],
1727
- t = ['string/object', 'string/number/object', 'boolean', 'number'],
1728
- a = cf_sortParams(v, t);
1729
-
1730
- itm = a[0];
1731
- num = a[1];
1732
- org = a[2];
1733
- dev = a[3];
1734
-
1735
- if (is_object(itm) && !is_jquery(itm))
1736
- {
1737
- itm = $(itm);
1738
- }
1739
- else if (is_string(itm))
1740
- {
1741
- itm = $(itm);
1742
- }
1743
- if (!is_jquery(itm) || itm.length == 0)
1744
- {
1745
- return debug(conf, 'Not a valid object.');
1746
- }
1747
-
1748
- if (is_undefined(num))
1749
- {
1750
- num = 'end';
1751
- }
1752
-
1753
- sz_storeMargin(itm, opts);
1754
- sz_storeOrigCss(itm);
1755
-
1756
- var orgNum = num,
1757
- before = 'before';
1758
-
1759
- if (num == 'end')
1760
- {
1761
- if (org)
1762
- {
1763
- if (itms.first == 0)
1764
- {
1765
- num = itms.total-1;
1766
- before = 'after';
1767
- }
1768
- else
1769
- {
1770
- num = itms.first;
1771
- itms.first += itm.length;
1772
- }
1773
- if (num < 0)
1774
- {
1775
- num = 0;
1776
- }
1777
- }
1778
- else
1779
- {
1780
- num = itms.total-1;
1781
- before = 'after';
1782
- }
1783
- }
1784
- else
1785
- {
1786
- num = gn_getItemIndex(num, dev, org, itms, $cfs);
1787
- }
1788
-
1789
- var $cit = $cfs.children().eq(num);
1790
- if ($cit.length)
1791
- {
1792
- $cit[before](itm);
1793
- }
1794
- else
1795
- {
1796
- debug(conf, 'Correct insert-position not found! Appending item to the end.');
1797
- $cfs.append(itm);
1798
- }
1799
-
1800
- if (orgNum != 'end' && !org)
1801
- {
1802
- if (num < itms.first)
1803
- {
1804
- itms.first += itm.length;
1805
- }
1806
- }
1807
- itms.total = $cfs.children().length;
1808
- if (itms.first >= itms.total)
1809
- {
1810
- itms.first -= itms.total;
1811
- }
1812
-
1813
- $cfs.trigger(cf_e('updateSizes', conf));
1814
- $cfs.trigger(cf_e('linkAnchors', conf));
1815
-
1816
- return true;
1817
- });
1818
-
1819
-
1820
- // removeItem event
1821
- $cfs.bind(cf_e('removeItem', conf), function(e, num, org, dev) {
1822
- e.stopPropagation();
1823
-
1824
- var v = [num, org, dev],
1825
- t = ['string/number/object', 'boolean', 'number'],
1826
- a = cf_sortParams(v, t);
1827
-
1828
- num = a[0];
1829
- org = a[1];
1830
- dev = a[2];
1831
-
1832
- var removed = false;
1833
-
1834
- if (num instanceof $ && num.length > 1)
1835
- {
1836
- $removed = $();
1837
- num.each(function(i, el) {
1838
- var $rem = $cfs.trigger(cf_e('removeItem', conf), [$(this), org, dev]);
1839
- if ( $rem )
1840
- {
1841
- $removed = $removed.add($rem);
1842
- }
1843
- });
1844
- return $removed;
1845
- }
1846
-
1847
- if (is_undefined(num) || num == 'end')
1848
- {
1849
- $removed = $cfs.children().last();
1850
- }
1851
- else
1852
- {
1853
- num = gn_getItemIndex(num, dev, org, itms, $cfs);
1854
- var $removed = $cfs.children().eq(num);
1855
- if ( $removed.length )
1856
- {
1857
- if (num < itms.first)
1858
- {
1859
- itms.first -= $removed.length;
1860
- }
1861
- }
1862
- }
1863
- if ( $removed && $removed.length )
1864
- {
1865
- $removed.detach();
1866
- itms.total = $cfs.children().length;
1867
- $cfs.trigger(cf_e('updateSizes', conf));
1868
- }
1869
-
1870
- return $removed;
1871
- });
1872
-
1873
-
1874
- // onBefore and onAfter event
1875
- $cfs.bind(cf_e('onBefore', conf)+' '+cf_e('onAfter', conf), function(e, fn) {
1876
- e.stopPropagation();
1877
- var eType = e.type.slice(conf.events.prefix.length);
1878
- if (is_array(fn))
1879
- {
1880
- clbk[eType] = fn;
1881
- }
1882
- if (is_function(fn))
1883
- {
1884
- clbk[eType].push(fn);
1885
- }
1886
- return clbk[eType];
1887
- });
1888
-
1889
-
1890
- // currentPosition event
1891
- $cfs.bind(cf_e('currentPosition', conf), function(e, fn) {
1892
- e.stopPropagation();
1893
- if (itms.first == 0)
1894
- {
1895
- var val = 0;
1896
- }
1897
- else
1898
- {
1899
- var val = itms.total - itms.first;
1900
- }
1901
- if (is_function(fn))
1902
- {
1903
- fn.call($tt0, val);
1904
- }
1905
- return val;
1906
- });
1907
-
1908
-
1909
- // currentPage event
1910
- $cfs.bind(cf_e('currentPage', conf), function(e, fn) {
1911
- e.stopPropagation();
1912
- var ipp = opts.pagination.items || opts.items.visible,
1913
- max = Math.ceil(itms.total/ipp-1),
1914
- nr;
1915
- if (itms.first == 0)
1916
- {
1917
- nr = 0;
1918
- }
1919
- else if (itms.first < itms.total % ipp)
1920
- {
1921
- nr = 0;
1922
- }
1923
- else if (itms.first == ipp && !opts.circular)
1924
- {
1925
- nr = max;
1926
- }
1927
- else
1928
- {
1929
- nr = Math.round((itms.total-itms.first)/ipp);
1930
- }
1931
- if (nr < 0)
1932
- {
1933
- nr = 0;
1934
- }
1935
- if (nr > max)
1936
- {
1937
- nr = max;
1938
- }
1939
- if (is_function(fn))
1940
- {
1941
- fn.call($tt0, nr);
1942
- }
1943
- return nr;
1944
- });
1945
-
1946
-
1947
- // currentVisible event
1948
- $cfs.bind(cf_e('currentVisible', conf), function(e, fn) {
1949
- e.stopPropagation();
1950
- var $i = gi_getCurrentItems($cfs.children(), opts);
1951
- if (is_function(fn))
1952
- {
1953
- fn.call($tt0, $i);
1954
- }
1955
- return $i;
1956
- });
1957
-
1958
-
1959
- // slice event
1960
- $cfs.bind(cf_e('slice', conf), function(e, f, l, fn) {
1961
- e.stopPropagation();
1962
-
1963
- if (itms.total == 0)
1964
- {
1965
- return false;
1966
- }
1967
-
1968
- var v = [f, l, fn],
1969
- t = ['number', 'number', 'function'],
1970
- a = cf_sortParams(v, t);
1971
-
1972
- f = (is_number(a[0])) ? a[0] : 0;
1973
- l = (is_number(a[1])) ? a[1] : itms.total;
1974
- fn = a[2];
1975
-
1976
- f += itms.first;
1977
- l += itms.first;
1978
-
1979
- if (items.total > 0)
1980
- {
1981
- while (f > itms.total)
1982
- {
1983
- f -= itms.total;
1984
- }
1985
- while (l > itms.total)
1986
- {
1987
- l -= itms.total;
1988
- }
1989
- while (f < 0)
1990
- {
1991
- f += itms.total;
1992
- }
1993
- while (l < 0)
1994
- {
1995
- l += itms.total;
1996
- }
1997
- }
1998
- var $iA = $cfs.children(),
1999
- $i;
2000
-
2001
- if (l > f)
2002
- {
2003
- $i = $iA.slice(f, l);
2004
- }
2005
- else
2006
- {
2007
- $i = $( $iA.slice(f, itms.total).get().concat( $iA.slice(0, l).get() ) );
2008
- }
2009
-
2010
- if (is_function(fn))
2011
- {
2012
- fn.call($tt0, $i);
2013
- }
2014
- return $i;
2015
- });
2016
-
2017
-
2018
- // isPaused, isStopped and isScrolling events
2019
- $cfs.bind(cf_e('isPaused', conf)+' '+cf_e('isStopped', conf)+' '+cf_e('isScrolling', conf), function(e, fn) {
2020
- e.stopPropagation();
2021
- var eType = e.type.slice(conf.events.prefix.length),
2022
- value = crsl[eType];
2023
- if (is_function(fn))
2024
- {
2025
- fn.call($tt0, value);
2026
- }
2027
- return value;
2028
- });
2029
-
2030
-
2031
- // configuration event
2032
- $cfs.bind(cf_e('configuration', conf), function(e, a, b, c) {
2033
- e.stopPropagation();
2034
- var reInit = false;
2035
-
2036
- // return entire configuration-object
2037
- if (is_function(a))
2038
- {
2039
- a.call($tt0, opts);
2040
- }
2041
- // set multiple options via object
2042
- else if (is_object(a))
2043
- {
2044
- opts_orig = $.extend(true, {}, opts_orig, a);
2045
- if (b !== false) reInit = true;
2046
- else opts = $.extend(true, {}, opts, a);
2047
-
2048
- }
2049
- else if (!is_undefined(a))
2050
- {
2051
-
2052
- // callback function for specific option
2053
- if (is_function(b))
2054
- {
2055
- var val = eval('opts.'+a);
2056
- if (is_undefined(val))
2057
- {
2058
- val = '';
2059
- }
2060
- b.call($tt0, val);
2061
- }
2062
- // set individual option
2063
- else if (!is_undefined(b))
2064
- {
2065
- if (typeof c !== 'boolean') c = true;
2066
- eval('opts_orig.'+a+' = b');
2067
- if (c !== false) reInit = true;
2068
- else eval('opts.'+a+' = b');
2069
- }
2070
- // return value for specific option
2071
- else
2072
- {
2073
- return eval('opts.'+a);
2074
- }
2075
- }
2076
- if (reInit)
2077
- {
2078
- sz_resetMargin($cfs.children(), opts);
2079
- FN._init(opts_orig);
2080
- FN._bind_buttons();
2081
- var sz = sz_setSizes($cfs, opts);
2082
- $cfs.trigger(cf_e('updatePageStatus', conf), [true, sz]);
2083
- }
2084
- return opts;
2085
- });
2086
-
2087
-
2088
- // linkAnchors event
2089
- $cfs.bind(cf_e('linkAnchors', conf), function(e, $con, sel) {
2090
- e.stopPropagation();
2091
-
2092
- if (is_undefined($con))
2093
- {
2094
- $con = $('body');
2095
- }
2096
- else if (is_string($con))
2097
- {
2098
- $con = $($con);
2099
- }
2100
- if (!is_jquery($con) || $con.length == 0)
2101
- {
2102
- return debug(conf, 'Not a valid object.');
2103
- }
2104
- if (!is_string(sel))
2105
- {
2106
- sel = 'a.caroufredsel';
2107
- }
2108
-
2109
- $con.find(sel).each(function() {
2110
- var h = this.hash || '';
2111
- if (h.length > 0 && $cfs.children().index($(h)) != -1)
2112
- {
2113
- $(this).unbind('click').click(function(e) {
2114
- e.preventDefault();
2115
- $cfs.trigger(cf_e('slideTo', conf), h);
2116
- });
2117
- }
2118
- });
2119
- return true;
2120
- });
2121
-
2122
-
2123
- // updatePageStatus event
2124
- $cfs.bind(cf_e('updatePageStatus', conf), function(e, build, sizes) {
2125
- e.stopPropagation();
2126
- if (!opts.pagination.container)
2127
- {
2128
- return;
2129
- }
2130
-
2131
- var ipp = opts.pagination.items || opts.items.visible,
2132
- pgs = Math.ceil(itms.total/ipp);
2133
-
2134
- if (build)
2135
- {
2136
- if (opts.pagination.anchorBuilder)
2137
- {
2138
- opts.pagination.container.children().remove();
2139
- opts.pagination.container.each(function() {
2140
- for (var a = 0; a < pgs; a++)
2141
- {
2142
- var i = $cfs.children().eq( gn_getItemIndex(a*ipp, 0, true, itms, $cfs) );
2143
- $(this).append(opts.pagination.anchorBuilder.call(i[0], a+1));
2144
- }
2145
- });
2146
- }
2147
- opts.pagination.container.each(function() {
2148
- $(this).children().unbind(opts.pagination.event).each(function(a) {
2149
- $(this).bind(opts.pagination.event, function(e) {
2150
- e.preventDefault();
2151
- $cfs.trigger(cf_e('slideTo', conf), [a*ipp, -opts.pagination.deviation, true, opts.pagination]);
2152
- });
2153
- });
2154
- });
2155
- }
2156
-
2157
- var selected = $cfs.triggerHandler(cf_e('currentPage', conf)) + opts.pagination.deviation;
2158
- if (selected >= pgs)
2159
- {
2160
- selected = 0;
2161
- }
2162
- if (selected < 0)
2163
- {
2164
- selected = pgs-1;
2165
- }
2166
- opts.pagination.container.each(function() {
2167
- $(this).children().removeClass(cf_c('selected', conf)).eq(selected).addClass(cf_c('selected', conf));
2168
- });
2169
- return true;
2170
- });
2171
-
2172
-
2173
- // updateSizes event
2174
- $cfs.bind(cf_e('updateSizes', conf), function(e) {
2175
- var vI = opts.items.visible,
2176
- a_itm = $cfs.children(),
2177
- avail_primary = ms_getParentSize($wrp, opts, 'width');
2178
-
2179
- itms.total = a_itm.length;
2180
-
2181
- if (crsl.primarySizePercentage)
2182
- {
2183
- opts.maxDimension = avail_primary;
2184
- opts[opts.d['width']] = ms_getPercentage(avail_primary, crsl.primarySizePercentage);
2185
- }
2186
- else
2187
- {
2188
- opts.maxDimension = ms_getMaxDimension(opts, avail_primary);
2189
- }
2190
-
2191
- if (opts.responsive)
2192
- {
2193
- opts.items.width = opts.items.sizesConf.width;
2194
- opts.items.height = opts.items.sizesConf.height;
2195
- opts = in_getResponsiveValues(opts, a_itm, avail_primary);
2196
- vI = opts.items.visible;
2197
- sz_setResponsiveSizes(opts, a_itm);
2198
- }
2199
- else if (opts.items.visibleConf.variable)
2200
- {
2201
- vI = gn_getVisibleItemsNext(a_itm, opts, 0);
2202
- }
2203
- else if (opts.items.filter != '*')
2204
- {
2205
- vI = gn_getVisibleItemsNextFilter(a_itm, opts, 0);
2206
- }
2207
-
2208
- if (!opts.circular && itms.first != 0 && vI > itms.first) {
2209
- if (opts.items.visibleConf.variable)
2210
- {
2211
- var nI = gn_getVisibleItemsPrev(a_itm, opts, itms.first) - itms.first;
2212
- }
2213
- else if (opts.items.filter != '*')
2214
- {
2215
- var nI = gn_getVisibleItemsPrevFilter(a_itm, opts, itms.first) - itms.first;
2216
- }
2217
- else
2218
- {
2219
- var nI = opts.items.visible - itms.first;
2220
- }
2221
- debug(conf, 'Preventing non-circular: sliding '+nI+' items backward.');
2222
- $cfs.trigger(cf_e('prev', conf), nI);
2223
- }
2224
-
2225
- opts.items.visible = cf_getItemsAdjust(vI, opts, opts.items.visibleConf.adjust, $tt0);
2226
- opts.items.visibleConf.old = opts.items.visible;
2227
- opts = in_getAlignPadding(opts, a_itm);
2228
-
2229
- var sz = sz_setSizes($cfs, opts);