Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // version: 22/03/16 13:10 GMT
- window.onload = function() {
- var w, h1, h2, h3, h4, elements, summary, hmax, smax;
- w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
- if (w < 768) {
- return;
- }
- function getHeight(class_name) {
- var elements = document.getElementsByClassName(class_name);
- if (elements.length) {
- return elements[0].scrollHeight;
- } else {
- return 0;
- }
- }
- function setSummaryTop() {
- h2 = getHeight("woocommerce-tabs");
- h4 = summary.scrollHeight;
- hmax = Math.max(h1 + h2 + h3 - h4, 0);
- smax = Math.max(window.scrollY - 220, 0);
- summary.style.top = Math.min(hmax, smax) + "px";
- }
- elements = document.getElementsByClassName("product-summary-case");
- if (elements.length) {
- summary = elements[0];
- h1 = getHeight("product-img-case");
- h3 = getHeight("upsells");
- window.onscroll = function() {
- setSummaryTop();
- };
- setInterval(setSummaryTop, 500);
- }
- };
Add Comment
Please, Sign In to add comment