웹마스터 팁
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
모바일에서 유투브 동영상 크기 300px고정
2012.07.31 15:47
// Find all YouTube videos
var $allVideos = $("iframe[src^='http://player.vimeo.com'], iframe[src^='http://www.youtube.com'], embed[src^='http://www.youtube.com']"),
// The element that is fluid width
$fluidEl = $("body");
// Figure out and save aspect ratio for each video
$allVideos.each(function() {
$(this)
.data('aspectRatio', this.height / this.width)
// and remove the hard coded width/height
.removeAttr('height')
.removeAttr('width');
});
// When the window is resized
$(window).resize(function() {
var newWidth = $fluidEl.width();
// Resize all videos according to their own aspect ratio
$allVideos.each(function() {
var $el = $(this);
$el
.width('300')
.height('260');
});
// Kick off one resize to fix all videos on page load
}).resize();
이걸 모바일 게시판 스킨 js파일에 넣어주시면 됩니다