Files
Roman Pyrih cd8e9de7c0 Fix home RWD
2024-11-26 12:08:11 +01:00

114 lines
3.1 KiB
JavaScript
Raw Permalink Blame History

/*
* Custom code goes here.
* A template should always ship with an empty custom.js
*/
/** Przycisk scrollowania do g<>ry *************************************/
if ($("#back-to-top").length) {
var scrollTrigger = 100, // px
backToTop = function () {
var scrollTop = $(window).scrollTop()
if (scrollTop > scrollTrigger) {
$("#back-to-top").addClass("show")
} else {
$("#back-to-top").removeClass("show")
}
}
backToTop()
$(window).on("scroll", function () {
backToTop()
})
$("#back-to-top").on("click", function (e) {
e.preventDefault()
$("html,body").animate(
{
scrollTop: 0,
},
700
)
})
}
/** Usuwanie element<6E>w sklepu z bloga ****/
$("#module-amazzingblog-blog .PM_ASBlockOutput").remove()
$("#module-amazzingblog-blog .block-categories").remove()
/** Responsywne banner ****/
$("img").addClass("img-fluid")
/** Responsywne blog cover ****/
$(".blog.blocks.displayHome .post-item .post-item-cover img").addClass(
"img-fluid"
)
$(function () {
$("#btn_place_order_2").on("click", function () {
$("#btn_place_order").trigger("click")
})
$("#btn_continue_shopping_2").on("click", function () {
$("#btn_continue_shopping").trigger("click")
})
})
$(function () {
$(window).on("load", function () {
let phoneBox = $("#_desktop_contact_link_temp").html();
$('#nav-phone-numb').html(phoneBox);
});
});
$(function () {
let originalParent = $("#st_banner_11").parent();
let originalPosition = $("#st_banner_11").index();
function moveBanner() {
let banner = $("#st_banner_11");
let targetSection = $("#content-wrapper #content .blog.blocks.displayHome");
if ($(window).width() <= 767) {
if (banner.parent().attr("id") !== "content") {
banner.detach().insertBefore(targetSection);
}
} else {
if (banner.parent().attr("id") !== originalParent.attr("id")) {
if (originalPosition === 0) {
originalParent.prepend(banner);
} else {
banner.detach().insertAfter(originalParent.children().eq(originalPosition - 1));
}
}
}
}
moveBanner();
$(window).on("resize", moveBanner);
});
$(function () {
let originalParentCustomText = $("#custom-text").parent();
let originalPositionCustomText = $("#custom-text").index();
function moveCustomText() {
let customText = $("#custom-text");
let banner = $("#st_banner_11");
if ($(window).width() <= 576) {
if (customText.next("#st_banner_11").length === 0) {
customText.detach().insertAfter(banner);
}
} else {
if (customText.parent().attr("id") !== originalParentCustomText.attr("id")) {
if (originalPositionCustomText === 0) {
originalParentCustomText.prepend(customText);
} else {
customText.detach().insertAfter(originalParentCustomText.children().eq(originalPositionCustomText - 1));
}
}
}
}
moveCustomText();
$(window).on("resize", moveCustomText);
});