|
|
- function imgProportion($targetWidth, $targetHeight)
- {
- var DeviceWidth = parseInt($(window).width()-15); //ȸéÀÇ °¡·Î »çÀÌÁî
- var a1 = DeviceWidth * $targetHeight; //À̹ÌÁö ¼¼·Î»çÀÌÁî °è»ê½Ä
- var newHeight = (a1 / $targetWidth); //À̹ÌÁö ¼¼·Î»çÀÌÁî °è»ê½Ä
- var rtnSize = new Array((DeviceWidth), newHeight); //¸®»çÀÌ¡ µÈ À̹ÌÁö »çÀÌÁî ¸®ÅÏ
-
- return rtnSize;
- }
- $("img", main).each(function() //À̹ÌÁö¸¦ FIND.
- {
- var $this = $(this); //¼±ÅÃÀÚ¸¦ ÁöÁ¤.
- var $thisWidth = parseInt($this.css("width")); //¼±ÅÃµÈ À̹ÌÁöÀÇ °¡·Î»çÀÌÁî.
- var $thisHeight = parseInt($this.css("height")); //¼±ÅÃµÈ À̹ÌÁöÀÇ ¼¼·Î»çÀÌÁî.
- var clientWidth = parseInt($(window).width()); //ȸéÀÇ °¡·Î»çÀÌÁî.
-
- if($thisWidth > clientWidth) //À̹ÌÁö °¡·Î°¡ ȸéÀÇ °¡·Îº¸´Ù ±æ´Ù¸é..
- {
- var rtn = imgProportion($thisWidth, $thisHeight);
- var newWidth = rtn[0]; //Return µÈ ¹è¿ÀÇ 0¹ø° °ª.
- var newHeight = rtn[1]; //Return µÈ ¹è¿ÀÇ 1¹ø° °ª.
-
- $this.css({ //¼±ÅÃµÈ À̹ÌÁö¿¡ CSS¸¦ º¯°æ.
-
- "width" : newWidth,
- "height" : newHeight
- })
- }
- });
- // µ¿¿µ»óÀ» °øÀ¯ÇÑ »çÀÌÆ®ÀÇ À̸§À» ¹è¿·Î ÀúÀåÇÑ´Ù.
- // »õ·Î¿î »çÀÌÆ®³ª ¾ø¾îÁø »çÀÌÆ®°¡ ÀÖÀ¸¸é ±×¶§ ±×¶§ ¾÷µ¥ÀÌÆ® ÇØÁÖ¼¼¿ä~
- var $allVideos = $("iframe[src^='http://player.vimeo.com'], iframe[src^='http://www.youtube.com'], iframe[src^='http://www.youtube-nocookie.com'], iframe[src^='http://serviceapi.nmv.naver.com'], iframe[src^='http://serviceapi.rmcnmv.naver.com'], embed[src^='http://www.youtube.com'], embed[src^='http://serviceapi.nmv.naver.com'], iframe[src^='https://www.youtube.com'], iframe[src^='https://www.youtube-nocookie.com'], iframe[src^='http://flvs.daum.net'], iframe[src^='http://play.pullbbang.com'], iframe[src^='http://www.gamespot.com'], iframe[src^='http://sbsplayer.sbs.co.kr/'], iframe[src^='http://www.microsoft.com'], iframe[src^='http://dotsub.com'], iframe[src^='http://www.travelro.co.kr'], embed[src^='http://v.egloos.com/v.sk/'], embed[src^='http://videofarm.daum.net/'] ,embed[src^='http://api.v.daum.net/'], embed[src^='http://dory.mncast.com/'], embed[src^='http://play.mgoon.com/Video/'], embed[src^='http://doc.mgoon.com/'], embed[src^='http://flvr.pandora.tv/flv2pan/'], embed[src^='http://imgcdn.pandora.tv/'], embed[src^='http://live.afreeca.com'], embed[src^='http://afbbs.afreeca.com'], embed[src^='http://w.blogdoc.nate.com'], embed[src^='http://blogdoc.nate.com'], embed[src^='http://www.musicshake.com/'], embed[src^='http://static.plaync.co.kr'], iframe[src^='http://www.travelro.co.kr'], iframe[src^='http://dotsub.com']"),
-
- $fluidEl = $("body"); // ÀÚµ¿¸®»çÀÌ¡À» Àû¿ëÇÒ ¿µ¿ªÀÇ ID°ª
-
- $allVideos.each(function()
- {
- $(this)
- .data('aspectRatio', this.height / this.width)
- // ±âÁ¸ ³ô,³Ð »èÁ¦
- .removeAttr('height')
- .removeAttr('width');
-
- });
-
- $(window).resize(function()
- {
- var newWidth = $fluidEl.width();
-
- $allVideos.each(function()
- {
- var $el = $(this);
- $el
- .width('100%') // ¿øÇϴµ¥·Î~~
- .height('260'); // ¿øÇϴµ¥·Î~~
- });
- }).resize();
ÀÌ»ó! ÀÔ´Ï´Ù. ¸ð¹ÙÀÏÀº ¹°·Ð PC¹öÀü¿¡¼µµ Àû¿ë °¡´É ÇÕ´Ï´Ù.
- PC¹öÀü! - ¸ð¹ÙÀϹöÀü! |
|
|
|
|
|
|
|
°øÀ¯Çϱâ
|
°øÀ¯Çϱâ
|
|
|
|
|
|
|