-
-
Save siriokun/9b158b73ce4f4283f36d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Hastily plonked together by @replete, [email protected] | |
| /* Use like this: | |
| <div class="some-html-chunk" data-sync-height="a-unique-name">Foo</div> | |
| <div class="some-other-html-chunk" data-sync-height="a-unique-name">Bar</div> | |
| */ | |
| $('[data-sync-height]') | |
| .each(function(i,e){ | |
| var syncID = $(e).attr('data-sync-height'), | |
| $syncHeight = $('[data-sync-height='+ syncID +']'); | |
| //Creates load event for each instance, 'namespaced'. | |
| $(window) | |
| .on('load.sync-height-'+ syncID +' resize.sync-height-'+syncID +' orientationchange.sync-height-'+ syncID, function(){ | |
| //Write your own logic here for when to set or unset syncHeight. | |
| if (App.breakpointName !== 'default') { | |
| $syncHeight.syncHeight(); | |
| } else { | |
| $syncHeight.unSyncHeight(); | |
| } | |
| }) | |
| .trigger('resize.sync-height-'+syncID); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment