Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/dplugins-code/htdocs/code.dplugins.com/wp-includes/functions.php on line 6131

Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/dplugins-code/htdocs/code.dplugins.com/wp-includes/functions.php on line 6131
Update on load and resize – Code DPlugins

Update on load and resize

jQuery(document).ready(function($) {
  var adjust_size = function() {
  	// Change code here
    $('.content .right').width($(window).width() - 480);
	// Change code here
  };
  adjust_size();
  $(window).resize(adjust_size);
});	

This code will help you to get values on page load and change them on resize. It can be useful to update the CSS values and objects position.

Code example with breakpoint

jQuery(document).ready(function($) {
// Footer fixed
var adjust_size = function() {
var newWindowWidth = $(window).width();
	if (newWindowWidth > 991) {    
	    var footer = $(".footer").height();
		$(".main").css("margin-bottom", footer)
	}
	else
	{
		$(".main").css("margin-bottom", "0px")
	}
};
adjust_size();
$(window).resize(adjust_size);
// Footer fixed
});
Click to Copy