Diese Artikel gefallen Ihnen auch
function goBack(){if (document.referrer.indexOf(window.location.host) !== -1) {history.go(-1); return false;}}; document.addEventListener('DOMContentLoaded', function() { //$('.variation-select .v-s-boxes .v-s-box').mouseenter(function() { $(this).click() }); if (document.referrer.indexOf(window.location.host) !== -1) {$('.goBackLink').removeClass('d-none');} var catURL = $('.breadcrumb li:nth-last-child(2)>a').attr('href');$('.single a.parentCatlink').attr("href", catURL); if ($("#toogleDescription").height() > 170) {$('#toogleDescription .toggle').removeClass('hidden');} if ($('.priceRow .crossprice').length > 0){ var oldUVP=$('.singleRightside .crossprice>del').text().replace(/,/,".").replace(/EUR/," "); var currentPrice = $('.singleRightside .salePrice>span:first-child').text().replace(/,/,".").replace(/EUR/," "); var oldUVP=oldUVP.replace(/[^0-9\.]+/g,""); var currentPrice = currentPrice.replace(/[^0-9\.]+/g,""); function calculatePercent() {var percent = (oldUVP-currentPrice)/oldUVP*100;var percentRound = Math.round(percent);$(".saving_p").html(" (-"+percentRound+"%)"); currentSaving=oldUVP-currentPrice,currentSaving=currentSaving.toFixed(2).replace(/\./,","),$("#saving_eur").html(currentSaving+" EUR")}; calculatePercent();}; let sel = document.querySelectorAll('.variation-select select'); sel.forEach(function() {this.addEventListener ("change", function () {setTimeout(function(){ calculatePercent(); }, 400);}); });});