diff options
Diffstat (limited to 'views/js')
| -rw-r--r-- | views/js/frontend.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/views/js/frontend.js b/views/js/frontend.js index fb3bdac..d622596 100644 --- a/views/js/frontend.js +++ b/views/js/frontend.js @@ -282,3 +282,30 @@ // Der Variantenwechsel ersetzt das Produkt per Ajax
jQuery(document).ajaxComplete(wpsg_productBreadcrumbs);
+
+ /**
+ * GARAN-Label (Tooltip): bleibt im Fenster, ohne verkleinert zu werden (W8)
+ *
+ * Das Label ist mit Rahmen 317 px breit; auf 320 px breiten Bildschirmen hat die Inhaltsspalte weniger. Es wird
+ * nur nach links verschoben, rechts bleiben 4 px Abstand, links notfalls keiner.
+ */
+ function wpsg_garanTooltipPosition() {
+
+ var vw = document.documentElement.clientWidth;
+
+ document.querySelectorAll('.wpsg_product_garan > .tooltip').forEach(function(tooltip) {
+
+ tooltip.style.left = '';
+
+ var rect = tooltip.getBoundingClientRect();
+ var over = rect.right - (vw - 4);
+
+ if (over > 0) tooltip.style.left = (parseFloat(getComputedStyle(tooltip).left) - Math.min(over, rect.left)) + 'px';
+
+ } );
+
+ } // function wpsg_garanTooltipPosition()
+
+ if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', wpsg_garanTooltipPosition); else wpsg_garanTooltipPosition();
+ window.addEventListener('resize', wpsg_garanTooltipPosition);
+ jQuery(document).ajaxComplete(wpsg_garanTooltipPosition);
|
