]> _ Git - fluidbook-html5.git/commitdiff
wip #4259 @0.75
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 13 Apr 2022 07:38:21 +0000 (09:38 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 13 Apr 2022 07:38:21 +0000 (09:38 +0200)
js/libs/fluidbook/fluidbook.cart.js
style/cart.less

index 506e992b3e006c0f9438d8541e2b0ec9159f389b..73c2b3a924426343f13c47fdc51ff941ecb866c5 100644 (file)
@@ -78,24 +78,39 @@ FluidbookCart.prototype = {
 
         if (this.fluidbook.settings.cartLinkAppearance === 'overlay') {
             $('a[data-cart-ref]').each(function () {
-                var small = false;
-                var smallwidth = false;
-                var smallheight = false;
-                if ($(this).outerWidth() < 280) {
-                    smallwidth = small = true;
-                    $(this).addClass('small').addClass('smallwidth');
+                var size = 2;
+                var c=[];
+                if ($(this).outerWidth() < 200) {
+                    size = Math.min(size, 0);
+                    c.push('small-w');
+                } else if ($(this).outerWidth() < 280) {
+                    size = Math.min(size, 1);
+                    c.push('medium-w');
                 }
-                if ($(this).outerHeight() < 130) {
-                    smallheight = small = true;
-                    $(this).addClass('small').addClass('smallheight');
+                if ($(this).outerHeight() < 100) {
+                    size = Math.min(size, 0);
+                    c.push('small-h');
+                } else if ($(this).outerHeight() < 130) {
+                    size = Math.min(size, 1);
+                    c.push('medium-h');
+                }
+
+                if($(this).outerHeight() < 300){
+                    c.push('condensed-h');
                 }
 
                 var bw = 250;
                 var bh = 100;
-                if (small) {
+                if (size === 0) {
+                    bw = 130;
+                    bh = 60;
+                    $(this).addClass('small');
+                } else if (size === 1) {
                     bw = 170;
                     bh = 80;
+                    $(this).addClass('medium');
                 }
+                $(this).addClass(c);
 
                 var paddingTop = 0.5 * ($(this).outerHeight() - bh);
                 var paddingLeft = 0.5 * ($(this).outerWidth() - bw);
index 86779139f9648d230d34d854bd1df75dc08f1407..5672ee840720ee0c5515a9c046374fd7ac4ac7e7 100644 (file)
@@ -2,9 +2,20 @@
 
 a[data-cart-ref] {
   &.overlay {
+    white-space: nowrap;
+    overflow: hidden;
     color: #fff;
 
-    &.small {
+    &.condensed-h {
+      div {
+        &.infos {
+          bottom: 15px;
+          right: 15px;
+        }
+      }
+    }
+
+    &.medium {
       div {
         &.infos {
           bottom: 15px;
@@ -24,6 +35,29 @@ a[data-cart-ref] {
       }
     }
 
+    &.small {
+      div {
+        &.infos {
+          width: 40px;
+          height: 40px;
+          bottom: 10px;
+          right: 10px;
+        }
+
+        @w: 60px;
+
+        &.add {
+          margin-left: unit(10, px);
+        }
+
+        &.add, &.remove {
+          width: @w;
+          height: @w;
+        }
+      }
+    }
+
+
     div {
       &.infos {
         @w: 50px;