From b4df09164fc468f719277dc4430bd73251d97a09 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 9 Nov 2021 19:07:32 +0100 Subject: [PATCH] wait #4854 @0.5 --- images/symbols/cart-overlay.svg | 8 ++-- js/libs/fluidbook/fluidbook.cart.js | 21 +++++++++-- js/libs/fluidbook/fluidbook.links.js | 2 +- style/cart.less | 55 +++++++++++++++++++++++++++- 4 files changed, 76 insertions(+), 10 deletions(-) diff --git a/images/symbols/cart-overlay.svg b/images/symbols/cart-overlay.svg index 1ceaf7fb..2096d4bd 100644 --- a/images/symbols/cart-overlay.svg +++ b/images/symbols/cart-overlay.svg @@ -1,19 +1,19 @@ - + - + - + - + diff --git a/js/libs/fluidbook/fluidbook.cart.js b/js/libs/fluidbook/fluidbook.cart.js index 67188370..6ca7ef48 100644 --- a/js/libs/fluidbook/fluidbook.cart.js +++ b/js/libs/fluidbook/fluidbook.cart.js @@ -63,16 +63,29 @@ FluidbookCart.prototype = { }, updateLinks: function () { + console.log('updatelinks'); + $('a[data-cart-ref]').removeClass('active'); + try { var references = this.instance.getItemsReferences(); + $.each(references, function (k, ref) { + $('a[data-cart-ref="' + ref + '"]').addClass('active'); + }); } catch (err) { - return; } - $.each(references, function (k, ref) { - $('a[data-cart-ref="' + ref + '"]').addClass('active'); - }); + if (this.fluidbook.settings.cartLinkAppearance === 'overlay') { + $('a[data-cart-ref]').each(function () { + + var paddingTop = 0.5 * ($(this).outerHeight() - 100); + var paddingLeft = 0.5 * ($(this).outerWidth() - 300); + $(this).attr('data-tooltip', null).addClass('overlay').css({ + paddingTop: paddingTop, + paddingLeft: paddingLeft + }).html('
' + getSpriteIcon('link-cart-remove') + getSpriteIcon('link-cart-remove-hover') + '
' + getSpriteIcon('link-cart-add') + getSpriteIcon('link-cart-add-hover') + '
'); + }); + } }, getMenuWidth: function () { try { diff --git a/js/libs/fluidbook/fluidbook.links.js b/js/libs/fluidbook/fluidbook.links.js index 4b11ac28..d0b5c314 100644 --- a/js/libs/fluidbook/fluidbook.links.js +++ b/js/libs/fluidbook/fluidbook.links.js @@ -457,7 +457,7 @@ FluidbookLinks.prototype = { }, 200); - $(fluidbook).trigger('fluidbook.links.ready'); + $(this.fluidbook).trigger('fluidbook.links.ready'); this.resize(); }, diff --git a/style/cart.less b/style/cart.less index 4dd39b50..79946a4b 100644 --- a/style/cart.less +++ b/style/cart.less @@ -1 +1,54 @@ -@import "cart/@{import-cart-styles}"; \ No newline at end of file +@import "cart/@{import-cart-styles}"; + +a[data-cart-ref] { + &.overlay { + color: #fff; + + div { + @w: 100px; + display: none; + position: relative; + width: @w; + height: @w; + + &:last-child { + margin-left: @w; + } + + svg { + top:0; + left: 0; + width: @w; + height: @w; + overflow: visible; + position: absolute; + display: block; + + &:first-child { + display: none; + } + } + + &:hover { + svg { + &:first-child { + display: block; + } + + &:last-child { + display: none; + } + } + } + } + + &.displayArea:hover { + background-color: rgba(0, 0, 0, 0.65); + mix-blend-mode: multiply; + + div { + display: inline-block; + } + } + } +} \ No newline at end of file -- 2.39.5