jQuery window resize undo changes

Hi, I copy the code from Paul Wilkins on this thread:

I have a function to insert a Div in a certain width using resize function my problem is how can I undo that when the specified size is not met in the condition?

jQuery(function($){ function mobileViewUpdate() { var viewportWidth = $(window).width(); if (viewportWidth <= 1023) { $(".top_panel_top").addClass("top_panel_outside_header").insertBefore(".header_mobile"); } }
  		$(window).load(mobileViewUpdate);
  		$(window).resize(mobileViewUpdate);
  		$(window).on(\'load, resize\', mobileViewUpdate);
  		$(window).on(\'load, resize\', function mobileViewUpdate() {
  		    var viewportWidth = $(window).width();
  		    if (viewportWidth <= 1023) {
  		    	$(".top_panel_top").addClass("top_panel_outside_header").insertBefore(".header_mobile");
  		    } else {
  		    	re
  		    }
  		});
  	});
  </script>'

I have change my mind and just add a new element make it a string and prepend it to the DIV that I want then play with media queries

Thanks anyway! Cheers! :smiley:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.