From 9385bb2f3727c7cc8fa6156de3b3257a8a50bfcf Mon Sep 17 00:00:00 2001 From: Gustavo Luigi Date: Fri, 2 Sep 2022 11:49:28 +0200 Subject: [PATCH] add product script to pages --- assets/js/product.js | 20 +++++++++++++++++ content/contents/balkonkraftwerk.blade.php | 25 ++-------------------- content/contents/produkt.blade.php | 14 +----------- content/contents/solarmodule.blade.php | 14 +----------- 4 files changed, 24 insertions(+), 49 deletions(-) create mode 100644 assets/js/product.js diff --git a/assets/js/product.js b/assets/js/product.js new file mode 100644 index 0000000..3a9a4d0 --- /dev/null +++ b/assets/js/product.js @@ -0,0 +1,20 @@ +$(window).on('load', function(){ + $('#btn-check-out').click(function(){ + let productId = $(this).attr("data-id"); + addToBag(productId); + window.location.replace($('meta[name="checkout"]').attr('content')); + }); + $('#btn-add-to-bag').click(function(){ + let productId = $(this).attr("data-id"); + let parentElement = $('#count-products-in-bag').parent(); + let copyElemetn = $('#count-products-in-bag').clone(); + copyElemetn.attr('id', ''); + copyElemetn.appendTo(parentElement); + $('#count-products-in-bag').addClass('animate__animated animate__backInUp'); + $('#count-products-in-bag').on('animationend', function(){ + $('#count-products-in-bag').removeClass('animate__animated animate__backInUp'); + copyElemetn.remove(); + }); + addToBag(productId); + }); +}); \ No newline at end of file diff --git a/content/contents/balkonkraftwerk.blade.php b/content/contents/balkonkraftwerk.blade.php index 7ed5717..342281a 100644 --- a/content/contents/balkonkraftwerk.blade.php +++ b/content/contents/balkonkraftwerk.blade.php @@ -79,26 +79,5 @@ @stop @section('scripts') - -@stop + +@stop \ No newline at end of file diff --git a/content/contents/produkt.blade.php b/content/contents/produkt.blade.php index dffa762..00ab8a8 100644 --- a/content/contents/produkt.blade.php +++ b/content/contents/produkt.blade.php @@ -84,17 +84,5 @@ @stop @section('scripts') - + @stop \ No newline at end of file diff --git a/content/contents/solarmodule.blade.php b/content/contents/solarmodule.blade.php index 9d1bfd3..388c8c4 100644 --- a/content/contents/solarmodule.blade.php +++ b/content/contents/solarmodule.blade.php @@ -84,17 +84,5 @@ @stop @section('scripts') - + @stop