How to use defaults method in Cypress

Best JavaScript code snippet using cypress

Run Cypress automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

notifIt.js

Source: notifIt.js Github

copy
1/*
2 * notifIt! by @naoxink
3 */
4(function(root, factory) {
5    if (typeof define === 'function' && define.amd) {
6        // AMD. Register as an anonymous module.
7        define(factory);
8    } else {
9        // Browser globals
10        var package = factory(root.b);
11        root.notif = package.notif;
12        root.notif_confirm = package.notif_confirm;
13        root.notif_prompt  = package.notif_prompt;
14    }
15}(this, function() {
16
17
18    // Notification
19    function notif(config) {
20        // Util stuff
21        var create_close_button = function() {
22            return $('<span>', {
23                'id': 'notifIt_close',
24                'html': '&times'
25            });
26        }
27        var create_notification = function() {
28                var div = $('<div>', {
29                    'id': 'ui_notifIt'
30                });
31                var p = $('<p>', {
32                    html: defaults.msg
33                });
34                div.append(p);
35                return div;
36        }
37        // We love jQuery
38        var $ = jQuery;
39        var destroy = function() {
40            $("#ui_notifIt").remove();
41            clearTimeout(window.notifit_timeout);
42        }
43        var dismiss = function(){
44            clearTimeout(window.notifit_timeout);
45            if (!defaults.fade) {
46                // Set animations
47                if (defaults.animations && 
48                    defaults.animations[defaults.animation] && 
49                    defaults.animations[defaults.animation][defaults.position] && 
50                    defaults.animations[defaults.animation][defaults.position].out && 
51                    defaults.animations[defaults.animation][defaults.position].out.start && 
52                    defaults.animations[defaults.animation][defaults.position].out.end) {
53                    animation1 = defaults.animations[defaults.animation][defaults.position].out.start
54                    animation2 = defaults.animations[defaults.animation][defaults.position].out.end
55                } else if (defaults.animations[defaults.available_animations[0]] && 
56                    defaults.animations[defaults.available_animations[0]][defaults.position] && 
57                    defaults.animations[defaults.available_animations[0]][defaults.position].out && 
58                    defaults.animations[defaults.available_animations[0]][defaults.position].out.start && 
59                    defaults.animations[defaults.available_animations[0]][defaults.position].out.end) {
60                    animation1 = defaults.animations[defaults.available_animations[0]][defaults.position].out.start
61                    animation2 = defaults.animations[defaults.available_animations[0]][defaults.position].out.end
62                } else {
63                    throw new Error('Invalid animation')
64                }
65                // Execute animations       
66                $("#ui_notifIt").animate(animation1, 100, function() {
67                    $("#ui_notifIt").animate(animation2, 100, function() {
68                        $("#ui_notifIt").remove();
69                        if (defaults.callback) {
70                            defaults.callback();
71                        }
72                    });
73                });
74            } else {
75                // jQuery's fade, why create my own?
76                $("#ui_notifIt").fadeOut("slow", function() {
77                    $("#ui_notifIt").remove();
78                    if (defaults.callback) {
79                        defaults.callback();
80                    }
81                });
82            }
83        }
84        destroy()
85        // Global timeout
86        window.notifit_timeout = null;
87        // Mid position
88        var mid = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) / 2;
89        // Available positions
90        var available_positions = ['left', 'center', 'right', 'bottom'];
91        // Default config
92        var defaults = {
93            type: "default",
94            width: 400,
95            position: "right",
96            autohide: 1,
97            msg: "This is my default message",
98            opacity: 1,
99            multiline: 0,
100            fade: 0,
101            bgcolor: "",
102            color: "",
103            timeout: 5000,
104            zindex: null,
105            offset: 0,
106            callback: null,
107            clickable: false,
108            animation: 'slide'
109        };
110        // Extend with new params
111        $.extend(defaults, config);
112        // Animation config
113        // ** Maybe create an external js with only animations for easier customizing? **
114        defaults.animations = {}
115        // Slide animation [DEFAULT]
116        defaults.animations.slide = {
117            'center': {
118                'css_start': {
119                    "top": parseInt(0 - (defaults.height + 10)),
120                    "left": mid - parseInt(defaults.width / 2)
121                },
122                'in': {
123                    'top': parseInt(10 + defaults.offset)
124                },
125                'out': {
126                    'start': {
127                        'top': parseInt(defaults.height - (defaults.height / 2))
128                    },
129                    'end': {
130                        'top': parseInt(0 - (defaults.height * 2))
131                    }
132                }
133            },
134            'bottom': {
135                'css_start': {
136                    "top": 'auto',
137                    "bottom": parseInt(0 - (defaults.height + 10)),
138                    "left": mid - parseInt(defaults.width / 2)
139                },
140                'in': {
141                    'bottom': parseInt(10 + defaults.offset)
142                },
143                'out': {
144                    'start': {
145                        'bottom': parseInt(defaults.height - (defaults.height / 2))
146                    },
147                    'end': {
148                        'bottom': parseInt(0 - (defaults.height * 2))
149                    }
150                }
151            },
152            'right': {
153                'css_start': {
154                    "right": parseInt(0 - (defaults.width + 10)),
155                    "right": parseInt(0 - (defaults.width * 2))
156                },
157                'in': {
158                    'right': parseInt(10 + defaults.offset)
159                },
160                'out': {
161                    'start': {
162                        'right': parseFloat(defaults.width - (defaults.width * 0.9))
163                    },
164                    'end': {
165                        'right': parseInt(0 - (defaults.width * 2))
166                    }
167                }
168            },
169            'left': {
170                'css_start': {
171                    "left": parseInt(0 - (defaults.width + 10))
172                },
173                'in': {
174                    'left': parseInt(10 + defaults.offset)
175                },
176                'out': {
177                    'start': {
178                        'left': parseFloat(defaults.width - (defaults.width * 0.9))
179                    },
180                    'end': {
181                        'left': parseInt(0 - (defaults.width * 2))
182                    }
183                }
184            }
185        };
186        // Zoom animation
187        defaults.animations.zoom = {
188            'center': { // Not working well
189                'css_start': {
190                    "top": 10,
191                    "left": mid - parseInt(defaults.width / 2),
192                    "zoom": 0.01
193                },
194                'in': {
195                    'zoom': 1
196                },
197                'out': {
198                    'start': {
199                        'zoom': 1.3
200                    },
201                    'end': {
202                        'zoom': 0.01
203                    }
204                }
205            },
206            'bottom': { // Not working well
207                'css_start': {
208                    "top": 'auto',
209                    "bottom": 10,
210                    "left": mid - parseInt(defaults.width / 2),
211                    "zoom": 0.01
212                },
213                'in': {
214                    'zoom': 1
215                },
216                'out': {
217                    'start': {
218                        'zoom': 1.3
219                    },
220                    'end': {
221                        'zoom': 0.01
222                    }
223                }
224            },
225            'right': {
226                'css_start': {
227                    'right': 10,
228                    'zoom': 0.01
229                },
230                'in': {
231                    'right': parseInt(10 + defaults.offset),
232                    'zoom': 1
233                },
234                'out': {
235                    'start': {
236                        'zoom': 1.3
237                    },
238                    'end': {
239                        'zoom': 0.01
240                    }
241                }
242            },
243            'left': {
244                'css_start': {
245                    'left': 10,
246                    'zoom': 0.01
247                },
248                'in': {
249                    'zoom': 1
250                },
251                'out': {
252                    'start': {
253                        'zoom': 1.3
254                    },
255                    'end': {
256                        'zoom': 0.01
257                    }
258                }
259            }
260        };
261        // Check if animation exists
262        defaults.available_animations = Object.keys(defaults.animations)
263        if (!defaults.available_animations.length) {
264            throw new Error('No animations')
265        }
266        if (!available_positions.length) {
267            throw new Error('No available positions')
268        }
269        if (available_positions.indexOf(defaults.position) === -1) {
270            defaults.position = available_positions[0]
271        }
272        if (defaults.available_animations.indexOf(defaults.animation) === -1) {
273            defaults.animation = defaults.available_animations[0]
274        }
275        // Check callback
276        if (typeof defaults.callback !== 'function') {
277            defaults.callback = null;
278        }
279        // Width & Height
280        if (defaults.width > 0) {
281            defaults.width = defaults.width;
282        } else if (defaults.width === "all") {
283            defaults.width = screen.width - 60;
284        } else {
285            defaults.width = 400;
286        }
287        if (defaults.height > 100 || defaults.height < 0) {
288            defaults.height = 60;
289        }
290        // Create notification itself
291        var div = create_notification()
292            // If clickable add close button
293        if (defaults.clickable) {
294            div.append(create_close_button())
295        }
296        $("body").append(div);
297        // Set z-index
298        if (defaults.zindex) {
299            $("#ui_notifIt").css("z-index", defaults.zindex);
300        }
301        // If multiline we have to set the padding instead line-height
302        if (defaults.multiline) {
303            $("#ui_notifIt").css("padding", 15);
304        } else {
305            $("#ui_notifIt").css("height", defaults.height);
306            $("#ui_notifIt p").css("line-height", defaults.height + "px");
307        }
308        // Basic css
309        $("#ui_notifIt").css({
310            "width": defaults.width,
311            "opacity": defaults.opacity,
312            "background-color": defaults.bgcolor,
313            "color": defaults.color
314        });
315        $("#ui_notifIt p").css({
316            "color": defaults.color
317        })
318        // Class 'success', 'error', 'warning', 'info'..
319        $("#ui_notifIt").addClass(defaults.type);
320        // Set entry animation   
321        if (defaults.animations[defaults.animation][defaults.position].css_start) {
322            $("#ui_notifIt").css(defaults.animations[defaults.animation][defaults.position].css_start);
323        } else {
324            $("#ui_notifIt").css(defaults.animations[defaults.available_animations[0]][defaults.position].css_start);
325        }
326        // Execute entry animation
327        $("#ui_notifIt").animate(defaults.animations[defaults.animation][defaults.position].in);
328        // Events
329        if (!defaults.clickable) {
330            $("#ui_notifIt").click(function(e) {
331                e.stopPropagation();
332                dismiss(defaults);
333            });
334        }
335        $('body').on('click', '#ui_notifIt #notifIt_close', function() {
336            dismiss(defaults);
337        });
338        if (defaults.autohide) {
339            if (!isNaN(defaults.timeout)) {
340                window.notifit_timeout = setTimeout(function() {
341                    dismiss(defaults);
342                }, defaults.timeout);
343            }
344        }
345        return {
346            'destroy': destroy,
347            'dismiss': dismiss
348        }
349    }
350
351    // Confirm
352    function notif_confirm(config){
353        var $ = jQuery
354        var _config = {
355            'textaccept': 'Accept',
356            'textcancel': 'Cancel',
357            'message': 'Is that what you want to do?',
358            'fullscreen': false,
359            'callback': null
360        }
361        var settings = $.extend({  }, _config, config)
362        var $confirm = $('.notifit_confirm')[0] ? $('.notifit_confirm') : null;
363        var $bg = $('.notifit_confirm_bg')[0] ? $('.notifit_confirm_bg') : null;
364
365        function _create(){
366            if($confirm !== null){
367                return $confirm
368            }
369            var $acceptButton = $('<button>', {
370                'class': 'notifit_confirm_accept',
371                'text': settings.textaccept
372            })
373            var $cancelButton = $('<button>', {
374                'class': 'notifit_confirm_cancel',
375                'text': settings.textcancel
376            })
377            var $message = $('<div>', {
378                'class': 'notifit_confirm_message',
379                'text': settings.message
380            })
381            $confirm = $('<div>', {
382                'class': 'notifit_confirm'
383            })
384            $confirm
385                .append($message)
386                .append($acceptButton)
387                .append($cancelButton)
388            $bg = $('<div>', { 'class': 'notifit_confirm_bg' })
389            return $confirm
390        }
391        function _show(){
392            if($confirm){
393                if(settings.fullscreen){
394                    $bg.hide()
395                    $confirm.hide()
396                    $('body').append($bg)
397                    $('body').append($confirm)
398                    $confirm.css({
399                        'top': $bg.outerHeight() / 2 - ($confirm.outerHeight() / 2),
400                        'left': $bg.outerWidth() / 2 - ($confirm.outerWidth() / 2)
401                    })
402                    $bg.fadeIn('fast', function(){ $confirm.slideDown('fast') })
403                }else{
404                    $confirm.css({
405                        'top': '20px',
406                        'left': 'auto',
407                        'right': '20px',
408                        'display': 'none'
409                    })
410                    $('body').append($confirm)
411                    $confirm.slideDown('fast')
412                }
413            }
414        }
415        function _hide(){
416            if($confirm){
417                $confirm.slideUp('fast', function(){
418                    $confirm.remove()
419                })
420            }
421            if($bg){
422                $bg.fadeOut('fast', function(){
423                    $bg.remove()
424                })
425            }
426        }
427        function _callback(){
428            _hide()
429            var response = null
430            if($(this).hasClass('notifit_confirm_accept')){
431                response = true
432            }else if($(this).hasClass('notifit_confirm_cancel')){
433                response = false
434            }
435            if(typeof settings.callback === 'function'){
436                return settings.callback(response)
437            }
438            return response
439        }
440        function _setListeners(){
441            $('html').one('click', '.notifit_confirm_accept, .notifit_confirm_cancel', _callback)
442        }
443
444        // Get the party started! \o/
445        _create()
446        _show()
447        _setListeners()
448    }
449
450    // Prompt
451    function notif_prompt(config){
452        var $ = jQuery
453        var _config = {
454            'message': 'Tell me something',
455            'default_value': '',
456            'textaccept': 'Accept',
457            'textcancel': 'Cancel',
458            'fullscreen': false,
459            'callback': null
460        }
461        var settings = $.extend({  }, _config, config)
462        var $prompt = $('.notifit_prompt')[0] ? $('.notifit_prompt') : null;
463        var $bg = $('.notifit_prompt_bg')[0] ? $('.notifit_prompt_bg') : null;
464        function _create(){
465            if($prompt !== null){ return $prompt }
466            var $acceptButton = $('<button>', {
467                'class': 'notifit_prompt_accept',
468                'text': settings.textaccept
469            })
470            var $cancelButton = $('<button>', {
471                'class': 'notifit_prompt_cancel',
472                'text': settings.textcancel
473            })
474            var $message = $('<p>', {
475                'class': 'notifit_prompt_message',
476                'text': settings.message
477            })
478            var $input = $('<input>', {
479                'type': 'text',
480                'class': 'notifit_prompt_input',
481                'value': settings.default_value
482            })
483            $prompt = $('<div>', {
484                'class': 'notifit_prompt'
485            })
486            $prompt
487                .append($message)
488                .append($input)
489                .append($cancelButton)
490                .append($acceptButton)
491            $bg = $('<div>', { 'class': 'notifit_prompt_bg' })
492            return $prompt
493        }
494        function _show(){
495            if($prompt){
496                if(settings.fullscreen){
497                    $bg.hide()
498                    $prompt.hide()
499                    $('body').append($bg)
500                    $('body').append($prompt)
501                    $prompt.css({
502                        'top': $bg.outerHeight() / 2 - ($prompt.outerHeight() / 2),
503                        'left': $bg.outerWidth() / 2 - ($prompt.outerWidth() / 2)
504                    })
505                    $bg.fadeIn('fast', function(){ $prompt.slideDown('fast', function(){ $(this).find('.notifit_prompt_input').focus() }) })
506                }else{
507                    $prompt.css({
508                        'top': '20px',
509                        'left': 'auto',
510                        'right': '20px',
511                        'display': 'none'
512                    })
513                    $('body').append($prompt)
514                    $prompt.slideDown('fast', function(){ $(this).find('.notifit_prompt_input').focus() })
515                }
516            }
517        }
518        function _hide(){
519            if($prompt){
520                $prompt.slideUp('fast', function(){
521                    $prompt.remove()
522                })
523            }
524            if($bg){
525                $bg.fadeOut('fast', function(){
526                    $bg.remove()
527                })
528            }
529        }
530        function _callback(){
531            _hide()
532            var response = null
533            if($(this).hasClass('notifit_prompt_accept')){
534                response = $(this).parents('.notifit_prompt').find('.notifit_prompt_input').val()
535            }else if($(this).hasClass('notifit_prompt_cancel')){
536                response = false
537            }
538            if(typeof settings.callback === 'function'){
539                return settings.callback(response)
540            }
541            return response
542        }
543        function _setListeners(){
544            $('html').one('click', '.notifit_prompt_accept, .notifit_prompt_cancel', _callback)
545        }
546
547        // Get the party started! Again! \o/
548        _create()
549        _show()
550        _setListeners()
551    }
552
553
554    return {
555        notif: notif,
556        notif_confirm: notif_confirm,
557        notif_prompt: notif_prompt
558    };
559}));
560
Full Screen

floatingAd.js

Source: floatingAd.js Github

copy
1/*
2 *  Description: 漂浮广告
3 *  Author: jjc
4 *  Date: 2012.07.04
5 */
6;(function ( $, window, document, undefined ) {
7    var pluginName = 'floatingAd';
8    var defaults = {
9		step: 1,
10		delay: 50, 
11		isLinkClosed: false,
12		onClose: function(elem){}
13    };
14    var ads = {
15    	linkUrl: '#',
16    	'z-index': '100',
17    	'closed-icon': '',
18    	imgHeight: '',
19    	imgWidth: '',
20    	title: '',
21    	img: '#',
22    	linkWindow: '_blank',
23    	headFilter: 0.2
24    };
25
26    function Plugin(element, options) {
27        this.element = element;
28        this.options = $.extend(
29        	{}, 
30        	defaults, 
31        	options, 
32        	{
33        		width: $(window).width(),
34				height: $(window).height(),
35        		xPos: this.getRandomNum(0, $(window).width() - $(element).innerWidth()), 
36				yPos: this.getRandomNum(0, 300),
37				yOn: this.getRandomNum(0, 1),
38				xOn: this.getRandomNum(0, 1),
39				yPath: this.getRandomNum(0, 1),
40				xPath: this.getRandomNum(0, 1),
41				hOffset: $(element).innerHeight(),
42				wOffset: $(element).innerWidth(),
43				fn: function(){},
44				interval: 0
45			}
46        );
47        this._defaults = defaults;
48        this._name = pluginName;
49        
50        this.init();
51    }
52
53    Plugin.prototype = {
54    	init: function () {
55    		var elem = $(this.element);
56    		var defaults = this.options;
57    		var p = this;
58    		var xFlag = 0;
59    		var yFlag = 0;
60    		
61    		elem.css({"left": defaults.xPos + p.scrollX(), "top": defaults.yPos + p.scrollY()});
62    		defaults.fn = function(){
63		    	defaults.width = $(window).width();
64				defaults.height = $(window).height();
65				
66				if(xFlag == p.scrollX() && yFlag == p.scrollY()){
67					elem.css({"left": defaults.xPos + p.scrollX(), "top": defaults.yPos + p.scrollY()});
68					if (defaults.yOn)
69						defaults.yPos = defaults.yPos + defaults.step;
70					else
71						defaults.yPos = defaults.yPos - defaults.step;
72				
73					if (defaults.yPos <= 0) {
74						defaults.yOn = 1;
75						defaults.yPos = 0;
76					}
77					if (defaults.yPos >= (defaults.height - defaults.hOffset)) {
78						defaults.yOn = 0;
79						defaults.yPos = (defaults.height - defaults.hOffset);
80					}
81					
82					if (defaults.xOn) 
83						defaults.xPos = defaults.xPos + defaults.step;
84					else
85						defaults.xPos = defaults.xPos - defaults.step;
86		
87					if (defaults.xPos <= 0) {
88						defaults.xOn = 1;
89						defaults.xPos = 0;
90					}
91					if (defaults.xPos >= (defaults.width - defaults.wOffset)) {
92						defaults.xOn = 0;
93						defaults.xPos = (defaults.width - defaults.wOffset);
94					}
95				}
96				yFlag = $(window).scrollTop();
97				xFlag = $(window).scrollLeft();
98   			};
99   			this.run(elem, defaults);
100    	},
101    	run: function(elem, defaults){
102    		this.start(elem, defaults);
103    		this.adEvent(elem,defaults);
104    	},
105    	start: function(elem, defaults){
106    		elem.find('div.close').hide();
107    		defaults.interval = window.setInterval(defaults.fn,  defaults.delay);
108    		window.setTimeout(function(){elem.show();}, defaults.delay);
109    	},
110    	getRandomNum: function (Min, Max){  
111			var Range = Max - Min;  
112			var Rand = Math.random();  
113			return(Min + Math.round(Rand * Range));  
114		},
115		getPath: function(on){
116			return on ? 0 : 1;
117		},
118		clear: function(elem, defaults){
119			elem.find('div.close').show();
120			window.clearInterval(defaults.interval);
121		},
122		close: function(elem, defaults, isClose){
123			elem.unbind('hover');
124  			elem.hide();
125  			if(isClose)
126				defaults.onClose.call(elem);
127		},
128		adEvent: function(elem, defaults){
129			var obj = {
130				elem: this,
131			  	fn_close: function() {
132			   		this.elem.close(elem, defaults, true);
133			  	},
134			  	fn_clear: function() {
135			  		if(this.elem.options.isLinkClosed)
136			  			this.elem.close(elem, defaults, false);
137			  	}
138			};
139			
140    		elem.find('div.button').bind('click', jQuery.proxy(obj, "fn_close"));
141    		
142    		elem.find('a').bind('click', jQuery.proxy(obj, "fn_clear"));
143    		
144    		var stop = {
145				elem: this,
146			  	over: function(){
147			    	this.elem.clear(elem, defaults);
148			  	},
149			  	out: function(){
150					this.elem.start(elem, defaults);
151			  	}
152			};
153    		
154    		elem.hover(
155			    jQuery.proxy(stop, "over"),
156				jQuery.proxy(stop, "out")
157			);
158		},
159		scrollX: function(){
160			var de = document.documentElement;
161			return self.pageXOffset || (de && de.scrollLeft) || document.body.scrollLeft;
162		},
163		scrollY: function(){
164			var de = document.documentElement;
165			return self.pageYOffset || (de && de.scrollTop) || document.body.scrollTop;
166		}
167	};
168    $.fn.floatingAd = function(options) {
169        return this.children("div").each(function (i, elem) {
170            if (!$.data(this, 'plugin_' + pluginName)) {
171                $.data(this, 'plugin_' + pluginName, new Plugin(this, options));
172            }
173        });
174    };
175	$.floatingAd = function(options){
176		
177		if(options){
178	    	if(options.ad){
179	    		var adDiv = $('#' + pluginName);
180	    		
181	    		if(adDiv.length <= 0)
182		    		adDiv = $('<div>', {
183		    			'id': pluginName,
184		    			'class': pluginName
185		    		}).appendTo('body');
186		    		
187	    		for(var i in options.ad){
188	    			
189	    			var ad = options.ad[i];
190	    			ad = $.extend({}, ads, ad);
191	    			//漂浮层
192	    			var div = $('<div>', {
193	    				'class': 'ad'
194	    			});
195	    			
196	    			div.css("z-index", ad['z-index']);
197	    			
198	    			//关闭层
199	    			var closeDiv = $('<div>', {
200	    				'class': 'close',
201	    				'style': (ad.imgWidth ? 'width:' + ad.imgWidth + 'px;' : '')
202	    			});
203	    			$('<div>', {
204	    				'class': 'opacity',
205	    				'style': 'opacity: ' + ad.headFilter + ';filter: alpha(opacity = ' + ad.headFilter*100 + ');'
206	    			}).appendTo(closeDiv);
207	    			
208	    			$('<div>', {
209	    				'class': 'text'
210	    			}).append(
211	    				$('<div>', {
212	    					'class': 'title',
213	    					'text': ad.title
214	    				})
215	    			).append(
216	    				$('<div>', {
217	    					'class': 'button',
218	    					'style': ad['closed-icon'] ? 'background:url("' + ad['closed-icon'] + '") no-repeat;' : ''
219	    				})
220	    			).appendTo(closeDiv);
221	    			
222	    			closeDiv.appendTo(div);
223	    			
224	    			//内容层
225	    			var content = $('<div>');
226	    			
227	    			$('<a>', {
228	    				href: ad.linkUrl,
229	    				target: ad.linkWindow,
230	    				title: ad.title
231	    			}).append(
232	    				$('<img>', {
233	    					'src': ad.img,
234	    					'style': (ad.imgHeight ? 'height:' + ad.imgHeight + 'px;' : '') + 
235	    					         (ad.imgWidth ? 'width:' + ad.imgWidth + 'px;' : '')
236	    				})
237	    			).appendTo(content);
238	    			
239	    			content.appendTo(div);
240	    			
241	    			div.appendTo(adDiv);
242	    		}
243	    		delete options.ad;
244	    		$('#' + pluginName).floatingAd(options);
245	    	}
246	    } 
247		else
248	      	$.error('漂浮广告错误!');
249	};
250})(jQuery, window, document);
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Run JavaScript Tests on LambdaTest Cloud Grid

Execute automation tests with Cypress on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)