Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Refresh javascript after browser resize?

Featured Replies

Howdy,

 

Is there anyway to reload your javascript on the fly as you are resizing your browser?

 

I'm using some javascript to create equal height columns, the 3 columns equalling the height of the largest column

 

<!-- Equal Footer Column jQuery script -->
<script language="javascript" type="text/javascript" src="jquery.js"></script>
<script>
	function equalHeight(group) {
	   tallest = 0;
	   group.each(function() {
	      thisHeight = $(this).height();
	      if(thisHeight > tallest) {
	         tallest = thisHeight;
	      }
	   });
	   group.height(tallest);
	}
	$(document).ready(function() {
	   equalHeight($(".column"));
	});
</script>

 

I'm using this so my shadow is centered between the columns.

 

columns1.jpg

 

However, as I'm looking to make my design responsive, when you resize the window, you need the javascript to refresh otherwise you end up with this.....

 

columns2.jpg

function equalHeight(group) {
  tallest = 0;
  group.each(function() {
     thisHeight = $(this).height();
     if(thisHeight > tallest) {
        tallest = thisHeight;
     }
  });
  group.height(tallest);
}
$(document).ready(function() {
  equalHeight($(".column"));
});

window.onresize = function(event) {
   equalHeight($(".column"));
}

 

That should do it. Not sure why you would want to though, the chances of someone re-sizing their browser while viewing your site are almost 0.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.