How to call different whatsapp numbers on location based? - css

Am planning to have a WhatsApp floating button on a landing page, have 5 WhatsApp numbers on 5 different countries. Is there any way to load the location based. eg, US region to US WhatsApp number and Canadian region to Canadian WhatsApp number.
<!-- CTA float -->
<div class="wh-api "><button class="wh-ap-btn"></button></div>
CSS
.wh-api {
z-index: 99999;
Position: fixed;
bottom: 20px;
right: 20px; display: block!important;
}
button.wh-ap-btn {
outline: none;
width: 54px;
height: 54px;
border: 0;
background-color: #25d366;
padding: 0;
border-radius: 100%;
box-shadow: 0 4px 4px rgba(0, 0, 0, .12), 0 4px 4px rgba(0, 0, 0, .14);
cursor: pointer;
transition: opacity 0.3s, background 0.3s, box-shadow 0.3s;
}
button.wh-ap-btn::after {
content: '';
background-image: url(../images/whatsapp.png);
background-position: center center;
background-repeat: no-repeat;
background-size: 48%;
width: 100%;
height: 100%;
display: block;
opacity: 1;
}
button.wh-ap-btn:hover {
opacity: 1;
background-color: #01E675;
box-shadow: 0 3px 6px rgba(0, 0, 0, .16), 0 3px 6px rgba(0, 0, 0, .13);
}
.ctc-button {
display: block!important;
position: fixed;
bottom: 20px;
left: 15px;
z-index: 100;
background-color: #fcd12a;
border-radius: 100%;
padding: 5px;
width: 54px;
height: 54px;
box-shadow: 0 4px 3px rgb(0 0 0 / 12%), 0 4px 4px rgb(0 0 0 / 14%);
cursor: pointer;
transition: opacity .3s,background .3s,box-shadow .3s;
}

Related

is it possible to do non-overlapping shadows?

If you put your mouse over the pill-shaped thing, It'll move over the circle (what I want to happen), but the shadow of the circle will remain visible.
I want the shadows to not affect each other, but still be transparent.
body {
background-color: aqua;
}
#circle1, #circle2 {
position: relative;
float: left;
height: 50px;
width: 50px;
border-radius: 25px;
margin-left: 8px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
z-index: 0;
background-color: white;
}
#pill1, #pill2 {
position: relative;
float: left;
height: 50px;
width: 100px;
border-radius: 25px;
margin-left: 8px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
z-index: 1;
background-color: white;
}
#pill2 {
box-shadow: 0 4px 8px 0 rgba(180, 180, 180, 1), 0 6px 20px 0 rgba(200, 200, 200, 1);
}
#circle2 {
box-shadow: 0 4px 8px 0 rgba(180, 180, 180, 1), 0 6px 20px 0 rgba(200, 200, 200, 1);
}
#keyframes animation {
0% {right: 0px;}
100% {right: 58px;}
}
#pill1:hover, #pill2:hover {
animation: animation 0.5s linear forwards;
}
<div id="circle1"></div>
<div id="pill1"></div>
<div id="circle2"></div>
<div id="pill2"></div>
I forgot to mention something, it's supposed to be an animation. I put it in here as a transition but it wasn't working. I just fixed it, so it's now an animation.
The one on the right is what I want to happen, but that is max opacity.
You may remove the shadow on hover of the circle and make its z-index higher than the pill to catch its hover state:
body {
background-color: aqua;
}
#circle {
position: relative;
float: left;
height: 50px;
width: 50px;
border-radius: 25px;
margin-left: 8px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
z-index: 2;
background-color: white;
}
#pill {
position: relative;
float: left;
height: 50px;
width: 100px;
border-radius: 25px;
margin-left: 8px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
z-index: 1;
background-color: white;
}
#circle:hover + #pill, #pill:hover {
right: 58px;
}
#circle:hover {
box-shadow:none;
}
/*Added this to avoid the issue of hovering only the pill and not the circle*/
#circle:hover::after {
content:"";
position:absolute;
top:0;
bottom:0;
left:0;
width:100px;
}
<div id="circle"></div>
<div id="pill"></div>
UPDATE
By the way you can simplify your code like this:
I also included the transition
body {
background-color: aqua;
}
#circle {
position: relative;
height: 50px;
width: 50px;
border-radius: 25px;
margin-left: 8px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
background-color: white;
transition:all 0.5s;
}
#circle:before {
content:"";
position: absolute;
top:0;
left:80px;
height: 100%;
width: 100px;
border-radius: 25px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
background-color: white;
transition:all 0.5s;
}
#circle:hover::before {
left:0;
}
#circle:hover {
box-shadow:none;
}
/*Added this to avoid glitchs*/
#circle:after {
content:"";
position:absolute;
top:0;
bottom:0;
left:0;
width:200px;
}
#keyframes animation {
0% {left: 80px;}
100% {left: 0;}
}
<div id="circle"></div>

How to Add Box Shadow Effect To Pseudo After Content

Can you please take a look at this demo and let me know how I can add Box-shadow to Pseudo After Content? as you can see I tried to add like
box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
but it is not adding the shadow and instead creating a box
body {
padding: 50px;
background: #eee;
}
.hero {
position: relative;
background-color: #fff;
height: 320px !important;
width: 100% !important;
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
}
.hero:after {
content: '';
position: absolute;
top: 100%;
left: 0;
right: 0;
margin: 0 auto;
width: 0;
height: 0;
border-top: solid 40px #fff;
border-left: solid 40px transparent;
border-right: solid 40px transparent;
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
}
<div class="hero"></div>
I think This Code will help you.
I have added properties: transform-origin and box-sizing
For reference: transform-origin and box-sizing
body {
background-color: #888;
}
.hero {
position: relative;
margin: 3em;
padding: 1em;
box-sizing: border-box;
background: #bada55;
box-shadow: 0px 3px 3px 0 rgba(0, 0, 0, 0.4);
}
.hero::after {
content: "";
position: absolute;
width: 0;
height: 0;
margin-left: -0.5em;
bottom: -2em;
left: 50%;
box-sizing: border-box;
border: 1em solid black;
border-color: transparent transparent #bada55 #bada55;
transform-origin: 0 0;
transform: rotate(-45deg);
box-shadow: -3px 3px 3px 0 rgba(0, 0, 0, 0.4);
}
<div class="hero"></div>
Deleted all the shadows and added container with property filter: drop-shadow(0 5px 10px rgba(0, 0, 0, .2)); which creates shadow by shape.
body {
padding: 50px;
background: #eee;
}
.container {
filter: drop-shadow(0 5px 10px rgba(0, 0, 0, .2));
}
.hero {
position: relative;
background-color: #fff;
height: 320px !important;
width: 100% !important;
}
.hero:after {
content: '';
position: absolute;
top: 100%;
left: 0;
right: 0;
margin: 0 auto;
width: 0;
filter: drop-shadow;
height: 0;
border-top: solid 40px #fff;
border-left: solid 40px transparent;
border-right: solid 40px transparent;
}
<div class="container">
<div class="hero"></div>
</div>

CSS transition - invert the origin/direction

I'd like to make my label animation from top to bottom instead of from bottom to top. So the top is going to open and the bottom stay there:
div.label4 {
background-color: #4D6EF6;
width: 278px;
height: 388px;
margin: 10px auto;
text-align: center;
vertical-align: middle;
color: #4D6EF6;
font-size: 30px;
font-weight: bold;
border-radius: 4px;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
text-decoration: none;
border: transparent;
float: left;
transition: width 1.5s, height 1.5s;
transition-duration: 1.5s
}
div.label4:hover {
height: 194px;
}
<div class="label4"></div>
Just wrap it in a parent with flex-direction: column-reverse and you're done:
.parent {
display: flex;
flex-direction: column-reverse;
height: 388px;
width: 278px;
}
div.label4 {
background-color: #4D6EF6;
width: 278px;
height: 388px;
margin: 10px auto;
text-align: center;
vertical-align: middle;
color: #4D6EF6;
font-size: 30px;
font-weight: bold;
border-radius: 4px;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
text-decoration: none;
border: transparent;
float: left;
transition: width 1.5s, height 1.5s;
transition-duration: 1.5s
}
div.label4:hover {
height: 194px;
}
.parent {
display: flex;
flex-direction: column-reverse;
height: 388px;
width: 278px;
}
<div class="parent">
<div class="label4"></div>
</div>
If you can alter the HTML you could create a container, and then position .label4 using position: absolute and bottom
.parent {
height: 388px;
padding-top: 10px;
position: relative;
}
div.label4 {
background-color: #4D6EF6;
width: 278px;
height: 388px;
margin: 10px auto;
text-align: center;
vertical-align: middle;
color: #4D6EF6;
font-size: 30px;
font-weight: bold;
border-radius: 4px;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
text-decoration: none;
border: transparent;
float: left;
transition: width 1.5s, height 1.5s;
transition-duration: 1.5s;
position: absolute;
bottom: 0;
}
div.label4:hover {
height: 194px;
}
<div class="parent">
<div class="label4"></div>
</div>
You can achieve your desire animation by transform which is more flexible and better and set transform-origin to each side your element,
div.label4 {
background-color: #4D6EF6;
width: 278px;
height: 388px;
margin: 10px auto;
text-align: center;
color: #4D6EF6;
font-size: 30px;
font-weight: bold;
border-radius: 4px;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
text-decoration: none;
border: transparent;
transition: transform 1.5s;
transform: scaleY(1);
transform-origin: bottom center;
}
div.label4:hover {
transform: scaleY(0.5);
}
<div class="label4"></div>

number in the color wheel is overlapping my popup window

once I pressed a button for the popup to appear, the popup window would overlap the whole GUI except the number in the colour wheel as shown in the picture below . any methods the I could use to prevent the number from overlapping the popup window?
the css:
.overlay {
background-color: rgba(0, 0, 0, 0.6);
bottom: 0;
cursor: default;
left: 0;
opacity: 0;
position: fixed;
right: 0;
top: 0;
visibility: hidden;
z-index: 0;
-webkit-transition: opacity .5s;
-moz-transition: opacity .5s;
-ms-transition: opacity .5s;
-o-transition: opacity .5s;
transition: opacity .5s;
}
.overlay:target {
visibility: visible;
opacity: 1;
}
.popup h2{color:#07839f; line-height:1.8em}
.popup {
background-color: #fff;
border: 3px solid #fff;
display: inline-block;
left: 50%; color:#666;
opacity: 0;
padding: 15px;
position: fixed;
text-align: justify;
top: 40%;
visibility: hidden;
z-index: 10;
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
-ms-border-radius: 10px;
-o-border-radius: 10px;
border-radius: 10px;
-webkit-box-shadow: 0 1px 1px 2px rgba(0, 0, 0, 0.4) inset;
-moz-box-shadow: 0 1px 1px 2px rgba(0, 0, 0, 0.4) inset;
-ms-box-shadow: 0 1px 1px 2px rgba(0, 0, 0, 0.4) inset;
-o-box-shadow: 0 1px 1px 2px rgba(0, 0, 0, 0.4) inset;
box-shadow: 0 1px 1px 2px rgba(0, 0, 0, 0.4) inset;
-webkit-transition: opacity .5s, top .5s;
-moz-transition: opacity .5s, top .5s;
-ms-transition: opacity .5s, top .5s;
-o-transition: opacity .5s, top .5s;
transition: opacity .5s, top .5s;
}
.overlay:target+.popup {
top: 50%;
opacity: 1;
visibility: visible;
}
.close {
background-color: rgba(0, 0, 0, 0.8);
height: 30px;
line-height: 30px;
position: absolute;
right: 0;
text-align: center;
text-decoration: none;
top: -15px;
width: 30px;
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
-ms-border-radius: 15px;
-o-border-radius: 15px;
border-radius: 15px;
}
.close:before {
color: rgba(255, 255, 255, 0.9);
content: "X";
font-size: 24px;
text-shadow: 0 -1px rgba(0, 0, 0, 0.9);
}
.popup p, .popup div {
margin-bottom: 10px;
}
.popup label {
display: inline-block;
text-align: left;
width: 180px;
color:black;
}
.popup input[type="text"], .popup input[type="number"] {
margin: 0;
padding: 4px; background:#d8f6fd;
border: 1px solid #66c8de;
-moz-box-shadow: 0 1px 1px #ddd inset, 0 1px 0 #fff;
-webkit-box-shadow: 0 1px 1px #ddd inset, 0 1px 0 #fff;
box-shadow: 0 1px 1px #ddd inset, 0 1px 0 #fff;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
#sync{
-webkit-border-radius: 28;
-moz-border-radius: 28;
border-radius: 28px;
font-family: Georgia;
color: #ffffff;
background: #34b8d9;
padding: 10px 20px 10px 20px;
outline:0;
}
You could add the css property z-index to the popup window and the zero number. You'll need to add position: relative; to both of the class(es)/id(s) though for z-index to work.

CSS errors need fixing

I found a switch I'd like to use http://codepen.io/katmai7/pen/fyzuH . There is a working example at the above link but there are errors in the code and I ran this thru a code checker but wasn't able to figure out how to fix it. Do you know how to fix it? Here is what the code checker said:
Sorry! We found the following errors (6)
URI : TextArea
27 .wrap Parse Error .line{ position: absolute; top: 50px; width: 100%; border-top: 1px solid #1B1B1C; border-bottom: 1px solid #323334; }
28 .wrap Parse Error }
43 .switch Property user-select doesn't exist : none
45 .switch Lexical error at line 45, column 3. Encountered: "&" (38), after : "" &
48 :hover Parse Error .slide:after{ opacity: .05; }
49 :hover Parse Error Lexical error at line 51, column 3. Encountered: "&" (38), after : ""
html{
height: 100%;
}
body{
height: 100%;
background: #C1D1DA;
background: radial-gradient(ellipse at center, rgba(92,93,95,1) 0%,rgba(47,48,49,1) 100%);
}
.wrap{
position:relative;
margin: 100px auto;
width: 90px;
height: 100px;
border: 1px solid #1F1F20;
border-radius: 5px;
background: linear-gradient(to bottom, rgba(58,59,60,1) 0%,rgba(28,28,29,1) 100%);
box-shadow:inset 0 3px 4px -2px rgba(94,96,96, 1), 0 0 6px -1px rgba(0,0,0, .8), 0 2px 7px -1px rgba(0,0,0, .5);
.line{
position: absolute;
top: 50px;
width: 100%;
border-top: 1px solid #1B1B1C;
border-bottom: 1px solid #323334;
}
}
.switch{
position: relative;
display: block;
margin: 13px 17px;
width: 55px;
height: 25px;
border: 1px solid #1A1A1B;
border-radius: 20px;
background: linear-gradient(to bottom, rgba(31,31,32,1) 0%,rgba(58,58,58,1) 100%);
box-shadow: 0 1px 1px 0 rgba(130,132,134, .6), inset 0 4px 0 -3px rgba(0,0,0, .3);
cursor: pointer;
transition: box-shadow .5s ease .27s, border-color .5s ease .27s;
user-select: none;
&:hover{
.slide:after{
opacity: .05;
}
}
&.p2{
margin-top: 25px;
}
&:after{
display: block;
width: 100%;
height: 100%;
border-radius: 20px;
background: green;
background: linear-gradient(to bottom, rgba(186,101,82,1) 0%,rgba(215,151,101,1) 100%);background: linear-gradient(to bottom, rgba(186,101,82,1) 0%,rgba(215,151,101,1) 100%);
content: "";
opacity: 0;
transition: opacity .5s ease .27s;
}
/some context/
&:before{
position: absolute;
display: block;
width: 95%;
height: 60%;
border-radius: 20px;
background: #fff;
content: "";
opacity: .03;
}
.icon-off, .icon-eye-open{
position: absolute;
z-index: 2;
display: block;
line-height: 25px;
font-size: 18px;
}
.icon-eye-open{
left: 5px;
color: #EDD6CD;
text-shadow: 0 1px 0 #97614B;
}
.icon-off{
top: 1px;
right: 5px;
color: #6D6F70;
}
.slide{
position: absolute;
top: -1px;
left: -2px;
z-index:5;
width: 25px;
height: 25px;
border: 1px solid #171718;
border-radius: 50%;
background: linear-gradient(to bottom, rgba(64,65,66,1) 0%,rgba(30,30,31,1) 100%);
box-shadow:inset 0 1px 2px 0 rgba(93,94,95, .8), 1px 3px 5px -2px rgba(0,0,0, .7);
transition: left .4s ease-in, border-color .4s ease-in .1s;
&:after{
display: block;
width: 100%;
height: 100%;
border-radius: 50%;
background: linear-gradient(to bottom, rgba(243,232,223,1) 0%,rgba(204,169,140,1) 100%);
content: "";
opacity: 0;
transition: opacity .4s ease .1s;
}
}
}
input[type=checkbox]{
display: none;
&:checked{
+ .switch{
border-color: #4D2318;
box-shadow: 0 1px 1px 0 rgba(130,132,134, .6), inset 0 4px 0 -3px rgba(0,0,0, .3), 0 0 15px 0 rgba(213,147,99, .7);
&:after{
opacity: 1;
}
.slide{
left: 29px;
border-color: #704F3F;
&:after{
opacity: 1;
}
}
}
}
}
You are using a CSS parser on LESS syntax, which will definitely throw errors.
LESS allows for selector nesting like this:
.wrap {
/* some css */
.line {
/* some more CSS */
}
}
You can't do this in pure CSS, which is why your CSS checker is throwing all these errors. The code is basically equivalent to:
.wrap { ... }
.wrap .line { ... }

Resources