add product script to pages
parent
6610ea0c05
commit
9385bb2f37
|
@ -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);
|
||||
});
|
||||
});
|
|
@ -79,26 +79,5 @@
|
|||
</div>
|
||||
@stop
|
||||
@section('scripts')
|
||||
<script>
|
||||
$(window).on('load', function(){
|
||||
$('#btn-check-out').click(function(){
|
||||
let productId = $(this).attr("data-id");
|
||||
addToBag(productId);
|
||||
window.location.replace("{{url('/checkout')}}");
|
||||
});
|
||||
$('#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);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@stop
|
||||
<script src="{{storage('assets/js/product.js')}}"></script>
|
||||
@stop
|
|
@ -84,17 +84,5 @@
|
|||
</div>
|
||||
@stop
|
||||
@section('scripts')
|
||||
<script>
|
||||
$(window).on('load', function(){
|
||||
$('#btn-check-out').click(function(){
|
||||
let productId = $(this).attr("data-id");
|
||||
addToBag(productId);
|
||||
window.location.replace("{{url('/checkout')}}");
|
||||
});
|
||||
$('#btn-add-to-bag').click(function(){
|
||||
let productId = $(this).attr("data-id");
|
||||
addToBag(productId);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script src="{{storage('assets/js/product.js')}}"></script>
|
||||
@stop
|
|
@ -84,17 +84,5 @@
|
|||
</div>
|
||||
@stop
|
||||
@section('scripts')
|
||||
<script>
|
||||
$(window).on('load', function(){
|
||||
$('#btn-check-out').click(function(){
|
||||
let productId = $(this).attr("data-id");
|
||||
addToBag(productId);
|
||||
window.location.replace("{{url('/checkout')}}");
|
||||
});
|
||||
$('#btn-add-to-bag').click(function(){
|
||||
let productId = $(this).attr("data-id");
|
||||
addToBag(productId);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script src="{{storage('assets/js/product.js')}}"></script>
|
||||
@stop
|
||||
|
|
Loading…
Reference in New Issue