Last active
November 16, 2016 13:55
-
-
Save lerni/e69c1c6a7b43c45165dc947dcc14c099 to your computer and use it in GitHub Desktop.
workaround UploadField iframe incorrect height - https://github.com/silverstripe/silverstripe-framework/issues/2862
This file contains 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
LeftAndMain: | |
extra_requirements_javascript: | |
- mysite/javascript/fixUploadField.js |
This file contains 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
(function($) { | |
$.entwine('ss', function($) { | |
$( 'div.ss-uploadfield-item-editform.opened').entwine({ | |
onmatch: function(e) { | |
var self = this, | |
editform = self.closest('.ss-uploadfield-item').find('.ss-uploadfield-item-editform'), | |
itemInfo = editform.prev('.ss-uploadfield-item-info'), | |
iframe = editform.find('iframe'); | |
iframe.on('load', function () { | |
if (editform.hasClass('opened')) { | |
editform.fitHeight(); | |
} | |
}); | |
this._super(); | |
} | |
}); | |
}); | |
}(jQuery)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment