Commit bde80a8f74c48108fc0eb22383d369d72133e778
1 parent
752c72a7
+ Модальные окна
Showing
11 changed files
with
926 additions
and
0 deletions
Show diff stats
1 | + | ||
2 | + .modalBox { | ||
3 | + background: #fff; | ||
4 | + padding: 10px; | ||
5 | + border-radius: 10px; | ||
6 | + -moz-border-radius: 10px; | ||
7 | + -o-border-radius: 10px; | ||
8 | + -webkit-border-radius: 10px; | ||
9 | + } | ||
10 | + | ||
11 | + .modalBox .content { | ||
12 | + overflow-y: auto; | ||
13 | + display: block; | ||
14 | + } | ||
15 | + | ||
16 | + .modalBox .close { | ||
17 | + display: block; | ||
18 | + position: absolute; | ||
19 | + top: -16px; | ||
20 | + right: -15px; | ||
21 | + width: 12px; | ||
22 | + height: 12px; | ||
23 | + padding: 8px; | ||
24 | + border: 2px solid #fff; | ||
25 | + cursor: pointer; | ||
26 | + background: #000; | ||
27 | + text-align: center; | ||
28 | + font-size: 12px; | ||
29 | + line-height: 12px; | ||
30 | + color: #fff; | ||
31 | + text-decoration: none; | ||
32 | + font-weight: bold; | ||
33 | + | ||
34 | + border-radius: 50%; | ||
35 | + -moz-border-radius: 50%; | ||
36 | + -o-border-radius: 50%; | ||
37 | + -webkit-border-radius: 50%; | ||
38 | + } | ||
39 | + | ||
40 | + .modalBox, | ||
41 | + .modalBox .close { | ||
42 | + box-shadow: 0 0 5px 1px #c1c1c1; | ||
43 | + -moz-box-shadow: 0 0 5px 1px #c1c1c1; | ||
44 | + -o-box-shadow: 0 0 5px 1px #c1c1c1; | ||
45 | + -webkit-box-shadow: 0 0 5px 1px #c1c1c1; | ||
46 | + } | ||
47 | + | ||
48 | + .modalBox .close:hover { | ||
49 | + background: #606060; | ||
50 | + } | ||
51 | + | ||
52 | + .modalBoxWindow { | ||
53 | + display: none; | ||
54 | + } | ||
55 | + | ||
56 | +/* | ||
57 | + =============== | ||
58 | + ==== ALERT ==== | ||
59 | + =============== | ||
60 | +*/ | ||
61 | + | ||
62 | + .alert { | ||
63 | + min-width: 250px; | ||
64 | + padding: 8px; | ||
65 | + margin: 5px 0; | ||
66 | + } | ||
67 | + | ||
68 | + .alert .info { | ||
69 | + height: 130px; | ||
70 | + padding: 0 10px; | ||
71 | + } | ||
72 | + | ||
73 | + .alert > div { | ||
74 | + display: table-cell; | ||
75 | + vertical-align: middle; | ||
76 | + } | ||
77 | + | ||
78 | + .alert .pic { | ||
79 | + width: 128px; | ||
80 | + height: 128px; | ||
81 | + background-repeat: none; | ||
82 | + background-position: center center; | ||
83 | + background-repeat: no-repeat; | ||
84 | + background-size: cover; | ||
85 | + } | ||
86 | + | ||
87 | + .alert.success .pic { | ||
88 | + background-image: url(./img/success.png); | ||
89 | + } | ||
90 | + | ||
91 | + .alert.warning .pic { | ||
92 | + background-image: url(./img/warning.png); | ||
93 | + } | ||
94 | + | ||
95 | + .alert.error .pic { | ||
96 | + background-image: url(./img/error.png); | ||
97 | + } | ||
98 | + | ||
99 | + .alert.send .pic { | ||
100 | + background-image: url(./img/send.png); | ||
101 | + } | ||
102 | + | ||
103 | + .alert.huck .pic { | ||
104 | + background-image: url(./img/huck.png); | ||
105 | + } | ||
106 | + | ||
107 | + .alert.robot .pic { | ||
108 | + background-image: url(./img/robot.png); | ||
109 | + } | ||
110 | + | ||
111 | + .alert.wait .pic { | ||
112 | + width: 113px; | ||
113 | + height: 128px; | ||
114 | + background-image: url(./img/wait.png); | ||
115 | + } | ||
116 | + | ||
117 | + .alert.SomethingWrong .pic { | ||
118 | + background-image: url(./img/something-wrong.jpg); | ||
119 | + } | ||
120 | + | ||
0 | \ No newline at end of file | 121 | \ No newline at end of file |
1 | + | ||
2 | + .modalBox { | ||
3 | + background: #fff; | ||
4 | + padding: 10px; | ||
5 | + border-radius: 10px; | ||
6 | + -moz-border-radius: 10px; | ||
7 | + -o-border-radius: 10px; | ||
8 | + -webkit-border-radius: 10px; | ||
9 | + } | ||
10 | + | ||
11 | + .modalBox .content { | ||
12 | + overflow-y: auto; | ||
13 | + display: table; | ||
14 | + } | ||
15 | + | ||
16 | + .modalBox .close { | ||
17 | + display: block; | ||
18 | + position: absolute; | ||
19 | + top: -16px; | ||
20 | + right: -15px; | ||
21 | + width: 12px; | ||
22 | + height: 12px; | ||
23 | + padding: 8px; | ||
24 | + border: 2px solid #fff; | ||
25 | + cursor: pointer; | ||
26 | + background: #000; | ||
27 | + text-align: center; | ||
28 | + font-size: 12px; | ||
29 | + line-height: 12px; | ||
30 | + color: #fff; | ||
31 | + text-decoration: none; | ||
32 | + font-weight: bold; | ||
33 | + | ||
34 | + border-radius: 50%; | ||
35 | + -moz-border-radius: 50%; | ||
36 | + -o-border-radius: 50%; | ||
37 | + -webkit-border-radius: 50%; | ||
38 | + } | ||
39 | + | ||
40 | + .modalBox, | ||
41 | + .modalBox .close { | ||
42 | + box-shadow: 0 0 5px 1px #c1c1c1; | ||
43 | + -moz-box-shadow: 0 0 5px 1px #c1c1c1; | ||
44 | + -o-box-shadow: 0 0 5px 1px #c1c1c1; | ||
45 | + -webkit-box-shadow: 0 0 5px 1px #c1c1c1; | ||
46 | + } | ||
47 | + | ||
48 | + .modalBox .close:hover { | ||
49 | + background: #606060; | ||
50 | + } | ||
51 | + | ||
52 | + .modalBoxWindow { | ||
53 | + display: none; | ||
54 | + } | ||
55 | + | ||
56 | +/* | ||
57 | + =============== | ||
58 | + ==== ALERT ==== | ||
59 | + =============== | ||
60 | +*/ | ||
61 | + | ||
62 | + .alert { | ||
63 | + min-width: 250px; | ||
64 | + padding: 8px; | ||
65 | + margin: 5px 0; | ||
66 | + } | ||
67 | + | ||
68 | + .alert .info { | ||
69 | + height: 130px; | ||
70 | + padding: 0 10px; | ||
71 | + } | ||
72 | + | ||
73 | + .alert > div { | ||
74 | + display: table-cell; | ||
75 | + vertical-align: middle; | ||
76 | + } | ||
77 | + | ||
78 | + .alert .pic { | ||
79 | + width: 128px; | ||
80 | + height: 128px; | ||
81 | + background-repeat: none; | ||
82 | + background-position: center center; | ||
83 | + background-repeat: no-repeat; | ||
84 | + background-size: cover; | ||
85 | + } | ||
86 | + | ||
87 | + .alert.success .pic { | ||
88 | + background-image: url(./img/success.png); | ||
89 | + } | ||
90 | + | ||
91 | + .alert.warning .pic { | ||
92 | + background-image: url(./img/warning.png); | ||
93 | + } | ||
94 | + | ||
95 | + .alert.error .pic { | ||
96 | + background-image: url(./img/error.png); | ||
97 | + } | ||
98 | + | ||
99 | + .alert.send .pic { | ||
100 | + background-image: url(./img/send.png); | ||
101 | + } | ||
102 | + | ||
103 | + .alert.huck .pic { | ||
104 | + background-image: url(./img/huck.png); | ||
105 | + } | ||
106 | + | ||
107 | + .alert.robot .pic { | ||
108 | + background-image: url(./img/robot.png); | ||
109 | + } | ||
110 | + | ||
111 | + .alert.wait .pic { | ||
112 | + width: 113px; | ||
113 | + height: 128px; | ||
114 | + background-image: url(./img/wait.png); | ||
115 | + } | ||
116 | + | ||
117 | + .alert.SomethingWrong .pic { | ||
118 | + background-image: url(./img/something-wrong.jpg); | ||
119 | + } | ||
120 | + | ||
0 | \ No newline at end of file | 121 | \ No newline at end of file |
10.1 KB
8.98 KB
1 | +/*=================================================================================================================== | ||
2 | +* @name: bPopup | ||
3 | +* @type: jQuery | ||
4 | +* @author: (c) Bjoern Klinggaard - @bklinggaard | ||
5 | +* @demo: http://dinbror.dk/bpopup | ||
6 | +* @version: 0.10.0 | ||
7 | +* @requires jQuery 1.4.3 | ||
8 | +*==================================================================================================================*/ | ||
9 | +;(function($) { | ||
10 | +'use strict'; | ||
11 | +$.fn.bPopup = function(options, callback) { | ||
12 | +if ($.isFunction(options)) { | ||
13 | +callback = options; | ||
14 | +options = null; | ||
15 | +} | ||
16 | +// OPTIONS | ||
17 | +var o = $.extend({}, $.fn.bPopup.defaults, options); | ||
18 | +// HIDE SCROLLBAR? | ||
19 | +if (!o.scrollBar) | ||
20 | +$('html').css('overflow', 'hidden'); | ||
21 | +// VARIABLES | ||
22 | +var $popup = this | ||
23 | +, d = $(document) | ||
24 | +, w = window | ||
25 | +, $w = $(w) | ||
26 | +, wH = windowHeight() | ||
27 | +, wW = windowWidth() | ||
28 | +, prefix = '__b-popup' | ||
29 | +, isIOS6X = (/OS 6(_\d)+/i).test(navigator.userAgent) // Used for a temporary fix for ios6 timer bug when using zoom/scroll | ||
30 | +, buffer = 200 | ||
31 | +, popups = 0 | ||
32 | +, id | ||
33 | +, inside | ||
34 | +, fixedVPos | ||
35 | +, fixedHPos | ||
36 | +, fixedPosStyle | ||
37 | +, vPos | ||
38 | +, hPos | ||
39 | +, height | ||
40 | +, width | ||
41 | +, debounce | ||
42 | +, autoCloseTO | ||
43 | +; | ||
44 | +//////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
45 | +// PUBLIC FUNCTION - call it: $(element).bPopup().close(); | ||
46 | +//////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
47 | +$popup.close = function() { | ||
48 | +close(); | ||
49 | +}; | ||
50 | +$popup.reposition = function(animateSpeed) { | ||
51 | +reposition(animateSpeed); | ||
52 | +}; | ||
53 | +return $popup.each(function() { | ||
54 | +if ($(this).data('bPopup')) return; //POPUP already exists? | ||
55 | +init(); | ||
56 | +}); | ||
57 | +//////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
58 | +// HELPER FUNCTIONS - PRIVATE | ||
59 | +//////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
60 | +function init() { | ||
61 | +triggerCall(o.onOpen); | ||
62 | +popups = ($w.data('bPopup') || 0) + 1, id = prefix + popups + '__',fixedVPos = o.position[1] !== 'auto', fixedHPos = o.position[0] !== 'auto', fixedPosStyle = o.positionStyle === 'fixed', height = $popup.outerHeight(true), width = $popup.outerWidth(true); | ||
63 | +o.loadUrl ? createContent() : open(); | ||
64 | +}; | ||
65 | +function createContent() { | ||
66 | +o.contentContainer = $(o.contentContainer || $popup); | ||
67 | +switch (o.content) { | ||
68 | +case ('iframe'): | ||
69 | +var iframe = $('<iframe class="b-iframe" ' + o.iframeAttr +'></iframe>'); | ||
70 | +iframe.appendTo(o.contentContainer); | ||
71 | +height = $popup.outerHeight(true); | ||
72 | +width = $popup.outerWidth(true); | ||
73 | +open(); | ||
74 | +iframe.attr('src', o.loadUrl); // setting iframe src after open due IE9 bug | ||
75 | +triggerCall(o.loadCallback); | ||
76 | +break; | ||
77 | +case ('image'): | ||
78 | +open(); | ||
79 | +$('<img />') | ||
80 | +.load(function() { | ||
81 | +triggerCall(o.loadCallback); | ||
82 | +recenter($(this)); | ||
83 | +}).attr('src', o.loadUrl).hide().appendTo(o.contentContainer); | ||
84 | +break; | ||
85 | +default: | ||
86 | +open(); | ||
87 | +$('<div class="b-ajax-wrapper"></div>') | ||
88 | +.load(o.loadUrl, o.loadData, function(response, status, xhr) { | ||
89 | +triggerCall(o.loadCallback, status); | ||
90 | +recenter($(this)); | ||
91 | +}).hide().appendTo(o.contentContainer); | ||
92 | +break; | ||
93 | +} | ||
94 | +}; | ||
95 | +function open(){ | ||
96 | +// MODAL OVERLAY | ||
97 | +if (o.modal) { | ||
98 | +$('<div class="b-modal '+id+'"></div>') | ||
99 | +.css({backgroundColor: o.modalColor, position: 'fixed', top: 0, right:0, bottom:0, left: 0, opacity: 0, zIndex: o.zIndex + popups}) | ||
100 | +.appendTo(o.appendTo) | ||
101 | +.fadeTo(o.speed, o.opacity); | ||
102 | +} | ||
103 | +// POPUP | ||
104 | +calcPosition(); | ||
105 | +$popup | ||
106 | +.data('bPopup', o).data('id',id) | ||
107 | +.css({ | ||
108 | +'left': o.transition == 'slideIn' || o.transition == 'slideBack' ? (o.transition == 'slideBack' ? d.scrollLeft() + wW : (hPos + width) *-1) : getLeftPos(!(!o.follow[0] && fixedHPos || fixedPosStyle)) | ||
109 | +, 'position': o.positionStyle || 'absolute' | ||
110 | +, 'top': o.transition == 'slideDown' || o.transition == 'slideUp' ? (o.transition == 'slideUp' ? d.scrollTop() + wH : vPos + height * -1) : getTopPos(!(!o.follow[1] && fixedVPos || fixedPosStyle)) | ||
111 | +, 'z-index': o.zIndex + popups + 1 | ||
112 | +}).each(function() { | ||
113 | +if(o.appending) { | ||
114 | +$(this).appendTo(o.appendTo); | ||
115 | +} | ||
116 | +}); | ||
117 | +doTransition(true); | ||
118 | +}; | ||
119 | +function close() { | ||
120 | +if (o.modal) { | ||
121 | +$('.b-modal.'+$popup.data('id')) | ||
122 | +.fadeTo(o.speed, 0, function() { | ||
123 | +$(this).remove(); | ||
124 | +}); | ||
125 | +} | ||
126 | +// Clean up | ||
127 | +unbindEvents(); | ||
128 | +clearTimeout(autoCloseTO); | ||
129 | +// Close trasition | ||
130 | +doTransition(); | ||
131 | +return false; // Prevent default | ||
132 | +}; | ||
133 | +function reposition(animateSpeed){ | ||
134 | +wH = windowHeight(); | ||
135 | +wW = windowWidth(); | ||
136 | +inside = insideWindow(); | ||
137 | +if(inside){ | ||
138 | +clearTimeout(debounce); | ||
139 | +debounce = setTimeout(function(){ | ||
140 | +calcPosition(); | ||
141 | +animateSpeed = animateSpeed || o.followSpeed; | ||
142 | +$popup | ||
143 | +.dequeue() | ||
144 | +.each(function() { | ||
145 | +if(fixedPosStyle) { | ||
146 | +$(this).css({ 'left': hPos, 'top': vPos }); | ||
147 | +} | ||
148 | +else { | ||
149 | +$(this).animate({ 'left': o.follow[0] ? getLeftPos(true) : 'auto', 'top': o.follow[1] ? getTopPos(true) : 'auto' }, animateSpeed, o.followEasing); | ||
150 | +} | ||
151 | +}); | ||
152 | +}, 50); | ||
153 | +} | ||
154 | +}; | ||
155 | +//Eksperimental | ||
156 | +function recenter(content){ | ||
157 | +var _width = content.width(), _height = content.height(), css = {}; | ||
158 | +o.contentContainer.css({height:_height,width:_width}); | ||
159 | +if (_height >= $popup.height()){ | ||
160 | +css.height = $popup.height(); | ||
161 | +} | ||
162 | +if(_width >= $popup.width()){ | ||
163 | +css.width = $popup.width(); | ||
164 | +} | ||
165 | +height = $popup.outerHeight(true) | ||
166 | +, width = $popup.outerWidth(true); | ||
167 | +calcPosition(); | ||
168 | +o.contentContainer.css({height:'auto',width:'auto'}); | ||
169 | +css.left = getLeftPos(!(!o.follow[0] && fixedHPos || fixedPosStyle)), | ||
170 | +css.top = getTopPos(!(!o.follow[1] && fixedVPos || fixedPosStyle)); | ||
171 | +$popup | ||
172 | +.animate( | ||
173 | +css | ||
174 | +, 250 | ||
175 | +, function() { | ||
176 | +content.show(); | ||
177 | +inside = insideWindow(); | ||
178 | +} | ||
179 | +); | ||
180 | +}; | ||
181 | +function bindEvents() { | ||
182 | +$w.data('bPopup', popups); | ||
183 | +$popup.delegate('.bClose, .' + o.closeClass, 'click.'+id, close); // legacy, still supporting the close class bClose | ||
184 | +if (o.modalClose) { | ||
185 | +$('.b-modal.'+id).css('cursor', 'pointer').bind('click', close); | ||
186 | +} | ||
187 | +// Temporary disabling scroll/resize events on devices with IOS6+ | ||
188 | +// due to a bug where events are dropped after pinch to zoom | ||
189 | +if (!isIOS6X && (o.follow[0] || o.follow[1])) { | ||
190 | +$w.bind('scroll.'+id, function() { | ||
191 | +if(inside){ | ||
192 | +$popup | ||
193 | +.dequeue() | ||
194 | +.animate({ 'left': o.follow[0] ? getLeftPos(!fixedPosStyle) : 'auto', 'top': o.follow[1] ? getTopPos(!fixedPosStyle) : 'auto' }, o.followSpeed, o.followEasing); | ||
195 | +} | ||
196 | +}).bind('resize.'+id, function() { | ||
197 | +reposition(); | ||
198 | +}); | ||
199 | +} | ||
200 | +if (o.escClose) { | ||
201 | +d.bind('keydown.'+id, function(e) { | ||
202 | +if (e.which == 27) { //escape | ||
203 | +close(); | ||
204 | +} | ||
205 | +}); | ||
206 | +} | ||
207 | +}; | ||
208 | +function unbindEvents() { | ||
209 | +if (!o.scrollBar) { | ||
210 | +$('html').css('overflow', 'auto'); | ||
211 | +} | ||
212 | +$('.b-modal.'+id).unbind('click'); | ||
213 | +d.unbind('keydown.'+id); | ||
214 | +$w.unbind('.'+id).data('bPopup', ($w.data('bPopup')-1 > 0) ? $w.data('bPopup')-1 : null); | ||
215 | +$popup.undelegate('.bClose, .' + o.closeClass, 'click.'+id, close).data('bPopup', null); | ||
216 | +}; | ||
217 | +function doTransition(open) { | ||
218 | +switch (open ? o.transition : o.transitionClose || o.transition) { | ||
219 | +case "slideIn": | ||
220 | +animate({ | ||
221 | +left: open ? getLeftPos(!(!o.follow[0] && fixedHPos || fixedPosStyle)) : d.scrollLeft() - (width || $popup.outerWidth(true)) - buffer | ||
222 | +}); | ||
223 | +break; | ||
224 | +case "slideBack": | ||
225 | +animate({ | ||
226 | +left: open ? getLeftPos(!(!o.follow[0] && fixedHPos || fixedPosStyle)) : d.scrollLeft() + wW + buffer | ||
227 | +}); | ||
228 | +break; | ||
229 | +case "slideDown": | ||
230 | +animate({ | ||
231 | +top: open ? getTopPos(!(!o.follow[1] && fixedVPos || fixedPosStyle)) : d.scrollTop() - (height || $popup.outerHeight(true)) - buffer | ||
232 | +}); | ||
233 | +break; | ||
234 | +case "slideUp": | ||
235 | +animate({ | ||
236 | +top: open ? getTopPos(!(!o.follow[1] && fixedVPos || fixedPosStyle)) : d.scrollTop() + wH + buffer | ||
237 | +}); | ||
238 | +break; | ||
239 | +default: | ||
240 | +//Hardtyping 1 and 0 to ensure opacity 1 and not 0.9999998 | ||
241 | +$popup.stop().fadeTo(o.speed, open ? 1 : 0, function(){onCompleteCallback(open);}); | ||
242 | +} | ||
243 | +function animate(css){ | ||
244 | +$popup | ||
245 | +.css({display: 'block',opacity: 1}) | ||
246 | +.animate(css, o.speed, o.easing, function(){ onCompleteCallback(open); }); | ||
247 | +}; | ||
248 | +}; | ||
249 | +function onCompleteCallback(open){ | ||
250 | +if(open){ | ||
251 | +bindEvents(); | ||
252 | +triggerCall(callback); | ||
253 | +if(o.autoClose){ | ||
254 | +autoCloseTO = setTimeout(close, o.autoClose); | ||
255 | +} | ||
256 | +} else { | ||
257 | +$popup.hide(); | ||
258 | +triggerCall(o.onClose); | ||
259 | +if (o.loadUrl) { | ||
260 | +o.contentContainer.empty(); | ||
261 | +$popup.css({height: 'auto', width: 'auto'}); | ||
262 | +} | ||
263 | +} | ||
264 | +}; | ||
265 | +function getLeftPos(includeScroll){ | ||
266 | +return includeScroll ? hPos + d.scrollLeft() : hPos; | ||
267 | +}; | ||
268 | +function getTopPos(includeScroll){ | ||
269 | +return includeScroll ? vPos + d.scrollTop() : vPos; | ||
270 | +}; | ||
271 | +function triggerCall(func, arg) { | ||
272 | +$.isFunction(func) && func.call($popup, arg); | ||
273 | +}; | ||
274 | +function calcPosition(){ | ||
275 | +vPos = fixedVPos ? o.position[1] : Math.max(0, ((wH- $popup.outerHeight(true)) / 2) - o.amsl) | ||
276 | +, hPos = fixedHPos ? o.position[0] : (wW - $popup.outerWidth(true)) / 2 | ||
277 | +, inside = insideWindow(); | ||
278 | +}; | ||
279 | +function insideWindow(){ | ||
280 | +return wH > $popup.outerHeight(true) && wW > $popup.outerWidth(true); | ||
281 | +}; | ||
282 | +function windowHeight(){ | ||
283 | +return w.innerHeight || $w.height(); | ||
284 | +}; | ||
285 | +function windowWidth(){ | ||
286 | +return w.innerWidth || $w.width(); | ||
287 | +}; | ||
288 | +}; | ||
289 | +//////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
290 | +// DEFAULT VALUES | ||
291 | +//////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
292 | +$.fn.bPopup.defaults = { | ||
293 | +amsl: 50 | ||
294 | +, appending: true | ||
295 | +, appendTo: 'body' | ||
296 | +, autoClose: false | ||
297 | +, closeClass: 'b-close' | ||
298 | +, content: 'ajax' // ajax, iframe or image | ||
299 | +, contentContainer: false | ||
300 | +, easing: 'swing' | ||
301 | +, escClose: true | ||
302 | +, follow: [true, true] // x, y | ||
303 | +, followEasing: 'swing' | ||
304 | +, followSpeed: 500 | ||
305 | +, iframeAttr: 'scrolling="no" frameborder="0"' | ||
306 | +, loadCallback: false | ||
307 | +, loadData: false | ||
308 | +, loadUrl: false | ||
309 | +, modal: true | ||
310 | +, modalClose: true | ||
311 | +, modalColor: '#000' | ||
312 | +, onClose: false | ||
313 | +, onOpen: false | ||
314 | +, opacity: 0.7 | ||
315 | +, position: ['auto', 'auto'] // x, y, | ||
316 | +, positionStyle: 'absolute'// absolute or fixed | ||
317 | +, scrollBar: true | ||
318 | +, speed: 250 // open & close speed | ||
319 | +, transition: 'fadeIn' //transitions: fadeIn, slideDown, slideIn, slideBack | ||
320 | +, transitionClose: false | ||
321 | +, zIndex: 9997 // popup gets z-index 9999, modal overlay 9998 | ||
322 | +}; | ||
323 | +})(jQuery); | ||
0 | \ No newline at end of file | 324 | \ No newline at end of file |
1 | +;(function($){'use strict';$.fn.bPopup=function(options,callback){if($.isFunction(options)){callback=options;options=null;} | ||
2 | +var o=$.extend({},$.fn.bPopup.defaults,options);if(!o.scrollBar) | ||
3 | +$('html').css('overflow','hidden');var $popup=this,d=$(document),w=window,$w=$(w),wH=windowHeight(),wW=windowWidth(),prefix='__b-popup',isIOS6X=(/OS 6(_\d)+/i).test(navigator.userAgent),buffer=200,popups=0,id,inside,fixedVPos,fixedHPos,fixedPosStyle,vPos,hPos,height,width,debounce,autoCloseTO;$popup.close=function(){close();};$popup.reposition=function(animateSpeed){reposition(animateSpeed);};return $popup.each(function(){if($(this).data('bPopup'))return;init();});function init(){triggerCall(o.onOpen);popups=($w.data('bPopup')||0)+1,id=prefix+popups+'__',fixedVPos=o.position[1]!=='auto',fixedHPos=o.position[0]!=='auto',fixedPosStyle=o.positionStyle==='fixed',height=$popup.outerHeight(true),width=$popup.outerWidth(true);o.loadUrl?createContent():open();};function createContent(){o.contentContainer=$(o.contentContainer||$popup);switch(o.content){case('iframe'):var iframe=$('<iframe class="b-iframe" '+o.iframeAttr+'></iframe>');iframe.appendTo(o.contentContainer);height=$popup.outerHeight(true);width=$popup.outerWidth(true);open();iframe.attr('src',o.loadUrl);triggerCall(o.loadCallback);break;case('image'):open();$('<img />').load(function(){triggerCall(o.loadCallback);recenter($(this));}).attr('src',o.loadUrl).hide().appendTo(o.contentContainer);break;default:open();$('<div class="b-ajax-wrapper"></div>').load(o.loadUrl,o.loadData,function(response,status,xhr){triggerCall(o.loadCallback,status);recenter($(this));}).hide().appendTo(o.contentContainer);break;}};function open(){if(o.modal){$('<div class="b-modal '+id+'"></div>').css({backgroundColor:o.modalColor,position:'fixed',top:0,right:0,bottom:0,left:0,opacity:0,zIndex:o.zIndex+popups}).appendTo(o.appendTo).fadeTo(o.speed,o.opacity);} | ||
4 | +calcPosition();$popup.data('bPopup',o).data('id',id).css({'left':o.transition=='slideIn'||o.transition=='slideBack'?(o.transition=='slideBack'?d.scrollLeft()+wW:(hPos+width)*-1):getLeftPos(!(!o.follow[0]&&fixedHPos||fixedPosStyle)),'position':o.positionStyle||'absolute','top':o.transition=='slideDown'||o.transition=='slideUp'?(o.transition=='slideUp'?d.scrollTop()+wH:vPos+height*-1):getTopPos(!(!o.follow[1]&&fixedVPos||fixedPosStyle)),'z-index':o.zIndex+popups+1}).each(function(){if(o.appending){$(this).appendTo(o.appendTo);}});doTransition(true);};function close(){if(o.modal){$('.b-modal.'+$popup.data('id')).fadeTo(o.speed,0,function(){$(this).remove();});} | ||
5 | +unbindEvents();clearTimeout(autoCloseTO);doTransition();return false;};function reposition(animateSpeed){wH=windowHeight();wW=windowWidth();inside=insideWindow();if(inside){clearTimeout(debounce);debounce=setTimeout(function(){calcPosition();animateSpeed=animateSpeed||o.followSpeed;$popup.dequeue().each(function(){if(fixedPosStyle){$(this).css({'left':hPos,'top':vPos});} | ||
6 | +else{$(this).animate({'left':o.follow[0]?getLeftPos(true):'auto','top':o.follow[1]?getTopPos(true):'auto'},animateSpeed,o.followEasing);}});},50);}};function recenter(content){var _width=content.width(),_height=content.height(),css={};o.contentContainer.css({height:_height,width:_width});if(_height>=$popup.height()){css.height=$popup.height();} | ||
7 | +if(_width>=$popup.width()){css.width=$popup.width();} | ||
8 | +height=$popup.outerHeight(true),width=$popup.outerWidth(true);calcPosition();o.contentContainer.css({height:'auto',width:'auto'});css.left=getLeftPos(!(!o.follow[0]&&fixedHPos||fixedPosStyle)),css.top=getTopPos(!(!o.follow[1]&&fixedVPos||fixedPosStyle));$popup.animate(css,250,function(){content.show();inside=insideWindow();});};function bindEvents(){$w.data('bPopup',popups);$popup.delegate('.bClose, .'+o.closeClass,'click.'+id,close);if(o.modalClose){$('.b-modal.'+id).css('cursor','pointer').bind('click',close);} | ||
9 | +if(!isIOS6X&&(o.follow[0]||o.follow[1])){$w.bind('scroll.'+id,function(){if(inside){$popup.dequeue().animate({'left':o.follow[0]?getLeftPos(!fixedPosStyle):'auto','top':o.follow[1]?getTopPos(!fixedPosStyle):'auto'},o.followSpeed,o.followEasing);}}).bind('resize.'+id,function(){reposition();});} | ||
10 | +if(o.escClose){d.bind('keydown.'+id,function(e){if(e.which==27){close();}});}};function unbindEvents(){if(!o.scrollBar){$('html').css('overflow','auto');} | ||
11 | +$('.b-modal.'+id).unbind('click');d.unbind('keydown.'+id);$w.unbind('.'+id).data('bPopup',($w.data('bPopup')-1>0)?$w.data('bPopup')-1:null);$popup.undelegate('.bClose, .'+o.closeClass,'click.'+id,close).data('bPopup',null);};function doTransition(open){switch(open?o.transition:o.transitionClose||o.transition){case"slideIn":animate({left:open?getLeftPos(!(!o.follow[0]&&fixedHPos||fixedPosStyle)):d.scrollLeft()-(width||$popup.outerWidth(true))-buffer});break;case"slideBack":animate({left:open?getLeftPos(!(!o.follow[0]&&fixedHPos||fixedPosStyle)):d.scrollLeft()+wW+buffer});break;case"slideDown":animate({top:open?getTopPos(!(!o.follow[1]&&fixedVPos||fixedPosStyle)):d.scrollTop()-(height||$popup.outerHeight(true))-buffer});break;case"slideUp":animate({top:open?getTopPos(!(!o.follow[1]&&fixedVPos||fixedPosStyle)):d.scrollTop()+wH+buffer});break;default:$popup.stop().fadeTo(o.speed,open?1:0,function(){onCompleteCallback(open);});} | ||
12 | +function animate(css){$popup.css({display:'block',opacity:1}).animate(css,o.speed,o.easing,function(){onCompleteCallback(open);});};};function onCompleteCallback(open){if(open){bindEvents();triggerCall(callback);if(o.autoClose){autoCloseTO=setTimeout(close,o.autoClose);}}else{$popup.hide();triggerCall(o.onClose);if(o.loadUrl){o.contentContainer.empty();$popup.css({height:'auto',width:'auto'});}}};function getLeftPos(includeScroll){return includeScroll?hPos+d.scrollLeft():hPos;};function getTopPos(includeScroll){return includeScroll?vPos+d.scrollTop():vPos;};function triggerCall(func,arg){$.isFunction(func)&&func.call($popup,arg);};function calcPosition(){vPos=fixedVPos?o.position[1]:Math.max(0,((wH-$popup.outerHeight(true))/2)-o.amsl),hPos=fixedHPos?o.position[0]:(wW-$popup.outerWidth(true))/2,inside=insideWindow();};function insideWindow(){return wH>$popup.outerHeight(true)&&wW>$popup.outerWidth(true);};function windowHeight(){return w.innerHeight||$w.height();};function windowWidth(){return w.innerWidth||$w.width();};};$.fn.bPopup.defaults={amsl:50,appending:true,appendTo:'body',autoClose:false,closeClass:'b-close',content:'ajax',contentContainer:false,easing:'swing',escClose:true,follow:[true,true],followEasing:'swing',followSpeed:500,iframeAttr:'scrolling="no" frameborder="0"',loadCallback:false,loadData:false,loadUrl:false,modal:true,modalClose:true,modalColor:'#000',onClose:false,onOpen:false,opacity:0.7,position:['auto','auto'],positionStyle:'absolute',scrollBar:true,speed:250,transition:'fadeIn',transitionClose:false,zIndex:9997};})(jQuery); | ||
0 | \ No newline at end of file | 13 | \ No newline at end of file |
1 | +/* | ||
2 | + * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ | ||
3 | + * | ||
4 | + * Uses the built in easing capabilities added In jQuery 1.1 | ||
5 | + * to offer multiple easing options | ||
6 | + * | ||
7 | + * TERMS OF USE - jQuery Easing | ||
8 | + * | ||
9 | + * Open source under the BSD License. | ||
10 | + * | ||
11 | + * Copyright © 2008 George McGinley Smith | ||
12 | + * All rights reserved. | ||
13 | + * | ||
14 | + * Redistribution and use in source and binary forms, with or without modification, | ||
15 | + * are permitted provided that the following conditions are met: | ||
16 | + * | ||
17 | + * Redistributions of source code must retain the above copyright notice, this list of | ||
18 | + * conditions and the following disclaimer. | ||
19 | + * Redistributions in binary form must reproduce the above copyright notice, this list | ||
20 | + * of conditions and the following disclaimer in the documentation and/or other materials | ||
21 | + * provided with the distribution. | ||
22 | + * | ||
23 | + * Neither the name of the author nor the names of contributors may be used to endorse | ||
24 | + * or promote products derived from this software without specific prior written permission. | ||
25 | + * | ||
26 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY | ||
27 | + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
28 | + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
29 | + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
30 | + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | ||
31 | + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | ||
32 | + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
33 | + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
34 | + * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
35 | + * | ||
36 | +*/ | ||
37 | + | ||
38 | +// t: current time, b: begInnIng value, c: change In value, d: duration | ||
39 | +jQuery.easing['jswing'] = jQuery.easing['swing']; | ||
40 | + | ||
41 | +jQuery.extend( jQuery.easing, | ||
42 | +{ | ||
43 | + def: 'easeOutQuad', | ||
44 | + swing: function (x, t, b, c, d) { | ||
45 | + //alert(jQuery.easing.default); | ||
46 | + return jQuery.easing[jQuery.easing.def](x, t, b, c, d); | ||
47 | + }, | ||
48 | + easeInQuad: function (x, t, b, c, d) { | ||
49 | + return c*(t/=d)*t + b; | ||
50 | + }, | ||
51 | + easeOutQuad: function (x, t, b, c, d) { | ||
52 | + return -c *(t/=d)*(t-2) + b; | ||
53 | + }, | ||
54 | + easeInOutQuad: function (x, t, b, c, d) { | ||
55 | + if ((t/=d/2) < 1) return c/2*t*t + b; | ||
56 | + return -c/2 * ((--t)*(t-2) - 1) + b; | ||
57 | + }, | ||
58 | + easeInCubic: function (x, t, b, c, d) { | ||
59 | + return c*(t/=d)*t*t + b; | ||
60 | + }, | ||
61 | + easeOutCubic: function (x, t, b, c, d) { | ||
62 | + return c*((t=t/d-1)*t*t + 1) + b; | ||
63 | + }, | ||
64 | + easeInOutCubic: function (x, t, b, c, d) { | ||
65 | + if ((t/=d/2) < 1) return c/2*t*t*t + b; | ||
66 | + return c/2*((t-=2)*t*t + 2) + b; | ||
67 | + }, | ||
68 | + easeInQuart: function (x, t, b, c, d) { | ||
69 | + return c*(t/=d)*t*t*t + b; | ||
70 | + }, | ||
71 | + easeOutQuart: function (x, t, b, c, d) { | ||
72 | + return -c * ((t=t/d-1)*t*t*t - 1) + b; | ||
73 | + }, | ||
74 | + easeInOutQuart: function (x, t, b, c, d) { | ||
75 | + if ((t/=d/2) < 1) return c/2*t*t*t*t + b; | ||
76 | + return -c/2 * ((t-=2)*t*t*t - 2) + b; | ||
77 | + }, | ||
78 | + easeInQuint: function (x, t, b, c, d) { | ||
79 | + return c*(t/=d)*t*t*t*t + b; | ||
80 | + }, | ||
81 | + easeOutQuint: function (x, t, b, c, d) { | ||
82 | + return c*((t=t/d-1)*t*t*t*t + 1) + b; | ||
83 | + }, | ||
84 | + easeInOutQuint: function (x, t, b, c, d) { | ||
85 | + if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; | ||
86 | + return c/2*((t-=2)*t*t*t*t + 2) + b; | ||
87 | + }, | ||
88 | + easeInSine: function (x, t, b, c, d) { | ||
89 | + return -c * Math.cos(t/d * (Math.PI/2)) + c + b; | ||
90 | + }, | ||
91 | + easeOutSine: function (x, t, b, c, d) { | ||
92 | + return c * Math.sin(t/d * (Math.PI/2)) + b; | ||
93 | + }, | ||
94 | + easeInOutSine: function (x, t, b, c, d) { | ||
95 | + return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; | ||
96 | + }, | ||
97 | + easeInExpo: function (x, t, b, c, d) { | ||
98 | + return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; | ||
99 | + }, | ||
100 | + easeOutExpo: function (x, t, b, c, d) { | ||
101 | + return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; | ||
102 | + }, | ||
103 | + easeInOutExpo: function (x, t, b, c, d) { | ||
104 | + if (t==0) return b; | ||
105 | + if (t==d) return b+c; | ||
106 | + if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; | ||
107 | + return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; | ||
108 | + }, | ||
109 | + easeInCirc: function (x, t, b, c, d) { | ||
110 | + return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; | ||
111 | + }, | ||
112 | + easeOutCirc: function (x, t, b, c, d) { | ||
113 | + return c * Math.sqrt(1 - (t=t/d-1)*t) + b; | ||
114 | + }, | ||
115 | + easeInOutCirc: function (x, t, b, c, d) { | ||
116 | + if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; | ||
117 | + return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; | ||
118 | + }, | ||
119 | + easeInElastic: function (x, t, b, c, d) { | ||
120 | + var s=1.70158;var p=0;var a=c; | ||
121 | + if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; | ||
122 | + if (a < Math.abs(c)) { a=c; var s=p/4; } | ||
123 | + else var s = p/(2*Math.PI) * Math.asin (c/a); | ||
124 | + return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; | ||
125 | + }, | ||
126 | + easeOutElastic: function (x, t, b, c, d) { | ||
127 | + var s=1.70158;var p=0;var a=c; | ||
128 | + if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; | ||
129 | + if (a < Math.abs(c)) { a=c; var s=p/4; } | ||
130 | + else var s = p/(2*Math.PI) * Math.asin (c/a); | ||
131 | + return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; | ||
132 | + }, | ||
133 | + easeInOutElastic: function (x, t, b, c, d) { | ||
134 | + var s=1.70158;var p=0;var a=c; | ||
135 | + if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); | ||
136 | + if (a < Math.abs(c)) { a=c; var s=p/4; } | ||
137 | + else var s = p/(2*Math.PI) * Math.asin (c/a); | ||
138 | + if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; | ||
139 | + return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; | ||
140 | + }, | ||
141 | + easeInBack: function (x, t, b, c, d, s) { | ||
142 | + if (s == undefined) s = 1.70158; | ||
143 | + return c*(t/=d)*t*((s+1)*t - s) + b; | ||
144 | + }, | ||
145 | + easeOutBack: function (x, t, b, c, d, s) { | ||
146 | + if (s == undefined) s = 1.70158; | ||
147 | + return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; | ||
148 | + }, | ||
149 | + easeInOutBack: function (x, t, b, c, d, s) { | ||
150 | + if (s == undefined) s = 1.70158; | ||
151 | + if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; | ||
152 | + return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; | ||
153 | + }, | ||
154 | + easeInBounce: function (x, t, b, c, d) { | ||
155 | + return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; | ||
156 | + }, | ||
157 | + easeOutBounce: function (x, t, b, c, d) { | ||
158 | + if ((t/=d) < (1/2.75)) { | ||
159 | + return c*(7.5625*t*t) + b; | ||
160 | + } else if (t < (2/2.75)) { | ||
161 | + return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; | ||
162 | + } else if (t < (2.5/2.75)) { | ||
163 | + return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; | ||
164 | + } else { | ||
165 | + return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; | ||
166 | + } | ||
167 | + }, | ||
168 | + easeInOutBounce: function (x, t, b, c, d) { | ||
169 | + if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; | ||
170 | + return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; | ||
171 | + } | ||
172 | +}); | ||
173 | + | ||
174 | +/* | ||
175 | + * | ||
176 | + * TERMS OF USE - EASING EQUATIONS | ||
177 | + * | ||
178 | + * Open source under the BSD License. | ||
179 | + * | ||
180 | + * Copyright © 2001 Robert Penner | ||
181 | + * All rights reserved. | ||
182 | + * | ||
183 | + * Redistribution and use in source and binary forms, with or without modification, | ||
184 | + * are permitted provided that the following conditions are met: | ||
185 | + * | ||
186 | + * Redistributions of source code must retain the above copyright notice, this list of | ||
187 | + * conditions and the following disclaimer. | ||
188 | + * Redistributions in binary form must reproduce the above copyright notice, this list | ||
189 | + * of conditions and the following disclaimer in the documentation and/or other materials | ||
190 | + * provided with the distribution. | ||
191 | + * | ||
192 | + * Neither the name of the author nor the names of contributors may be used to endorse | ||
193 | + * or promote products derived from this software without specific prior written permission. | ||
194 | + * | ||
195 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY | ||
196 | + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
197 | + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
198 | + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
199 | + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | ||
200 | + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | ||
201 | + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
202 | + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
203 | + * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
204 | + * | ||
205 | + */ | ||
0 | \ No newline at end of file | 206 | \ No newline at end of file |
1 | +;jQuery.easing['jswing']=jQuery.easing['swing'];jQuery.extend(jQuery.easing,{def:'easeOutQuad',swing:function(x,t,b,c,d){return jQuery.easing[jQuery.easing.def](x,t,b,c,d);},easeInQuad:function(x,t,b,c,d){return c*(t/=d)*t+b;},easeOutQuad:function(x,t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeInOutQuad:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;},easeInCubic:function(x,t,b,c,d){return c*(t/=d)*t*t+b;},easeOutCubic:function(x,t,b,c,d){return c*((t=t/d-1)*t*t+1)+b;},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;},easeInQuart:function(x,t,b,c,d){return c*(t/=d)*t*t*t+b;},easeOutQuart:function(x,t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b;},easeInOutQuart:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b;},easeInQuint:function(x,t,b,c,d){return c*(t/=d)*t*t*t*t+b;},easeOutQuint:function(x,t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b;},easeInOutQuint:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b;},easeInSine:function(x,t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b;},easeOutSine:function(x,t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b;},easeInOutSine:function(x,t,b,c,d){return-c/2*(Math.cos(Math.PI*t/d)-1)+b;},easeInExpo:function(x,t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b;},easeOutExpo:function(x,t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b;},easeInOutExpo:function(x,t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b;},easeInCirc:function(x,t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b;},easeOutCirc:function(x,t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b;},easeInOutCirc:function(x,t,b,c,d){if((t/=d/2)<1)return-c/2*(Math.sqrt(1-t*t)-1)+b;return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b;},easeInElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4;} | ||
2 | +else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;},easeOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4;} | ||
3 | +else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b;},easeInOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(a<Math.abs(c)){a=c;var s=p/4;} | ||
4 | +else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b;},easeInBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b;},easeOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},easeInOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;},easeInBounce:function(x,t,b,c,d){return c-jQuery.easing.easeOutBounce(x,d-t,0,c,d)+b;},easeOutBounce:function(x,t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;}},easeInOutBounce:function(x,t,b,c,d){if(t<d/2)return jQuery.easing.easeInBounce(x,t*2,0,c,d)*.5+b;return jQuery.easing.easeOutBounce(x,t*2-d,0,c,d)*.5+c*.5+b;}}); | ||
0 | \ No newline at end of file | 5 | \ No newline at end of file |
1 | +(function(a) { | ||
2 | + | ||
3 | + var m = a("#popup"), n = a("#popup2"), d = 0; | ||
4 | + | ||
5 | + a(function() { | ||
6 | + a(".small.special").on("open.bpopup",function() { | ||
7 | + alert("I'm special") | ||
8 | + }); | ||
9 | + a("body").on("click",".small",function() { | ||
10 | + var c = a(this).hasClass("pop1")? m : n , | ||
11 | + h = a(".content"), | ||
12 | + j = a(this); | ||
13 | + if (a(this).hasClass("events")) | ||
14 | + c.bPopup ({ | ||
15 | + onOpen: function() { | ||
16 | + alert("onOpen fired") | ||
17 | + }, | ||
18 | + onClose: function(){ | ||
19 | + alert("onClose fired") | ||
20 | + } | ||
21 | + }, function(){ | ||
22 | + alert("Callback fired") | ||
23 | + }); | ||
24 | + else if (a(this).hasClass("random")) { | ||
25 | + var e = b(0, a(window).width() - 500), | ||
26 | + p = b(a(document).scrollTop(), | ||
27 | + a(document).scrollTop() + a(window).height() - 300), | ||
28 | + k = 3 == b (0,4), | ||
29 | + l = b(0,2), | ||
30 | + f = "fadeIn", | ||
31 | + g = 350; | ||
32 | + 1 === l ? (f = "slideDown", g = 600) : 2 === l && (f = "slideIn", g = 500); | ||
33 | + c.bPopup ({ | ||
34 | + follow: k ? [!0, !0] : [!1, !1], | ||
35 | + position: !k ? [e,p] : ["auto","auto"], | ||
36 | + opacity: "0." + b(1, 9), positionStyle : 25 == b (0, 50) ? "fixed": "absolute", | ||
37 | + modal: 0 == b(0, 10) ? !1: !0, | ||
38 | + modalClose: 0 == b(0, 5) ? !1: !0, | ||
39 | + modalColor: "hsl(" + b(0,360) + ",100%, 50%)", | ||
40 | + transition: f, | ||
41 | + speed: g | ||
42 | + }) | ||
43 | + } else a(this).hasClass("x-content") ? c.bPopup({ | ||
44 | + onOpen: function(){ | ||
45 | + h.html (j.data("bpopup") || {}) | ||
46 | + }, | ||
47 | + onClose: function() { | ||
48 | + h.empty() | ||
49 | + } | ||
50 | + }) :a(this).hasClass("multi") ? ( | ||
51 | + d++, | ||
52 | + c = b(0,a(window).width()-500), | ||
53 | + e = b(a(document).scrollTop(), a(document).scrollTop() + | ||
54 | + a(window).height() - 300), | ||
55 | + a('<div class="bMulti"><span class="button bClose close' + d + '"><span>X</span></span><p>' + d + '</p><a class="button small multi">Pop another up</a></div>'). bPopup({ | ||
56 | + closeClass: "close" + d, | ||
57 | + position: [c, e], | ||
58 | + follow: [!1, !1], | ||
59 | + onClose: function() { | ||
60 | + d--; | ||
61 | + a(this).remove() | ||
62 | + } | ||
63 | + }) | ||
64 | + ) : c.bPopup (j.data("bpopup") || {} ) | ||
65 | + }) | ||
66 | + }); | ||
67 | + var b = function(a, b) { | ||
68 | + return ~~ (Math.random() * (b - a + 1) + a) | ||
69 | + } | ||
70 | +})(jQuery); |
1 | +;(function(a){var m=a("#popup"),n=a("#popup2"),d=0;a(function(){a(".small.special").on("open.bpopup",function(){alert("I'm special")});a("body").on("click",".small",function(){var c=a(this).hasClass("pop1")?m:n,h=a(".content"),j=a(this);if(a(this).hasClass("events")) | ||
2 | +c.bPopup({onOpen:function(){alert("onOpen fired")},onClose:function(){alert("onClose fired")}},function(){alert("Callback fired")});else if(a(this).hasClass("random")){var e=b(0,a(window).width()-500),p=b(a(document).scrollTop(),a(document).scrollTop()+a(window).height()-300),k=3==b(0,4),l=b(0,2),f="fadeIn",g=350;1===l?(f="slideDown",g=600):2===l&&(f="slideIn",g=500);c.bPopup({follow:k?[!0,!0]:[!1,!1],position:!k?[e,p]:["auto","auto"],opacity:"0."+b(1,9),positionStyle:25==b(0,50)?"fixed":"absolute",modal:0==b(0,10)?!1:!0,modalClose:0==b(0,5)?!1:!0,modalColor:"hsl("+b(0,360)+",100%, 50%)",transition:f,speed:g})}else a(this).hasClass("x-content")?c.bPopup({onOpen:function(){h.html(j.data("bpopup")||{})},onClose:function(){h.empty()}}):a(this).hasClass("multi")?(d++,c=b(0,a(window).width()-500),e=b(a(document).scrollTop(),a(document).scrollTop()+ | ||
3 | +a(window).height()-300),a('<div class="bMulti"><span class="button bClose close'+d+'"><span>X</span></span><p>'+d+'</p><a class="button small multi">Pop another up</a></div>').bPopup({closeClass:"close"+d,position:[c,e],follow:[!1,!1],onClose:function(){d--;a(this).remove()}})):c.bPopup(j.data("bpopup")||{})})});var b=function(a,b){return~~(Math.random()*(b-a+1)+a)}})(jQuery); | ||
0 | \ No newline at end of file | 4 | \ No newline at end of file |
1 | + | ||
2 | + // ============= | ||
3 | + // ==== VAR ==== | ||
4 | + // ============= | ||
5 | + | ||
6 | + var $modalBoxTotal = 0; | ||
7 | + | ||
8 | + // =============== | ||
9 | + // ==== METOD ==== | ||
10 | + // =============== | ||
11 | + | ||
12 | + function percentToPix ($value) | ||
13 | + { | ||
14 | + return $value == null ? 0 : parseInt (screen.width * $value / 100); | ||
15 | + } | ||
16 | + | ||
17 | + function modalBoxLoad (content, $option) | ||
18 | + { | ||
19 | + var ID = $modalBoxTotal; | ||
20 | + $width = 80; | ||
21 | + $modalBoxId = 'modalBoxId-' + ID; | ||
22 | + $style = 'style="max-width:' + percentToPix ($width) + 'px;"'; | ||
23 | + | ||
24 | + var $modal = | ||
25 | + '<div class="modalBox ' + $modalBoxId + '" ' + $style + '>' | ||
26 | + + '<div class="right"><div class="close bClose">X</div></div>' | ||
27 | + + '<div class="content">' + content + '</div>' | ||
28 | + + '</div>'; | ||
29 | + | ||
30 | + var $default = { | ||
31 | + 'id': ID, | ||
32 | + 'transition': 'slideDown', | ||
33 | +// 'closeClass': 'bClose-' + ID, | ||
34 | + 'onOpen': function() { | ||
35 | + $modalBoxTotal++; | ||
36 | + $(this).html($modal) | ||
37 | + }, | ||
38 | + 'onClose': function() { | ||
39 | + $modalBoxTotal--; | ||
40 | + $('.' + $modalBoxId).remove(); | ||
41 | + }, | ||
42 | + 'width': $width | ||
43 | + }; | ||
44 | + | ||
45 | + var $setting = $.extend({}, $default, $option); | ||
46 | + | ||
47 | + if ($('#duty').length == 0) | ||
48 | + { | ||
49 | + $('body').append('<div id="duty"></div>').promise().done(function() | ||
50 | + { | ||
51 | + $('#duty').bPopup($setting).reposition(1); | ||
52 | + }); | ||
53 | + } | ||
54 | + else | ||
55 | + { | ||
56 | + $('#duty').bPopup($setting).reposition(1); | ||
57 | + } | ||
58 | + } | ||
59 | + | ||
60 | + function modalBoxClose () | ||
61 | + { | ||
62 | + $('#duty').bPopup().close(); | ||
63 | + } | ||
64 | + | ||
65 | + | ||
66 | + function isModalBox () | ||
67 | + { | ||
68 | + return ($modalBoxTotal > 0) ? true : false; | ||
69 | + } |