ZenCart On XOOPS/商品拡大ポップアップ画像の表示位置を一番上へ表示するよう変更した際のメモ。
▼変更対象ファイル
・ドメイン名/modules/zox/includes/modules/pages/popup_image/jscript_main.php
▼変更前
var toppos = height / 2 - imgHeight / 2;
▼変更後
var toppos = 0;
実際にやってみると、IEで下に余白が出来ることや、ブラウザの解像度が大きいときはどうすんだ? みたいな疑問が出てきたので、
最終的には、色々試した結果、暫定的に、下記のようにすることにした。
var toppos = height / 2 - imgHeight / 2-i;
ちなみに、iは、userAgentの違いを吸収する意図で作られた変数だと思われる。
<script language="javascript" type="text/javascript"><!--
var i=0;
function resize() {
i=0;
// if (navigator.appName == 'Netscape') i=20;
if (window.navigator.userAgent.indexOf('MSIE 6.0') != -1 && window.navigator.userAgent.indexOf('SV1') != -1) {
i=30; //This browser is Internet Explorer 6.x on Windows XP SP2
} else if (window.navigator.userAgent.indexOf('MSIE 6.0') != -1) {
i=0; //This browser is Internet Explorer 6.x
} else if (window.navigator.userAgent.indexOf('Firefox') != -1 && window.navigator.userAgent.indexOf("Windows") != -1) {
i=25; //This browser is Firefox on Windows
} else if (window.navigator.userAgent.indexOf('Mozilla') != -1 && window.navigator.userAgent.indexOf("Windows") != -1) {
i=45; //This browser is Mozilla on Windows
} else {
i=80; //This is all other browsers including Mozilla on Linux
}
▼変更対象ファイル
・ドメイン名/modules/zox/includes/modules/pages/popup_image/jscript_main.php
▼変更前
var toppos = height / 2 - imgHeight / 2;
▼変更後
var toppos = 0;
実際にやってみると、IEで下に余白が出来ることや、ブラウザの解像度が大きいときはどうすんだ? みたいな疑問が出てきたので、
最終的には、色々試した結果、暫定的に、下記のようにすることにした。
var toppos = height / 2 - imgHeight / 2-i;
ちなみに、iは、userAgentの違いを吸収する意図で作られた変数だと思われる。
<script language="javascript" type="text/javascript"><!--
var i=0;
function resize() {
i=0;
// if (navigator.appName == 'Netscape') i=20;
if (window.navigator.userAgent.indexOf('MSIE 6.0') != -1 && window.navigator.userAgent.indexOf('SV1') != -1) {
i=30; //This browser is Internet Explorer 6.x on Windows XP SP2
} else if (window.navigator.userAgent.indexOf('MSIE 6.0') != -1) {
i=0; //This browser is Internet Explorer 6.x
} else if (window.navigator.userAgent.indexOf('Firefox') != -1 && window.navigator.userAgent.indexOf("Windows") != -1) {
i=25; //This browser is Firefox on Windows
} else if (window.navigator.userAgent.indexOf('Mozilla') != -1 && window.navigator.userAgent.indexOf("Windows") != -1) {
i=45; //This browser is Mozilla on Windows
} else {
i=80; //This is all other browsers including Mozilla on Linux
}