2017-12-18 9 views
0

私は大学で私の論文のためのウェブサイトを実装しており、ギャラリーも含まれています。 Lightbox2 jsファイルをダウンロードして正しく動作させました。ライトボックス2をモバイル用とCSS用のデスクトップの両方で最適化

私のウェブサイトは、モバイル画面用にも最適化されており、lightbox2でこれをどうやって行うのだろうと思っていました。

+0

[How to ask](https://stackoverflow.com/help/how-to-ask)ページをお読みください。 – zyexal

答えて

0

は、ファイルlightbox.jsに(v2.10.0用)ライン306を交換してください:

maxImageWidth = windowWidth - self.containerPadding.left - self.containerPadding.right - self.imageBorderWidth.left - self.imageBorderWidth.right - 20; 

maxImageHeight = windowHeight - self.containerPadding.top - self.containerPadding.bottom - self.imageBorderWidth.top - self.imageBorderWidth.bottom - 120; 

次のように:

if (($(window).width() > 300) && ($(window).width() < 993)) { 

maxImageWidth = windowWidth - self.containerPadding.left - self.containerPadding.right - self.imageBorderWidth.left - self.imageBorderWidth.right - your values; 

maxImageHeight = windowHeight - self.containerPadding.top - self.containerPadding.bottom - self.imageBorderWidth.top - self.imageBorderWidth.bottom - your values; 

} else { 

maxImageWidth = windowWidth - self.containerPadding.left - self.containerPadding.right - self.imageBorderWidth.left - self.imageBorderWidth.right - 20; 

maxImageHeight = windowHeight - self.containerPadding.top - self.containerPadding.bottom - self.imageBorderWidth.top - self.imageBorderWidth.bottom - 120; 

} 

たり、個別に幅と高さを設定することができます

if (($(window).width() > 300) && ($(window).width() < 500)) { 

maxImageWidth = windowWidth - self.containerPadding.left - self.containerPadding.right - self.imageBorderWidth.left - self.imageBorderWidth.right - your values; 

maxImageHeight = windowHeight - self.containerPadding.top - self.containerPadding.bottom - self.imageBorderWidth.top - self.imageBorderWidth.bottom - your values; 

} 

else if (($(window).width() >= 500) && ($(window).width() < 993)) { 

maxImageWidth = windowWidth - self.containerPadding.left - self.containerPadding.right - self.imageBorderWidth.left - self.imageBorderWidth.right - your values; 

maxImageHeight = windowHeight - self.containerPadding.top - self.containerPadding.bottom - self.imageBorderWidth.top - self.imageBorderWidth.bottom - your values; 

} else { 

maxImageWidth = windowWidth - self.containerPadding.left - self.containerPadding.right - self.imageBorderWidth.left - self.imageBorderWidth.right - 20; 

maxImageHeight = windowHeight - self.containerPadding.top - self.containerPadding.bottom - self.imageBorderWidth.top - self.imageBorderWidth.bottom - 120; 

} 

値を設定するのを忘れないでください。

関連する問題