現在jqueryプラグイン「prettyphoto Version: 3.1.4」を使ってをポートフォリオ作成を試みているのですが、一つだけどうしても解決できない問題がありましてご質問させていただいています。
PC版、タブレット版、スマートフォン(iphone6)縦の表示は写真が4対3のように綺麗に表示ができるのですがスマートフォンを(iphone6)横にした場合だけうまく表示ができず、4対3ではなく四角形のような形になってしまいます。
スマートフォンを横にした状態で、CSSで画像の制御をかけてしまうと、横の写真の場合は綺麗に表示ができるのですが、縦の写真になると表示が横写真と同じように表示されてしまうので潰れた感じになってしまいます。。
###前提・実現したいこと
ウィンドウサイズ480~768迄だけは写真のリサイズされる率を変えたいのですが、どうすればいいか分かる方がいらっしゃいましたら、ご教授いただけないでしょうか?
###該当のソースコード
「prettyphoto Version: 3.1.4」581行目付近 // Define them in case there's no resize needed imageWidth = width, imageHeight = height; if( ((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)) && doresize && settings.allow_resize && !percentBased) { resized = true, fitting = false; /*while (!fitting){ if((pp_containerWidth > windowWidth)){ imageWidth = (windowWidth - 200); imageHeight = (height/width) * imageWidth; }else if((pp_containerHeight > windowHeight)){ imageHeight = (windowHeight - 200); imageWidth = (width/height) * imageHeight; }else{ fitting = true; }; pp_containerHeight = imageHeight, pp_containerWidth = imageWidth; }; _getDimensions(imageWidth,imageHeight); if((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)){ _fitToViewport(pp_containerWidth,pp_containerHeight) };*/ /*追記してみた部分*/ while (!fitting){ if((pp_containerWidth > windowWidth)){ imageWidth = (windowWidth - (pp_containerWidth - imageWidth)); imageHeight = (imageWidth/width)*height; }else if((pp_containerHeight > windowHeight)){ imageHeight = (windowHeight - (pp_containerHeight - imageHeight)); imageWidth = (imageHeight/height)*width; }else{ fitting = true; }; pp_containerHeight = imageHeight, pp_containerWidth = imageWidth; }; _getDimensions(imageWidth,imageHeight); if((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)){ _fitToViewport(pp_containerWidth,pp_containerHeight) }; }; /*追記してみた部分*/ return { width:Math.floor(imageWidth), height:Math.floor(imageHeight), containerHeight:Math.floor(pp_containerHeight), containerWidth:Math.floor(pp_containerWidth) + (settings.horizontal_padding * 2), contentHeight:Math.floor(pp_contentHeight), contentWidth:Math.floor(pp_contentWidth), resized:resized }; };
###ダウンロード場所
http://catpin.com/prettyphoto/
回答1件
あなたの回答
tips
プレビュー