How to use remove 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.

color-switcher.js

Source: color-switcher.js Github

copy
1	jQuery(document).ready(function($) {
2	
3		  jQuery("#blue" ).click(function(){
4			  jQuery("#color" ).attr("href", "css/blue.css");
5			  jQuery(".navbar-brand img" ).attr("src", "images/logo.png");
6			  return false;
7		  });
8		  
9		  jQuery("#green" ).click(function(){
10			  jQuery("#color" ).attr("href", "css/green.css");
11			  jQuery(".navbar-brand img" ).attr("src", "images/logo-green.png");
12			  return false;
13		  });
14		  
15		  jQuery("#red" ).click(function(){
16			  jQuery("#color" ).attr("href", "css/red.css");
17			  jQuery(".navbar-brand img" ).attr("src", "images/logo-red.png");
18			  return false;
19		  });
20		  
21		  
22		  jQuery("#yellow" ).click(function(){
23			  jQuery("#color" ).attr("href", "css/yellow.css");
24			  jQuery(".navbar-brand img" ).attr("src", "images/logo-yellow.png");
25			  return false;
26		  });
27		  
28		  jQuery("#brown" ).click(function(){
29			  jQuery("#color" ).attr("href", "css/brown.css");
30			  jQuery(".navbar-brand img" ).attr("src", "images/logo-brown.png");
31			  return false;
32		  });
33		  
34		  jQuery("#cyan" ).click(function(){
35			  jQuery("#color" ).attr("href", "css/cyan.css");
36			  jQuery(".navbar-brand img" ).attr("src", "images/logo-cyan.png");
37			  return false;
38		  });
39		  
40		  jQuery("#purple" ).click(function(){
41			  jQuery("#color" ).attr("href", "css/purple.css");
42			  jQuery(".navbar-brand img" ).attr("src", "images/logo-purple.png");
43			  return false;
44		  });
45		  
46		  jQuery("#sky-blue" ).click(function(){
47			  jQuery("#color" ).attr("href", "css/sky-blue.css");
48			  jQuery(".navbar-brand img" ).attr("src", "images/logo-sky-blue.png");
49			  return false;
50		  });
51		  
52		  jQuery("#theme-dark" ).click(function(){
53			  jQuery("#choose-theme" ).attr("href", "css/dark.css");
54			  jQuery(".navbar-brand img" ).attr("src", "images/logo-white.png");
55			  jQuery("#footer img" ).attr("src", "images/footer-logo-dark.jpg");
56			  jQuery(".lady1" ).attr("src", "images/appointment-img-dark.jpg");
57			  return false;
58		  });
59		  jQuery("#theme-light" ).click(function(){
60			  jQuery("#choose-theme" ).attr("href", "css/light.css");
61			  jQuery(".navbar-brand img" ).attr("src", "images/logo.png");
62			  jQuery("#footer img" ).attr("src", "images/footer-logo.jpg");
63			  jQuery(".lady1" ).attr("src", "images/appointment-img.jpg");
64			  return false;
65		  });
66		  
67		  
68		  
69		  
70		  
71		  jQuery(".layouts #boxed" ).click(function(){
72			  jQuery("#wrapper" ).addClass("boxed-layout");
73			  jQuery("body" ).addClass("bg1");
74		  });
75		  jQuery(".layouts #wide" ).click(function(){
76			  jQuery("#wrapper" ).removeClass("boxed-layout");
77			  jQuery("body" ).removeClass("bg1");
78		  });
79		  
80		  
81		  jQuery("#headerNormal" ).click(function(){
82			  jQuery("body" ).removeClass("fixed-header");
83		  });
84		  jQuery("#headerFixed" ).click(function(){
85			  jQuery("body" ).addClass("fixed-header");
86		  });
87		  
88		  //add backgrounds
89		  jQuery("#bg-one" ).click(function(){
90			  jQuery("body" ).addClass("bg1");
91			  jQuery("body" ).removeClass("bg2");
92			  jQuery("body" ).removeClass("bg3");
93			  jQuery("body" ).removeClass("bg4");
94			  jQuery("body" ).removeClass("bg5");
95			  jQuery("body" ).removeClass("bg6");
96			  jQuery("body" ).removeClass("bg7");
97			  jQuery("body" ).removeClass("bg8");
98			  jQuery("body" ).removeClass("bg9");
99			  jQuery("body" ).removeClass("bg10");
100		  });
101		  
102		  jQuery("#bg-two" ).click(function(){
103			  jQuery("body" ).removeClass("bg1");
104			  jQuery("body" ).addClass("bg2");
105			  jQuery("body" ).removeClass("bg3");
106			  jQuery("body" ).removeClass("bg4");
107			  jQuery("body" ).removeClass("bg5");
108			  jQuery("body" ).removeClass("bg6");
109			  jQuery("body" ).removeClass("bg7");
110			  jQuery("body" ).removeClass("bg8");
111			  jQuery("body" ).removeClass("bg9");
112			  jQuery("body" ).removeClass("bg10");
113		  });
114		  
115		  jQuery("#bg-three" ).click(function(){
116			  jQuery("body" ).removeClass("bg1");
117			  jQuery("body" ).removeClass("bg2");
118			  jQuery("body" ).addClass("bg3");
119			  jQuery("body" ).removeClass("bg4");
120			  jQuery("body" ).removeClass("bg5");
121			  jQuery("body" ).removeClass("bg6");
122			  jQuery("body" ).removeClass("bg7");
123			  jQuery("body" ).removeClass("bg8");
124			  jQuery("body" ).removeClass("bg9");
125			  jQuery("body" ).removeClass("bg10");
126		  });
127		  
128		  jQuery("#bg-four" ).click(function(){
129			  jQuery("body" ).removeClass("bg1");
130			  jQuery("body" ).removeClass("bg2");
131			  jQuery("body" ).removeClass("bg3");
132			  jQuery("body" ).addClass("bg4");
133			  jQuery("body" ).removeClass("bg5");
134			  jQuery("body" ).removeClass("bg6");
135			  jQuery("body" ).removeClass("bg7");
136			  jQuery("body" ).removeClass("bg8");
137			  jQuery("body" ).removeClass("bg9");
138			  jQuery("body" ).removeClass("bg10");
139		  });
140		  
141		  jQuery("#bg-five" ).click(function(){
142			  jQuery("body" ).removeClass("bg1");
143			  jQuery("body" ).removeClass("bg2");
144			  jQuery("body" ).removeClass("bg3");
145			  jQuery("body" ).removeClass("bg4");
146			  jQuery("body" ).addClass("bg5");
147			  jQuery("body" ).removeClass("bg6");
148			  jQuery("body" ).removeClass("bg7");
149			  jQuery("body" ).removeClass("bg8");
150			  jQuery("body" ).removeClass("bg9");
151			  jQuery("body" ).removeClass("bg10");
152		  });
153		  
154		  jQuery("#bg-six" ).click(function(){
155			  jQuery("body" ).removeClass("bg1");
156			  jQuery("body" ).removeClass("bg2");
157			  jQuery("body" ).removeClass("bg3");
158			  jQuery("body" ).removeClass("bg4");
159			  jQuery("body" ).removeClass("bg5");
160			  jQuery("body" ).addClass("bg6");
161			  jQuery("body" ).removeClass("bg7");
162			  jQuery("body" ).removeClass("bg8");
163			  jQuery("body" ).removeClass("bg9");
164			  jQuery("body" ).removeClass("bg10");
165		  });
166		  
167		  jQuery("#bg-seven" ).click(function(){
168			  jQuery("body" ).removeClass("bg1");
169			  jQuery("body" ).removeClass("bg2");
170			  jQuery("body" ).removeClass("bg3");
171			  jQuery("body" ).removeClass("bg4");
172			  jQuery("body" ).removeClass("bg5");
173			  jQuery("body" ).removeClass("bg6");
174			  jQuery("body" ).addClass("bg7");
175			  jQuery("body" ).removeClass("bg8");
176			  jQuery("body" ).removeClass("bg9");
177			  jQuery("body" ).removeClass("bg10");
178		  });
179		  
180		  jQuery("#bg-eight" ).click(function(){
181			  jQuery("body" ).removeClass("bg1");
182			  jQuery("body" ).removeClass("bg2");
183			  jQuery("body" ).removeClass("bg3");
184			  jQuery("body" ).removeClass("bg4");
185			  jQuery("body" ).removeClass("bg5");
186			  jQuery("body" ).removeClass("bg6");
187			  jQuery("body" ).removeClass("bg7");
188			  jQuery("body" ).addClass("bg8");
189			  jQuery("body" ).removeClass("bg9");
190			  jQuery("body" ).removeClass("bg10");
191		  });
192		  
193		  jQuery("#bg-nine" ).click(function(){
194			  jQuery("body" ).removeClass("bg1");
195			  jQuery("body" ).removeClass("bg2");
196			  jQuery("body" ).removeClass("bg3");
197			  jQuery("body" ).removeClass("bg4");
198			  jQuery("body" ).removeClass("bg5");
199			  jQuery("body" ).removeClass("bg6");
200			  jQuery("body" ).removeClass("bg7");
201			  jQuery("body" ).removeClass("bg8");
202			  jQuery("body" ).addClass("bg9");
203			  jQuery("body" ).removeClass("bg10");
204		  });
205		  
206		  jQuery("#bg-ten" ).click(function(){
207			  jQuery("body" ).removeClass("bg1");
208			  jQuery("body" ).removeClass("bg2");
209			  jQuery("body" ).removeClass("bg3");
210			  jQuery("body" ).removeClass("bg4");
211			  jQuery("body" ).removeClass("bg5");
212			  jQuery("body" ).removeClass("bg6");
213			  jQuery("body" ).removeClass("bg7");
214			  jQuery("body" ).removeClass("bg8");
215			  jQuery("body" ).removeClass("bg9");
216			  jQuery("body" ).addClass("bg10");
217		  });
218		  jQuery("#bg-one, #bg-two, #bg-three, #bg-four, #bg-five, #bg-six, #bg-seven, #bg-eight, #bg-nine, #bg-ten").click(function(){
219			  jQuery("#wrapper").addClass("boxed-layout");
220		  });
221		  jQuery("#wide").click(function(){
222			  jQuery("body").removeClass("bg1 bg2 bg3 bg4 bg5 bg6 bg7 bg8 bg9 bg10");
223		  });
224		  
225		  
226		  jQuery("#light").click(function(){
227			  	jQuery("#footer").addClass("light");
228				jQuery("#footer").removeClass("dark");
229				jQuery("#footer img" ).attr("src", "images/footer-logo.jpg");
230		   });
231		   jQuery("#dark").click(function(){
232			  	jQuery("#footer").addClass("dark");
233				jQuery("#footer").removeClass("light");
234				jQuery("#footer img" ).attr("src", "images/footer-logo-dark.jpg");
235		   });
236		   
237		   jQuery("#header-n").click(function(){
238			  	jQuery("body").removeClass("fixed-header");
239		   });
240		   jQuery("#header-f").click(function(){
241				jQuery("body").addClass("fixed-header");
242		   });
243		  
244		  
245		  
246		  // picker buttton
247		  jQuery(".picker_close").click(function(){
248			  
249			  	jQuery("#choose_color").toggleClass("position");
250			  
251		   });
252		   
253		   
254		  
255	});
Full Screen

burger.js

Source: burger.js Github

copy
1$(document).ready(function() {
2  $('.burger').click(function () {
3    $('.burgerlist').toggleClass('active')
4  })
5  $('.store1').click(function () {
6    $('.store1').toggleClass('active')
7    $('.store2').removeClass('active')
8    $('.store3').removeClass('active')
9    $('.store4').removeClass('active')
10    $('.store5').removeClass('active')
11    $('.store6').removeClass('active')
12    $('.store7').removeClass('active')
13    $('.store8').removeClass('active')
14    $('.store9').removeClass('active')
15    $('.store10').removeClass('active')
16    $('.store11').removeClass('active')
17  })
18  $('.store2').click(function () {
19    $('.store2').toggleClass('active')
20    $('.store1').removeClass('active')
21    $('.store3').removeClass('active')
22    $('.store4').removeClass('active')
23    $('.store5').removeClass('active')
24    $('.store6').removeClass('active')
25    $('.store7').removeClass('active')
26    $('.store8').removeClass('active')
27    $('.store9').removeClass('active')
28    $('.store10').removeClass('active')
29    $('.store11').removeClass('active')
30  })
31  $('.store3').click(function () {
32    $('.store3').toggleClass('active')
33    $('.store2').removeClass('active')
34    $('.store1').removeClass('active')
35    $('.store4').removeClass('active')
36    $('.store5').removeClass('active')
37    $('.store6').removeClass('active')
38    $('.store7').removeClass('active')
39    $('.store8').removeClass('active')
40    $('.store9').removeClass('active')
41    $('.store10').removeClass('active')
42    $('.store11').removeClass('active')
43  })
44  $('.store4').click(function () {
45    $('.store4').toggleClass('active')
46    $('.store2').removeClass('active')
47    $('.store3').removeClass('active')
48    $('.store1').removeClass('active')
49    $('.store5').removeClass('active')
50    $('.store6').removeClass('active')
51    $('.store7').removeClass('active')
52    $('.store8').removeClass('active')
53    $('.store9').removeClass('active')
54    $('.store10').removeClass('active')
55    $('.store11').removeClass('active')
56  })
57  $('.store5').click(function () {
58    $('.store5').toggleClass('active')
59    $('.store2').removeClass('active')
60    $('.store3').removeClass('active')
61    $('.store4').removeClass('active')
62    $('.store1').removeClass('active')
63    $('.store6').removeClass('active')
64    $('.store7').removeClass('active')
65    $('.store8').removeClass('active')
66    $('.store9').removeClass('active')
67    $('.store10').removeClass('active')
68    $('.store11').removeClass('active')
69  })
70  $('.store6').click(function () {
71    $('.store6').toggleClass('active')
72    $('.store2').removeClass('active')
73    $('.store3').removeClass('active')
74    $('.store4').removeClass('active')
75    $('.store5').removeClass('active')
76    $('.store1').removeClass('active')
77    $('.store7').removeClass('active')
78    $('.store8').removeClass('active')
79    $('.store9').removeClass('active')
80    $('.store10').removeClass('active')
81    $('.store11').removeClass('active')
82  })
83  $('.store7').click(function () {
84    $('.store7').toggleClass('active')
85    $('.store2').removeClass('active')
86    $('.store3').removeClass('active')
87    $('.store4').removeClass('active')
88    $('.store5').removeClass('active')
89    $('.store6').removeClass('active')
90    $('.store1').removeClass('active')
91    $('.store8').removeClass('active')
92    $('.store9').removeClass('active')
93    $('.store10').removeClass('active')
94    $('.store11').removeClass('active')
95  })
96  $('.store8').click(function () {
97    $('.store8').toggleClass('active')
98    $('.store2').removeClass('active')
99    $('.store3').removeClass('active')
100    $('.store4').removeClass('active')
101    $('.store5').removeClass('active')
102    $('.store6').removeClass('active')
103    $('.store7').removeClass('active')
104    $('.store1').removeClass('active')
105    $('.store9').removeClass('active')
106    $('.store10').removeClass('active')
107    $('.store11').removeClass('active')
108  })
109  $('.store9').click(function () {
110    $('.store9').toggleClass('active')
111    $('.store2').removeClass('active')
112    $('.store3').removeClass('active')
113    $('.store4').removeClass('active')
114    $('.store5').removeClass('active')
115    $('.store6').removeClass('active')
116    $('.store7').removeClass('active')
117    $('.store8').removeClass('active')
118    $('.store1').removeClass('active')
119    $('.store10').removeClass('active')
120    $('.store11').removeClass('active')
121  })
122  $('.store10').click(function () {
123    $('.store10').toggleClass('active')
124    $('.store2').removeClass('active')
125    $('.store3').removeClass('active')
126    $('.store4').removeClass('active')
127    $('.store5').removeClass('active')
128    $('.store6').removeClass('active')
129    $('.store7').removeClass('active')
130    $('.store8').removeClass('active')
131    $('.store9').removeClass('active')
132    $('.store1').removeClass('active')
133    $('.store11').removeClass('active')
134  })
135  $('.store11').click(function () {
136    $('.store11').toggleClass('active')
137    $('.store2').removeClass('active')
138    $('.store3').removeClass('active')
139    $('.store4').removeClass('active')
140    $('.store5').removeClass('active')
141    $('.store6').removeClass('active')
142    $('.store7').removeClass('active')
143    $('.store8').removeClass('active')
144    $('.store9').removeClass('active')
145    $('.store10').removeClass('active')
146    $('.store1').removeClass('active')
147  })
148  $('.pay1').click(function () {
149    $('.pay1').toggleClass('active')
150  })
151  $('.pay2').click(function () {
152    $('.pay2').toggleClass('active')
153  })
154  $('.pay3').click(function () {
155    $('.pay3').toggleClass('active')
156  })
157  $('.pay4').click(function () {
158    $('.pay4').toggleClass('active')
159  })
160  $('.pay5').click(function () {
161    $('.pay5').toggleClass('active')
162  })
163  $('.pay6').click(function () {
164    $('.pay6').toggleClass('active')
165  })
166  $('.pay7').click(function () {
167    $('.pay7').toggleClass('active')
168  })
169  $('.pay8').click(function () {
170    $('.pay8').toggleClass('active')
171  })
172  $('.pay9').click(function () {
173    $('.pay9').toggleClass('active')
174  })
175  $('.pay10').click(function () {
176    $('.pay10').toggleClass('active')
177  })
178  $('.pay11').click(function () {
179    $('.pay11').toggleClass('active')
180  })
181  $('.pay12').click(function () {
182    $('.pay12').toggleClass('active')
183  })
184});
185
186
Full Screen

layout.js

Source: layout.js Github

copy
1/* ============================================================
2 * Layout Script
3 =========================================================== */
4 var  $logopanel     = $('.logopanel');
5 var  $topbar        = $('.topbar');
6 var  $sidebar       = $('.sidebar');
7 var  $sidebarFooter = $('.sidebar-footer');
8 
9/****  Initiation of Main Functions  ****/
10$(document).ready(function() {
11
12    handleboxedLayout();
13    setTimeout(function() {
14        handleboxedLayout();
15    }, 100);
16    if ($('body').hasClass('sidebar-hover')) sidebarHover();
17
18    $('[data-toggle]').on('click', function(event) {
19        event.preventDefault();
20        var toggleLayout = $(this).data('toggle');
21        if (toggleLayout == 'sidebar-behaviour') toggleSidebar();
22        if (toggleLayout == 'submenu') toggleSubmenuHover();
23        if (toggleLayout == 'sidebar-collapsed') collapsedSidebar();
24        if (toggleLayout == 'sidebar-top') toggleSidebarTop();
25        if (toggleLayout == 'sidebar-hover') toggleSidebarHover();
26        if (toggleLayout == 'boxed') toggleboxedLayout();
27        if (toggleLayout == 'topbar') toggleTopbar();
28    });
29
30});
31
32/****  Resize Event Functions  ****/
33$(window).resize(function() {
34    setTimeout(function() {
35        handleboxedLayout();
36    }, 100);
37});
38
39/* ==========================================================*/
40/* LAYOUTS API                                                */
41/* ========================================================= */
42
43/* Create Sidebar Fixed */
44function handleSidebarFixed() {
45    // removeSidebarHover();
46    $('#switch-sidebar').prop('checked', true);
47    $('#switch-submenu').prop('checked', false);
48    $.removeCookie('submenu-hover');
49    if ($('body').hasClass('sidebar-top')) {
50        $('body').removeClass('fixed-topbar').addClass('fixed-topbar');
51        $.removeCookie('fluid-topbar');
52        $('#switch-topbar').prop('checked', true);
53    }
54    $('body').removeClass('fixed-sidebar').addClass('fixed-sidebar');
55    $('.sidebar').height('');
56    handleboxedLayout();
57    if (!$('body').hasClass('sidebar-collapsed')) removeSubmenuHover();
58    createSideScroll();
59    $.removeCookie('fluid-sidebar');
60    $.cookie('fixed-sidebar', 1);
61}
62
63/* Create Sidebar Fluid / Remove Sidebar Fixed */
64function handleSidebarFluid() {
65    $('#switch-sidebar').prop('checked', false);
66    if ($('body').hasClass('sidebar-hover')) {
67        removeSidebarHover();
68        $('#switch-sidebar-hover').prop('checked', false);
69    }
70    $('body').removeClass('fixed-sidebar');
71    handleboxedLayout();
72    destroySideScroll();
73    $.removeCookie('fixed-sidebar');
74    $.cookie('fluid-sidebar', 1);
75    $.cookie('fluid-sidebar', 1);
76}
77
78/* Toggle Sidebar Fixed / Fluid */
79function toggleSidebar() {
80    if ($('body').hasClass('fixed-sidebar')) handleSidebarFluid();
81    else handleSidebarFixed();
82}
83
84/* Create Sidebar on Top */
85function createSidebarTop() {
86    $('#switch-sidebar-top').prop('checked', true);
87    removeSidebarHover();
88    $('body').removeClass('sidebar-collapsed');
89    $.removeCookie('sidebar-collapsed');
90    $('body').removeClass('sidebar-top').addClass('sidebar-top');
91    $('.main-content').css('margin-left', '').css('margin-right', '');
92    $('.topbar').css('left', '').css('right', '');
93    if ($('body').hasClass('fixed-sidebar') && !$('body').hasClass('fixed-topbar')) {
94        $('body').removeClass('fixed-topbar').addClass('fixed-topbar');
95        $.removeCookie('fluid-topbar');
96        $('#switch-topbar').prop('checked', true);
97    }
98    $('.sidebar').height('');
99    destroySideScroll();
100    $('#switch-sidebar-hover').prop('checked', false);
101    handleboxedLayout();
102    $.cookie('sidebar-top', 1);
103    $.removeCookie('sidebar-hover');
104}
105
106/* Remove Sidebar on Top */
107function removeSidebarTop() {
108    $('#switch-sidebar-top').prop('checked', false);
109    $('body').removeClass('sidebar-top');
110    createSideScroll();
111    $('#switch-sidebar-top').prop('checked', false);
112    $.removeCookie('sidebar-top');
113    handleboxedLayout();
114}
115
116/* Toggle Sidebar on Top */
117function toggleSidebarTop() {
118    if ($('body').hasClass('sidebar-top')) removeSidebarTop();
119    else createSidebarTop();
120}
121
122/* Create Sidebar only visible on Hover */
123function createSidebarHover() {
124    $('body').addClass('sidebar-hover');
125    $('body').removeClass('fixed-sidebar').addClass('fixed-sidebar');
126    $('.main-content').css('margin-left', '').css('margin-right', '');
127    $('.topbar').css('left', '').css('right', '');
128    $('body').removeClass('sidebar-top');
129    removeSubmenuHover();
130    removeBoxedLayout();
131    removeCollapsedSidebar();
132    sidebarHover();
133    handleSidebarFixed();
134    $('#switch-sidebar-hover').prop('checked', true);
135    $('#switch-sidebar').prop('checked', true);
136    $('#switch-sidebar-top').prop('checked', false);
137    $('#switch-boxed').prop('checked', false);
138    $.removeCookie('fluid-topbar');
139    $.removeCookie('sidebar-top');
140    $.cookie('sidebar-hover', 1);
141}
142
143/* Remove Sidebar on Hover */
144function removeSidebarHover() {
145    $('#switch-sidebar-hover').prop('checked', false);
146    $('body').removeClass('sidebar-hover');
147    if (!$('body').hasClass('boxed')) $('.sidebar, .sidebar-footer').attr('style', '');
148    $('.logopanel2').remove();
149    $.removeCookie('sidebar-hover');
150}
151
152/* Toggle Sidebar on Top */
153function toggleSidebarHover() {
154    if ($('body').hasClass('sidebar-hover')) removeSidebarHover();
155    else createSidebarHover();
156}
157
158/* Create Sidebar Submenu visible on Hover */
159function createSubmenuHover() {
160    removeSidebarHover();
161    removeSidebarTop();
162    handleSidebarFluid();
163    $('#switch-submenu-hover').prop('checked', true);
164    $('body').addClass('submenu-hover');
165    $('.nav-sidebar .children').css('display', '');
166    $.cookie('submenu-hover', 1);
167    $('#switch-sidebar').prop('checked', false);
168}
169
170/* Remove Submenu on Hover */
171function removeSubmenuHover() {
172    $('#switch-submenu-hover').prop('checked', false);
173    $('body').removeClass('submenu-hover');
174    $('.nav-sidebar .nav-parent.active .children').css('display', 'block');
175    $.removeCookie('submenu-hover');
176}
177
178/* Toggle Submenu on Hover */
179function toggleSubmenuHover() {
180    if ($('body').hasClass('submenu-hover')) removeSubmenuHover();
181    else createSubmenuHover();
182}
183
184/* Create Topbar Fixed */
185function handleTopbarFixed() {
186    $('#switch-topbar').prop('checked', true);
187    $('body').removeClass('fixed-topbar').addClass('fixed-topbar');
188    $.removeCookie('fluid-topbar');
189}
190
191/* Create Topbar Fluid / Remove Topbar Fixed */
192function handleTopbarFluid() {
193    $('#switch-topbar').prop('checked', false);
194    $('body').removeClass('fixed-topbar');
195    if ($('body').hasClass('sidebar-top') && $('body').hasClass('fixed-sidebar')) {
196        $('body').removeClass('fixed-sidebar');
197        $('#switch-sidebar').prop('checked', false);
198    }
199    $.cookie('fluid-topbar', 1);
200}
201
202/* Toggle Topbar Fixed / Fluid */
203function toggleTopbar() {
204    if ($('body').hasClass('fixed-topbar')) handleTopbarFluid();
205    else handleTopbarFixed();
206}
207
208/* Adjust margin of content for boxed layout */
209function handleboxedLayout() {
210    if ($('body').hasClass('builder-admin')) return;
211    $logopanel.css('left', '').css('right', '');
212    $topbar.css('width', '');
213    $sidebar.css('margin-left', '').css('margin-right', '');
214    $sidebarFooter.css('left', '').css('right', '');
215    if ($('body').hasClass('boxed')) {
216        windowWidth = $(window).width();
217        windowHeight = $(window).height();
218        $('.page-content').height('');
219        pageContentHeight = $('.page-content').height();
220        var container = 1200;
221        var margin = (windowWidth - 1200) / 2;
222        if (!$('body').hasClass('sidebar-top') && windowWidth > 1220)  {
223            if(!$('body').hasClass('fixed-sidebar')){
224                if(pageContentHeight < $(document).height()){
225                    setTimeout(function(){
226                        $('.page-content').height($(document).height());
227                    },100);
228                } 
229            }
230            else{
231                if(pageContentHeight < windowHeight) {
232                    $('.page-content').height(windowHeight);
233                }
234            }
235            $logopanel.css('left', margin);
236            if ($('body').hasClass('sidebar-collapsed')) {
237                $topbar.css('width', 1200);
238            }
239            else {
240                topbarWidth = (1200 - $sidebarWidth);
241                if ($('body').hasClass('fixed-sidebar')) {
242                    $sidebar.css('margin-left', margin);
243                    $('.topbar').css('width', topbarWidth);
244                }
245                $sidebarFooter.css('left', margin);
246                if($('body').hasClass('sidebar-light')){
247                    $topbar.css('width', 960);
248                }
249                else{
250                    $topbar.css('width', topbarWidth);
251                }
252                
253            }
254       
255            $.backstretch(["../assets/global/images/gallery/bg1.jpg", "../assets/global/images/gallery/bg2.jpg", "../assets/global/images/gallery/bg3.jpg", "../assets/global/images/gallery/bg4.jpg"], 
256                {duration: 4000, fade: 600});
257        }
258        else{
259            $('.backstretch').remove();
260        }
261        
262    }
263}
264
265/* Create Boxed Layout */
266function createBoxedLayout() {
267    removeSidebarHover();
268    $('body').addClass('boxed');
269    handleboxedLayout();
270    $('#switch-boxed').prop('checked', true);
271    $.cookie('boxed-layout', 1);
272}
273
274/* Remove boxed layout */
275function removeBoxedLayout() {
276    if ($('body').hasClass('boxed')) {
277        $('body').removeClass('boxed');
278        $logopanel.css('left', '').css('right', '');
279        $topbar.css('width', '');
280        $sidebar.css('margin-left', '').css('margin-right', '');
281        $sidebarFooter.css('left', '').css('right', '');
282        $.removeCookie('boxed-layout');
283        $('#switch-boxed').prop('checked', false);
284        $.backstretch("destroy");
285    }
286}
287
288function toggleboxedLayout() {
289    if ($('body').hasClass('boxed')) removeBoxedLayout();
290    else createBoxedLayout();
291}
292
293/* Toggle Sidebar Collapsed */
294function collapsedSidebar() {
295    if ($body.css('position') != 'relative') {
296        if (!$body.hasClass('sidebar-collapsed')) createCollapsedSidebar();
297        else removeCollapsedSidebar();
298    } else {
299        if ($body.hasClass('sidebar-show')) $body.removeClass('sidebar-show');
300        else $body.addClass('sidebar-show');
301    }
302    handleboxedLayout();
303}
304
305function createCollapsedSidebar() {
306    $body.addClass('sidebar-collapsed');
307    $('.sidebar').css('width', '').resizable().resizable('destroy');
308    $('.nav-sidebar ul').attr('style', '');
309    $(this).addClass('menu-collapsed');
310    destroySideScroll();
311    $('#switch-sidebar').prop('checked');
312    $.cookie('sidebar-collapsed', 1);
313}
314
315function removeCollapsedSidebar() {
316    $body.removeClass('sidebar-collapsed');
317    if (!$body.hasClass('submenu-hover')) $('.nav-sidebar li.active ul').css({
318        display: 'block'
319    });
320    $(this).removeClass('menu-collapsed');
321    if ($body.hasClass('sidebar-light') && !$body.hasClass('sidebar-fixed')) {
322        $('.sidebar').height('');
323    }
324    createSideScroll();
325    $.removeCookie('sidebar-collapsed');
326}
327
328/* Reset to Default Style, remove all cookie and custom layouts */
329function resetStyle() {
330    $('#reset-style').on('click', function(event) {
331        event.preventDefault();
332        removeBoxedLayout();
333        removeSidebarTop();
334        removeSidebarHover();
335        removeSubmenuHover();
336        removeCollapsedSidebar();
337        $.removeCookie('main-color');
338        $.removeCookie('main-name');
339        $.removeCookie('theme');
340        $.removeCookie('bg-name');
341        $.removeCookie('bg-color');
342        $.removeCookie('submenu-hover');
343        $.removeCookie('sidebar-collapsed');
344        $.removeCookie('boxed-layout');
345        $.removeCookie('sidebar-hover');
346        $.removeCookie('main-color', { path: '/'});
347        $.removeCookie('main-name', { path: '/'});
348        $.removeCookie('theme', { path: '/'});
349        $.removeCookie('bg-name', { path: '/'});
350        $.removeCookie('bg-color', { path: '/'});
351        $.removeCookie('boxed-layout', { path: '/'});
352        $.removeCookie('sidebar-hover', { path: '/'});
353        $('body').removeClass(function(index, css) {
354            return (css.match(/(^|\s)bg-\S+/g) || []).join(' ');
355        });
356        $('body').removeClass(function(index, css) {
357            return (css.match(/(^|\s)color-\S+/g) || []).join(' ');
358        });
359        $('body').removeClass(function(index, css) {
360            return (css.match(/(^|\s)theme-\S+/g) || []).join(' ');
361        });
362        $('body').addClass('theme-sdtl').addClass('color-default');
363        $('.builder .theme-color').removeClass('active');
364        $('.theme-color').each(function() {
365            if ($(this).data('color') == '#319DB5') $(this).addClass('active');
366        });
367        $('.builder .theme').removeClass('active');
368        $('.builder .theme-default').addClass('active');
369        $('.builder .sp-replacer').removeClass('active');
370    });
371}
372
373/******************** END LAYOUT API  ************************/
374/* ========================================================= */
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)