fixes multiple script rendering
This commit is contained in:
parent
5ccd8cb174
commit
a7ad58b452
|
@ -1,4 +0,0 @@
|
||||||
function get_height(container, ratio) {
|
|
||||||
var height = $(container).width() / ratio
|
|
||||||
return height
|
|
||||||
}
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
function get_height(container, ratio) {
|
||||||
|
var height = $(container).width() / ratio
|
||||||
|
return height
|
||||||
|
}
|
||||||
|
|
||||||
|
function adjust_height() {
|
||||||
|
$(".embeded-vimeo-wrapper").each(function() {
|
||||||
|
var iframe = $(this).find('iframe')
|
||||||
|
var ratio = $(iframe).attr('ratio')
|
||||||
|
$(iframe).prop("height", get_height(iframe, ratio))
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
jQuery(document).ready(function() {
|
||||||
|
adjust_height();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(window).resize(function() {
|
||||||
|
adjust_height();
|
||||||
|
});
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
$this->headScript()->appendFile($this->assetUrl('js/height_calculator.js',
|
$this->headScript()->appendFile($this->assetUrl('js/media_dimensions.js',
|
||||||
'Vimeo'));
|
'Vimeo'));
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="archive-embeded-media-wrapper"
|
<div class="embeded-vimeo-wrapper"
|
||||||
style="position:relative;">
|
style="position:relative;">
|
||||||
|
|
||||||
<?php if ($renderSourceLink) { ?>
|
<?php if ($renderSourceLink) { ?>
|
||||||
|
@ -23,17 +23,5 @@ $this->headScript()->appendFile($this->assetUrl('js/height_calculator.js',
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function adjust_height() {
|
|
||||||
$(".archive-embeded-media-wrapper").each(function() {
|
|
||||||
var iframe = $(this).find('iframe')
|
|
||||||
var ratio = $(iframe).attr('ratio')
|
|
||||||
$(iframe).prop("height", get_height(iframe, ratio))
|
|
||||||
});
|
|
||||||
}
|
|
||||||
jQuery(document).ready(function() {
|
|
||||||
adjust_height();
|
|
||||||
});
|
|
||||||
$( window ).resize(function() {
|
|
||||||
adjust_height();
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue