jQuery UI Dialog で表示しているので、dialogfocus と observer を使って画面の中央に移動。できれば CSS のみで済ませたいです。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
(function () { // Display the Kuroneko Web Collect Dialog in the center of the screen on Welcart Shop jQuery("body").bind("dialogfocus", function (e) { const resizeable = e.target; const observer = new MutationObserver(() => { const d = jQuery('#kuroneko_web-dialog'); d.css({ left: 0 }); // 正しい幅を取得するために一旦左端に移動 d.css({ left: (jQuery(window).width() - d.outerWidth(true)) / 2 + "px", top: (jQuery(window).height() - d.height()) / 2 + jQuery(window).scrollTop() + "px" }); }); observer.observe(resizeable, { attriblutes: true, childList: true, subtree: true, }); }); })(); |