radio button as image with onclick to next fieldset - javascript
<a id="Choise" name="next" class="next Choise-button" value="Next" >
<input type="radio" name="designation" id="designation" />
<label for="designation"><img src="" alt="designation" />
<h2>designation</h2></label>
</a>
//jQuery time
var current_fs, next_fs, previous_fs; //fieldsets
var left, opacity, scale; //fieldset properties which we will animate
var animating; //flag to prevent quick multi-click glitches
$(".next").click(function(){
if(animating) return false;
animating = true;
current_fs = $(this).parent();
next_fs = $(this).parent().next();
//activate next step on progressbar using the index of next_fs
$("#progressbar li").eq($("fieldset").index(next_fs)).addClass("active");
//show the next fieldset
next_fs.show();
//hide the current fieldset with style
current_fs.animate({opacity: 0}, {
step: function(now, mx) {
//as the opacity of current_fs reduces to 0 - stored in "now"
//1. scale current_fs down to 80%
scale = 1 - (1 - now) * 0.2;
//2. bring next_fs from the right(50%)
left = (now * 50)+"%";
//3. increase opacity of next_fs to 1 as it moves in
opacity = 1 - now;
current_fs.css({
'transform': 'scale('+scale+')',
'position': 'absolute'
});
next_fs.css({'left': left, 'opacity': opacity});
},
duration: 800,
complete: function(){
current_fs.hide();
animating = false;
},
//this comes from the custom easing plugin
easing: 'easeInOutBack'
});
});
$('#Choise input:radio').addClass('input_hidden');
$('#Choise label').click(function(){
$(this).addClass('selected').siblings().removeClass('selected');
});
$('#Choise2 input:radio').addClass('input_hidden');
$('#Choise2 label').click(function(){
$(this).addClass('selected').siblings().removeClass('selected');
});
$('#Choise3 input:radio').addClass('input_hidden');
$('#Choise3 label').click(function(){
$(this).addClass('selected').siblings().removeClass('selected');
});
$('#Choise4 input:radio').addClass('input_hidden');
$('#Choise4 label').click(function(){
$(this).addClass('selected').siblings().removeClass('selected');
});
$('#Choise5 input:radio').addClass('input_hidden');
$('#Choise5 label').click(function(){
$(this).addClass('selected').siblings().removeClass('selected');
});
$('#Choise6 input:radio').addClass('input_hidden');
$('#Choise6 label').click(function(){
$(this).addClass('selected').siblings().removeClass('selected');
});
$('#Choise7 input:radio').addClass('input_hidden');
$('#Choise7 label').click(function(){
$(this).addClass('selected').siblings().removeClass('selected');
});
$('#Choise8 input:radio').addClass('input_hidden');
$('#Choise8 label').click(function(){
$(this).addClass('selected').siblings().removeClass('selected');
});
$('#Choise9 input:radio').addClass('input_hidden');
$('#Choise9 label').click(function(){
$(this).addClass('selected').siblings().removeClass('selected');
});
/*custom font*/
#import url(https://fonts.googleapis.com/css?family=Montserrat);
/*basic reset*/
* {margin: 0; padding: 0;}
html {
height: 100%;
/*Image only BG fallback*/
/*background = gradient + image pattern combo*/
background:
linear-gradient(rgba(0, 0, 0, 0.6), rgba(20, 20, 20, 0.6));
}
body {
font-family: montserrat, arial, verdana;
}
/*form styles*/
#msform {
width: 950px;
margin: 50px auto;
text-align: center;
position: relative;
}
#msform fieldset {
background: white;
border: 0 none;
border-radius: 1px;
box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.4);
padding: 40px 40px;
box-sizing: border-box;
width: 80%;
margin: 0 10%;
/*stacking fieldsets above each other*/
position: relative;
}
/*Hide all except first fieldset*/
#msform fieldset:not(:first-of-type) {
display: none;
}
/*inputs*/
#msform input, #msform textarea {
padding: 10px;
border: 1px solid #ccc;
border-radius: 3px;
margin-bottom: 15px;
margin-top: 5px;
width: 100%;
box-sizing: border-box;
font-family: montserrat;
color: #2C3E50;
font-size: 13px;
}
#msform select {
text-align:left;
padding: 10px;
border: 1px solid #ccc;
border-radius: 3px;
margin-bottom: 15px;
margin-top: 5px;
width: 30%;
box-sizing: border-box;
font-family: montserrat;
color: #2C3E50;
font-size: 13px;
}
/*buttons*/
#msform .action-button {
width: 400px;
background: #00affe;
font-weight: bold;
font-size:16px;
color: white;
border: 0 none;
border-radius: 1px;
cursor: pointer;
padding: 10px 5px;
margin: 10px 5px;
}
#msform .action-button:hover, #msform .action-button:focus {
box-shadow: 0 0 0 2px white, 0 0 0 3px #00affe;
}
/*buttons2*/
#msform .choise-button {
cursor: pointer;
}
#msform .choise-button:hover, #msform .choise-button:focus {
box-shadow: 0 0 0 2px white, 0 0 0 3px #00affe;
border: 10 solid;
border-color: #FF0000;
}
#msform .Angaben {
font-size:12px;
text-align:left;
}
#msform .zustimmung {
font-size:12px;
}
#msform .zustimmunglinks {
font-size:12px;
color:#00affe;
}
#msform .zustimmunglinks:hover, #msform .zustimmunglinks:active, #msform .zustimmunglinks:hover+label, #msform .zustimmunglinks:active+label {
font-size:13px;
}
/*headings*/
.fs-title {
font-size: 18px;
color: #2C3E50;
margin-bottom: 40px;
}
.hr {
width: 110%;
margin-left: -5%;
text-align: center;
margin-bottom: 25px;
}
.Abfragentext {
border: 1px solid;
width:300px;
text-align: center;
margin-bottom: 40px;
margin-top: 40px;
padding-bottom: 30px;
margin: auto;
}
.fs-boldtitle {
font-weight: bold;
}
.fs-subtitle {
font-weight: normal;
font-size: 13px;
color: #666;
margin-bottom: 10px;
}
.sliderOutput {
color: #00affe;
font-weight: bold;
}
/*progressbar*/
#progressbar {
margin-bottom: 30px;
overflow: hidden;
/*CSS counters to number the steps*/
counter-reset: step;
}
#progressbar li {
list-style-type: none;
color: white;
font-size: 9px;
width: 25%;
float: left;
position: relative;
}
#progressbar li:before {
content: counter(step);
counter-increment: step;
width: 20px;
line-height: 20px;
display: block;
font-size: 10px;
color: #333;
background: white;
border-radius: 7px;
margin: 0 auto 5px auto;
}
/*progressbar connectors*/
#progressbar li:after {
content: '';
width: 100%;
height: 20px;
background: white;
position: absolute;
left: -50%;
top: 0px;
z-index: -1; /*put it behind the numbers*/
}
#progressbar li:first-child:after {
/*connector not needed before the first step*/
content: none;
}
/*marking active/completed steps green*/
/*The number of the step and the connector before it = green*/
#progressbar li.active:before, #progressbar li.active:after{
background: #00affe;
color: white;
}
.input_hidden {
position: absolute;
left: -9999px;
}
.selected {
-webkit-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.5);
-moz-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.5);
box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.5);
border-style: solid;
border-width: 5px;
border-color: #00affe;
border-radius: 5px;
}
#usp.uspdiv {
font-size:12px;
text-align: center;
margin-top: 20pt;
background-color: #888888;
width: 100%;
hight:100%;
}
.usp-facts1 {
font-size:13px;
margin-top: 20pt;
background-color: #F5F5F5;
width: 100%;
padding: 25px;
padding-right:50px;
margin-left:-40px;
margin-bottom:-40px;
}
.usp-table {
width:100%;
text-align: center;
}
.usp-prima {
font-size:18px;
color:#00affe;
}
/*Seite eins Auswahlen*/
label:hover, label:active, input:hover+label, input:active+label {
border: 3px solid;
border-color: #00affe;
-webkit-box-shadow: 0px 0px 5px 0px rgba(0,175,254,0.5);
-moz-box-shadow: 0px 0px 5px 0px rgba(0,175,254,0.5);
box-shadow: 0px 0px 5px 0px rgba(0,175,254,0.5);
transform: scale(1.05);
}
#Choise label {
width: 400px;
margin-right:5px;
margin-bottom: 5px;
border-radius: 4px;
-webkit-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
-moz-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
display: inline-block;
cursor: pointer;
transition: all 100ms linear;
border: 6px solid transparent;
}
#Choise label img {
padding: 3px;
margin-left:50px;
margin-right:50px;
}
#Choise h2 {
margin-bottom: 20px;
}
#Choise2 label {
margin-left:5px;
margin-right:5px;
margin-bottom: 5px;
border-radius: 4px;
-webkit-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
-moz-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
display: inline-block;
cursor: pointer;
transition: all 100ms linear;
border: 6px solid transparent;
}
#Choise2 label img {
padding: 3px;
margin-left:50px;
margin-right:50px;
}
#Choise2 h2 {
margin-bottom: 20px;
}
#Choise3 label {
margin-left:5px;
margin-bottom: 5px;
border-radius: 4px;
-webkit-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
-moz-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
display: inline-block;
cursor: pointer;
transition: all 100ms linear;
border: 6px solid transparent;
}
#Choise3 label img {
padding: 3px;
margin-left:50px;
margin-right:50px;
}
#Choise3 h2 {
margin-bottom: 20px;
}
#Choise4 label {
margin-top:5px;
margin-right:5px;
border-radius: 4px;
-webkit-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
-moz-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
display: inline-block;
cursor: pointer;
transition: all 100ms linear;
border: 6px solid transparent;
}
#Choise4 label img {
padding: 3px;
margin-left:50px;
margin-right:50px;
}
#Choise4 h2 {
margin-bottom: 20px;
}
#Choise5 label {
margin-top:5px;
margin-left:5px;
margin-right:5px;
border-radius: 4px;
-webkit-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
-moz-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
display: inline-block;
cursor: pointer;
transition: all 100ms linear;
border: 6px solid transparent;
}
#Choise5 label img {
padding: 3px;
margin-left:50px;
margin-right:50px;
}
#Choise5 h2 {
margin-bottom: 20px;
}
#Choise6 label {
margin-top:5px;
margin-left:5px;
border-radius: 4px;
-webkit-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
-moz-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
display: inline-block;
cursor: pointer;
transition: all 100ms linear;
border: 6px solid transparent;
}
#Choise6 label img {
padding: 3px;
margin-left:50px;
margin-right:50px;
}
#Choise6 h2 {
margin-bottom: 20px;
}
#Choise7 label {
margin-top:5px;
margin-left:5px;
border-radius: 4px;
-webkit-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
-moz-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
display: inline-block;
cursor: pointer;
transition: all 100ms linear;
border: 6px solid transparent;
}
#Choise7 label img {
padding: 3px;
margin-left:50px;
margin-right:50px;
}
#Choise7 h2 {
margin-bottom: 20px;
}
#Choise8 label {
margin-top:5px;
margin-left:5px;
border-radius: 4px;
-webkit-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
-moz-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
display: inline-block;
cursor: pointer;
transition: all 100ms linear;
border: 6px solid transparent;
}
#Choise8 label img {
padding: 3px;
margin-left:50px;
margin-right:50px;
}
#Choise8 h2 {
margin-bottom: 20px;
}
#Choise9 label {
margin-top:5px;
margin-left:5px;
border-radius: 4px;
-webkit-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
-moz-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.5);
display: inline-block;
cursor: pointer;
transition: all 100ms linear;
border: 6px solid transparent;
}
#Choise9 label img {
padding: 3px;
margin-left:50px;
margin-right:50px;
}
#Choise9 h2 {
margin-bottom: 20px;
}
/*ragen Slider Etagen*/
input[type=range].etagenslider {
-webkit-appearance: none;
width: 100%;
margin: 8.5px 0;
}
input[type=range].etagenslider:focus {
outline: none;
}
input[type=range].etagenslider::-webkit-slider-runnable-track {
width: 100%;
height: 3px;
cursor: pointer;
box-shadow: 0.5px 0.5px 15px rgba(2, 0, 0, 0.6), 0px 0px 0.5px rgba(28, 0, 0, 0.6);
background: #484d4d;
border-radius: 25px;
border: 0px solid rgba(0, 0, 0, 0);
}
input[type=range].etagenslider::-webkit-slider-thumb {
box-shadow: 0px 0px 2px #000000, 0px 0px 0px #0d0d0d;
border: 0px solid rgba(255, 30, 0, 0);
height: 20px;
width: 50px;
border-radius: 50px;
background: #00afee;
cursor: pointer;
-webkit-appearance: none;
margin-top: -8.5px;
}
input[type=range].etagenslider:focus::-webkit-slider-runnable-track {
background: #7e8787;
}
input[type=range].etagenslider::-moz-range-track {
width: 100%;
height: 3px;
cursor: pointer;
box-shadow: 0.5px 0.5px 15px rgba(2, 0, 0, 0.6), 0px 0px 0.5px rgba(28, 0, 0, 0.6);
background: #484d4d;
border-radius: 25px;
border: 0px solid rgba(0, 0, 0, 0);
}
input[type=range].etagenslider::-moz-range-thumb {
box-shadow: 0px 0px 2px #000000, 0px 0px 0px #0d0d0d;
border: 0px solid rgba(255, 30, 0, 0);
height: 20px;
width: 50px;
border-radius: 50px;
background: #00afee;
cursor: pointer;
}
input[type=range].etagenslider::-ms-track {
width: 100%;
height: 3px;
cursor: pointer;
background: transparent;
border-color: transparent;
color: transparent;
}
input[type=range].etagenslider::-ms-fill-lower {
background: #121313;
border: 0px solid rgba(0, 0, 0, 0);
border-radius: 50px;
box-shadow: 0.5px 0.5px 15px rgba(2, 0, 0, 0.6), 0px 0px 0.5px rgba(28, 0, 0, 0.6);
}
input[type=range].etagenslider::-ms-fill-upper {
background: #484d4d;
border: 0px solid rgba(0, 0, 0, 0);
border-radius: 50px;
box-shadow: 0.5px 0.5px 15px rgba(2, 0, 0, 0.6), 0px 0px 0.5px rgba(28, 0, 0, 0.6);
}
input[type=range].etagenslider::-ms-thumb {
box-shadow: 0px 0px 2px #000000, 0px 0px 0px #0d0d0d;
border: 0px solid rgba(255, 30, 0, 0);
height: 20px;
width: 50px;
border-radius: 50px;
background: #00afee;
cursor: pointer;
height: 3px;
}
input[type=range].etagenslider:focus::-ms-fill-lower {
background: #484d4d;
}
input[type=range].etagenslider:focus::-ms-fill-upper {
background: #7e8787;
}
Hey, I am working on a contact form in which several steps are taken per .
the first step is that you can choose an image from six images.
When you click on an image (which acts as hidden radio-button) then it allows to (are directed to) the next fieldset.
This link prevent the radio buttons from being selected. do you have an idea how to activate the input with the link at the same time? I already tried it with an onclick, but unfortunately it doesn't work. I need the to "group" the code, because otherwise, it dont work.
I'm looking forward to your ideas, thank you!
Edit: is it possible to say if <a id="x1"> is klickes then select <input type="radio" id="x1" and how would the code look like? im not that good, sorry for that :(
Related
How change range slider to show money?
I found this slider on codepen . How do I get it to show me a minimum of € 500 and a maximum of € 6000 but to preserve the red background? I have tried everything eg. <input id = "range" type = "range" class = "range-slider" min = "500" max = "6000" step = "100"> But the range slider stretches to 6000% and I'm not good at JS. const rangeSlider = document.querySelector('.range-slider'); const rangeValueBar = document.querySelector('#range-value-bar'); const rangeValue = document.querySelector('#range-value'); let isDown = false; function dragHandler() { isDown = !isDown; if (!isDown) { rangeValue.style.setProperty('opacity', '1'); } else { rangeValue.style.setProperty('opacity', '1'); } } function dragOn(e) { if (!isDown) return; rangeValueHandler(); } function rangeValueHandler() { rangeValueBar.style.setProperty('width', `${rangeSlider.value}%`); rangeValue.innerHTML = `${rangeSlider.value}€`; } rangeValueHandler(); rangeSlider.addEventListener('mousedown', dragHandler); rangeSlider.addEventListener('mousemove', dragOn); rangeSlider.addEventListener('mouseup', dragHandler); rangeSlider.addEventListener('click', rangeValueHandler); body { padding: 100px; } .range-slider-container { position: relative; } input[type=range] { -webkit-appearance: none; margin: 10px 0; width: 100%; position: absolute; top: 0; margin: 0; } #range-value-bar { width: 100%; content: "0"; background-color: #FC6E50; position: absolute; z-index: 10000; height: 25px; top: 0; margin: 0; border-radius: 5px; } /**/ #range-value { width: 25px; content:"0"; background: rgba(233, 239, 244, 0.1);; position: absolute; z-index: 10000; height: 25px; top: -65px; margin: 0; border-radius: 5px; left: 50%; transform: translateX(-50%); font-size: 20px; padding: 12px; color: #41576B; box-shadow: 0 2px 10px 0 rgba(0,0,0,0.08); text-align: center; opacity: 0; } input[type=range]:focus { outline: none; } input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 25px; cursor: pointer; animate: 0.2s; box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d; background: #E9EFF4; border-radius: 5px; border: 0px solid #000101; } input[type=range]::-webkit-slider-thumb { box-shadow: 0 2px 10px 0 rgba(0,0,0,0.08); border: 14px solid #FFF; height: 53px; width: 53px; border-radius: 30px; background: #FC6E50; cursor: pointer; -webkit-appearance: none; margin-top: -13.5px; position: relative; z-index: 1000000000; } input[type=range]::-moz-range-track { width: 100%; height: 12.8px; cursor: pointer; animate: 0.2s; box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d; background: #000; border-radius: 25px; border: 0px solid #000101; } input[type=range]::-moz-range-thumb { box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d; border: 0px solid #000000; height: 20px; width: 39px; border-radius: 7px; background: #000000; cursor: pointer; } input[type=range]::-ms-track { width: 100%; height: 12.8px; cursor: pointer; animate: 0.2s; background: transparent; border-color: transparent; border-width: 39px 0; color: transparent; } input[type=range]::-ms-fill-lower { background: #000; border: 0px solid #000101; border-radius: 50px; box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d; } input[type=range]::-ms-fill-upper { background: #000; border: 0px solid #000101; border-radius: 50px; box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d; } input[type=range]::-ms-thumb { box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d; border: 0px solid #000000; height: 20px; width: 39px; border-radius: 7px; background: #000; cursor: pointer; } <div class="range-slider-container"> <input id="range" type="range" class="range-slider"> <span id="range-value-bar"></span> <span id="range-value">0</span> </div>
I believe this is what you want, simply you can use min and max attributes for range slider form element, what I had to do is to remove width style in rangeValueHandler function. I had to do the calculation for percentage for the width: ((input - min_value) *100)/ (max_value - min_value)}% const rangeSlider = document.querySelector('.range-slider'); const rangeValueBar = document.querySelector('#range-value-bar'); const rangeValue = document.querySelector('#range-value'); let isDown = false; function dragHandler() { isDown = !isDown; if (!isDown) { rangeValue.style.setProperty('opacity', '1'); } else { rangeValue.style.setProperty('opacity', '1'); } } function dragOn(e) { if (!isDown) return; rangeValueHandler(); } function rangeValueHandler() { percentage = `${((rangeSlider.value - 500) * 100) / (6000 - 500)}%`; rangeValueBar.style.setProperty('width', percentage); rangeValue.innerHTML = `${rangeSlider.value}€`; } rangeValueHandler(); rangeSlider.addEventListener('mousedown', dragHandler); rangeSlider.addEventListener('mousemove', dragOn); rangeSlider.addEventListener('mouseup', dragHandler); rangeSlider.addEventListener('click', rangeValueHandler); body { padding: 100px; } .range-slider-container { position: relative; } input[type=range] { -webkit-appearance: none; margin: 10px 0; width: 100%; position: absolute; top: 0; margin: 0; } #range-value-bar { width: 100%; max-width: 100%; content: "0"; background-color: #FC6E50; position: absolute; z-index: 10000; height: 25px; top: 0; margin: 0; border-radius: 5px; } /**/ #range-value { width: auto; content:"0"; background: rgba(233, 239, 244, 0.1);; position: absolute; z-index: 10000; height: 25px; top: -65px; margin: 0; border-radius: 5px; left: 50%; transform: translateX(-50%); font-size: 20px; padding: 12px; color: #41576B; box-shadow: 0 2px 10px 0 rgba(0,0,0,0.08); text-align: center; opacity: 0; } input[type=range]:focus { outline: none; } input[type=range]::-webkit-slider-runnable-track { /*width: 100%;*/ height: 25px; cursor: pointer; animate: 0.2s; box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d; background: #E9EFF4; border-radius: 5px; border: 0px solid #000101; } input[type=range]::-webkit-slider-thumb { box-shadow: 0 2px 10px 0 rgba(0,0,0,0.08); border: 14px solid #FFF; height: 53px; width: 53px; border-radius: 30px; background: #FC6E50; cursor: pointer; -webkit-appearance: none; margin-top: -13.5px; position: relative; z-index: 1000000000; } input[type=range]::-moz-range-track { /*width: 100%;*/ height: 12.8px; cursor: pointer; animate: 0.2s; box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d; background: #000; border-radius: 25px; border: 0px solid #000101; } input[type=range]::-moz-range-thumb { box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d; border: 0px solid #000000; height: 20px; width: 39px; border-radius: 7px; background: #000000; cursor: pointer; } input[type=range]::-ms-track { /*width: 100%;*/ height: 12.8px; cursor: pointer; animate: 0.2s; background: transparent; border-color: transparent; border-width: 39px 0; color: transparent; } input[type=range]::-ms-fill-lower { background: #000; border: 0px solid #000101; border-radius: 50px; box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d; } input[type=range]::-ms-fill-upper { background: #000; border: 0px solid #000101; border-radius: 50px; box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d; } input[type=range]::-ms-thumb { box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d; border: 0px solid #000000; height: 20px; width: 39px; border-radius: 7px; background: #000; cursor: pointer; } <div class="range-slider-container"> <input id="range" type="range" min="500" max="6000" class="range-slider"> <span id="range-value-bar"></span> <span id="range-value">0</span> </div>
Simply adapt the javascript that display the value: function rangeValueHandler() { rangeValueBar.style.setProperty('width', `${rangeSlider.value}%`); const moneyValue = Math.round(500 + 5500 * rangeSlider.value * 0.01); rangeValue.innerHTML = `\$ ${moneyValue}`; }
you can set the limits min & max to any other value in this code its 500 & 6000 const rangeSlider = document.querySelector('.range-slider'); const rangeValueBar = document.querySelector('#range-value-bar'); const rangeValue = document.querySelector('#range-value'); let isDown = false; function dragHandler() { isDown = !isDown; if (!isDown) { rangeValue.style.setProperty('opacity', '1'); } else { rangeValue.style.setProperty('opacity', '1'); } } function dragOn(e) { if (!isDown) return; rangeValueHandler(); } function rangeValueHandler() { min=500; max=6000; rangeValueBar.style.setProperty('width',`${rangeSlider.value}%`); value = Math.round(min + (max-min) * (rangeSlider.value/100)); rangeValue.innerHTML = `${value}€`; } rangeValueHandler(); rangeSlider.addEventListener('mousedown', dragHandler); rangeSlider.addEventListener('mousemove', dragOn); rangeSlider.addEventListener('mouseup', dragHandler); rangeSlider.addEventListener('click', rangeValueHandler); body { padding: 100px; } .range-slider-container { position: relative; } input[type=range] { -webkit-appearance: none; margin: 10px 0; width: 100%; position: absolute; top: 0; margin: 0; } #range-value-bar { width: 100%; content: "0"; background-color: #FC6E50; position: absolute; z-index: 10000; height: 25px; top: 0; margin: 0; border-radius: 5px; } /**/ #range-value { content:"0"; background: rgba(233, 239, 244, 0.1);; position: absolute; z-index: 10000; height: 25px; top: -65px; margin: 0; border-radius: 5px; left: 50%; transform0: translateX(-50%); font-size: 20px; padding: 12px; color: #41576B; box-shadow: 0 2px 10px 0 rgba(0,0,0,0.08); text-align: center; opacity: 0; } input[type=range]:focus { outline: none; } input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 25px; cursor: pointer; animate: 0.2s; box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d; background: #E9EFF4; border-radius: 5px; border: 0px solid #000101; } input[type=range]::-webkit-slider-thumb { box-shadow: 0 2px 10px 0 rgba(0,0,0,0.08); border: 14px solid #FFF; height: 53px; width: 53px; border-radius: 30px; background: #FC6E50; cursor: pointer; -webkit-appearance: none; margin-top: -13.5px; position: relative; z-index: 1000000000; } input[type=range]::-moz-range-track { width: 100%; height: 12.8px; cursor: pointer; animate: 0.2s; box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d; background: #000; border-radius: 25px; border: 0px solid #000101; } input[type=range]::-moz-range-thumb { box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d; border: 0px solid #000000; height: 20px; width: 39px; border-radius: 7px; background: #000000; cursor: pointer; } input[type=range]::-ms-track { width: 100%; height: 12.8px; cursor: pointer; animate: 0.2s; background: transparent; border-color: transparent; border-width: 39px 0; color: transparent; } input[type=range]::-ms-fill-lower { background: #000; border: 0px solid #000101; border-radius: 50px; box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d; } input[type=range]::-ms-fill-upper { background: #000; border: 0px solid #000101; border-radius: 50px; box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d; } input[type=range]::-ms-thumb { box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d; border: 0px solid #000000; height: 20px; width: 39px; border-radius: 7px; background: #000; cursor: pointer; } <div class="range-slider-container"> <input id="range" type="range" class="range-slider"> <span id="range-value-bar"></span> <span id="range-value">0</span> </div>
how to change style of bootstrap tagsinput
I have an input field with bootstrap tagsinput, the problem is when the tag is activated I don't have the box of the tag. For example I have this : And I want something like this : showing that the tag python and java is activated with creating a little box. I am using this style for my example : <style> .bootstrap-tagsinput { background-color: #fff; border: 1px solid #ccc; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); display: inline-block; padding: 4px 6px; color: #555; vertical-align: middle; border-radius: 4px; max-width: 100%; line-height: 22px; cursor: text; } .bootstrap-tagsinput input { border: none; box-shadow: none; outline: none; background-color: transparent; padding: 0 6px; margin: 0; width: auto; max-width: inherit; } .bootstrap-tagsinput.form-control input::-moz-placeholder { color: rgb(170, 36, 36); opacity: 1; } .bootstrap-tagsinput.form-control input:-ms-input-placeholder { color: #777; } .bootstrap-tagsinput.form-control input::-webkit-input-placeholder { color: #777; } .bootstrap-tagsinput input:focus { border: none; box-shadow: none; } .bootstrap-tagsinput .tag { margin-right: 2px; color: black; } .bootstrap-tagsinput .tag [data-role="remove"] { margin-left: 8px; cursor: pointer; } .bootstrap-tagsinput .tag [data-role="remove"]:after { content: "x"; padding: 0px 2px; } .bootstrap-tagsinput .tag [data-role="remove"]:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); } .bootstrap-tagsinput .tag [data-role="remove"]:hover:active { box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); } </style>
I solved my problem by adding this : .bootstrap-tagsinput .tag { background: gray; border: 1px solid black; padding: 0 6px; margin-right: 2px; color: white; border-radius: 4px; }
footer button in Android Browser
I am new to CSS and developing a simple template which will be showed inside an Android Browser. Basically my template only has two elements, an error message, and a button (should be placed at footer). I have read a few posts at stackoverflow. People suggest to use position:fixed; bottom: 0; to place an element at footer. However, when I added this my button css, it seems my button was just placed right below the error message instead of at the footer. Anyone has any ideas why? .fulfill-application-button{ display: inline-block; width: 100%; zoom: 1; margin: 0; text-align: center; cursor: pointer; border: 1px solid #bbb; overflow: visible; font: bold 25px arial, helvetica, sans-serif; text-decoration: none; white-space: nowrap; color: #555; background-color: #ddd; transition: background-color .2s ease-out; background-clip: padding-box; border-radius: 3px; box-shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 2px 2px -1px rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 255, 255, .3) inset; text-shadow: 0 1px 0 rgba(255,255,255, .9); } .fulfill-application-button:hover{ background-color: #eee; color: #555; } .fulfill-application-button:active{ background: #e9e9e9; position: relative; top: 1px; text-shadow: none; box-shadow: 0 1px 1px rgba(0, 0, 0, .3) inset; } .fulfill-application-button.color{ color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.2); } .fulfill-application-button.ok{ position: relative; bottom: 0; padding: 10px 90px; background-color: #c43c35; border-color: #c43c35; } .fulfill-application-button.ok:hover{ background-color: #ee5f5b; } .fulfill-application-button.ok:active{ background: #c43c35; } html,body { padding: 15px; height: 100%; background-color: black; } div.error-message{ color: white; line-height: 120%; padding-top: 20%; font-size:30px; } </style> <body> <div class ="error-message"> ${error} </div> <button id="ok" type="button" class="color ok fulfill-application-button"> OK </button> </body>
Change position: relative; to position: fixed; from class .fulfill-application-button.ok Code : .fulfill-application-button.ok{ position: fixed; bottom: 0; padding: 10px 90px; background-color: #c43c35; border-color: #c43c35; } Note : You can give right and left for the same, if you want.
How may I stack multiple html/css buttons vertically along the center of the page?
My css is listed below, followed by the html. I am not currently aware of a method to centralize the buttons within the below detailed "box/inner-box" s. The flex display seems to be stacking the buttons vertically (though, honestly, I am not certain as to how), but, no matter what I try, and I have tried most searchable recommendations, I cannot seem to locate the column of buttons to the centre of the page, beneath the 'my name' . Does anyone know how I might centralize the buttons or if there is a much simpler method for accomplishing a similar aesthetic? I am open to all solutions. Thank you in advance! html, body { height: 100%; background: #ffffff; overflow: hidden; color: #000000; font-family: 'Raleway'; font-size: 18px; } h1 { font-weight: 200; margin-bottom: 0.5em; text-align: center; } .box { position: absolute; top: 50%; left: 50%; transform: translate3d(-50%, -50%, 0); background-color: #ffffff; width: 90%; max-width: 1920px; padding: 5px; border: 2px solid #000000; } .box .box-inner { position: relative; border: 2px solid #000000; padding: 40px; } .btn { box-sizing: border-box; appearance: none; background-color: transparent; border: 2px solid #000000; border-radius: 0.6em; color: #000000; cursor: pointer; font-size: 18px; font-weight: 400; line-height: 1; margin: 12px; padding: 1.2em 1.5em; display: flex; text-transform: uppercase; font-family: 'Raleway'; font-weight: 400; } .btn:hover, .btn:focus { color: #000000; outline: 0; } .me { border-radius: 0; border-color: #000000; transition: all 150ms ease-in-out; } .me:hover { box-shadow: 0 0 10px 0 #000000 inset, 0 0 10px 4px #000000; } .cv { border-radius: 0; border-color: #000000; transition: all 150ms ease-in-out; } .cv:hover { box-shadow: 0 0 10px 0 #000000 inset, 0 0 10px 4px #000000; } .rd { border-radius: 0; border-color: #000000; transition: all 150ms ease-in-out; } .rd:hover { box-shadow: 0 0 10px 0 #000000 inset, 0 0 10px 4px #000000; } .av { border-radius: 0; border-color: #000000; transition: all 150ms ease-in-out; } .av:hover { box-shadow: 0 0 10px 0 #000000 inset, 0 0 10px 4px #000000; } .rr { border-radius: 0; border-color: #000000; transition: all 150ms ease-in-out; } .rr:hover { box-shadow: 0 0 10px 0 #000000 inset, 0 0 10px 4px #000000; } <body> <div class='box'> <div class='box-inner'> <h1>myname</h1> <button class="btn me">me</button> <button class="btn cv">cv</button> <button class="btn rd">rd</button> <button class="btn av">av</button> <button class="btn rr">rr</button> </div> </div> </body>
I know you already have multiple answers. However the way you use flex is not correct. It should be added into the parent div box-inner display:flex; align-items:center; //align item center flex-direction:column; //direction to column html, body { height: 100%; background: #ffffff; overflow: hidden; color: #000000; font-family: 'Raleway'; font-size: 18px; } h1 { font-weight: 200; margin-bottom: 0.5em; text-align: center; } .box { position: absolute; top: 50%; left: 50%; transform: translate3d(-50%, -50%, 0); background-color: #ffffff; width: 90%; max-width: 1920px; padding: 5px; border: 2px solid #000000; } .box .box-inner { position: relative; border: 2px solid #000000; padding: 40px; display:flex; align-items:center; flex-direction:column; } .btn { box-sizing: border-box; appearance: none; background-color: transparent; border: 2px solid #000000; border-radius: 0.6em; color: #000000; cursor: pointer; font-size: 18px; font-weight: 400; line-height: 1; margin: 12px; padding: 1.2em 1.5em; text-transform: uppercase; font-family: 'Raleway'; font-weight: 400; } .btn:hover, .btn:focus { color: #000000; outline: 0; } .me { border-radius: 0; border-color: #000000; transition: all 150ms ease-in-out; } .me:hover { box-shadow: 0 0 10px 0 #000000 inset, 0 0 10px 4px #000000; } .cv { border-radius: 0; border-color: #000000; transition: all 150ms ease-in-out; } .cv:hover { box-shadow: 0 0 10px 0 #000000 inset, 0 0 10px 4px #000000; } .rd { border-radius: 0; border-color: #000000; transition: all 150ms ease-in-out; } .rd:hover { box-shadow: 0 0 10px 0 #000000 inset, 0 0 10px 4px #000000; } .av { border-radius: 0; border-color: #000000; transition: all 150ms ease-in-out; } .av:hover { box-shadow: 0 0 10px 0 #000000 inset, 0 0 10px 4px #000000; } .rr { border-radius: 0; border-color: #000000; transition: all 150ms ease-in-out; } .rr:hover { box-shadow: 0 0 10px 0 #000000 inset, 0 0 10px 4px #000000; } <body> <div class='box'> <div class='box-inner'> <h1>myname</h1> <button class="btn me">me</button> <button class="btn cv">cv</button> <button class="btn rd">rd</button> <button class="btn av">av</button> <button class="btn rr">rr</button> </div> </div> </body>
Check out this code: you need to have a margin: 0 auto, and add text-align:center. html, body { height: 100%; background: #ffffff; overflow: hidden; color: #000000; font-family: 'Raleway'; font-size: 18px; } h1 { font-weight: 200; margin-bottom: 0.5em; text-align: center; } .box { position: absolute; top: 50%; left: 50%; transform: translate3d(-50%, -50%, 0); background-color: #ffffff; width: 90%; max-width: 1920px; padding: 5px; border: 2px solid #000000; } .box .box-inner { position: relative; border: 2px solid #000000; padding: 40px; } .btn { box-sizing: border-box; display: block; margin: 0 auto; appearance: none; background-color: transparent; border: 2px solid #000000; border-radius: 0.6em; color: #000000; cursor: pointer; font-size: 18px; font-weight: 400; line-height: 1; padding: 1.2em 1.5em; display: flex; text-transform: uppercase; font-family: 'Raleway'; font-weight: 400; } .btn:hover, .btn:focus { color: #000000; outline: 0; } .me { border-radius: 0; border-color: #000000; transition: all 150ms ease-in-out; } .me:hover { box-shadow: 0 0 10px 0 #000000 inset, 0 0 10px 4px #000000; } .cv { border-radius: 0; border-color: #000000; transition: all 150ms ease-in-out; } .cv:hover { box-shadow: 0 0 10px 0 #000000 inset, 0 0 10px 4px #000000; } .rd { border-radius: 0; border-color: #000000; transition: all 150ms ease-in-out; } .rd:hover { box-shadow: 0 0 10px 0 #000000 inset, 0 0 10px 4px #000000; } .av { border-radius: 0; border-color: #000000; transition: all 150ms ease-in-out; } .av:hover { box-shadow: 0 0 10px 0 #000000 inset, 0 0 10px 4px #000000; } .rr { border-radius: 0; border-color: #000000; transition: all 150ms ease-in-out; } .rr:hover { box-shadow: 0 0 10px 0 #000000 inset, 0 0 10px 4px #000000; }
Simply add below CSS .box { position: absolute; margin: auto; top: 0; right: 0; bottom: 0; left: 0; width: 100px; height: 100%; } .box .btn { display: block; margin: 0 auto; } and modify you HTML too <body> <div class="box"> <h1>myname</h1> <button class="btn me">me</button> <button class="btn cv">cv</button> <button class="btn rd">rd</button> <button class="btn av">av</button> <button class="btn rr">rr</button> </div> </body> this will place buttons in center of page, both horizontally and vertically.
check out this code: you need to have a margin 0 auto, and add text-align:center html, body { height: 100%; background: #ffffff; overflow: hidden; color: #000000; font-family: 'Raleway'; font-size: 18px; } h1 { font-weight: 200; margin-bottom: 0.5em; text-align: center; } .box { position: absolute; top: 50%; left: 50%; transform: translate3d(-50%, -50%, 0); background-color: #ffffff; width: 90%; max-width: 1920px; padding: 5px; border: 2px solid #000000; } .box .box-inner { position: relative; border: 2px solid #000000; padding: 40px; } .btn { box-sizing: border-box; display: block; margin: 0 auto; appearance: none; background-color: transparent; border: 2px solid #000000; border-radius: 0.6em; color: #000000; cursor: pointer; font-size: 18px; font-weight: 400; line-height: 1; padding: 1.2em 1.5em; display: flex; text-transform: uppercase; font-family: 'Raleway'; font-weight: 400; } .btn:hover, .btn:focus { color: #000000; outline: 0; } .me { border-radius: 0; border-color: #000000; transition: all 150ms ease-in-out; } .me:hover { box-shadow: 0 0 10px 0 #000000 inset, 0 0 10px 4px #000000; } .cv { border-radius: 0; border-color: #000000; transition: all 150ms ease-in-out; } .cv:hover { box-shadow: 0 0 10px 0 #000000 inset, 0 0 10px 4px #000000; } .rd { border-radius: 0; border-color: #000000; transition: all 150ms ease-in-out; } .rd:hover { box-shadow: 0 0 10px 0 #000000 inset, 0 0 10px 4px #000000; } .av { border-radius: 0; border-color: #000000; transition: all 150ms ease-in-out; } .av:hover { box-shadow: 0 0 10px 0 #000000 inset, 0 0 10px 4px #000000; } .rr { border-radius: 0; border-color: #000000; transition: all 150ms ease-in-out; } .rr:hover { box-shadow: 0 0 10px 0 #000000 inset, 0 0 10px 4px #000000; } <body> <div class='box'> <div class='box-inner'> <h1>myname</h1> <button class="btn me">me</button> <button class="btn cv">cv</button> <button class="btn rd">rd</button> <button class="btn av">av</button> <button class="btn rr">rr</button> </div> </div> </body>
JQuery slideshow not working probably
I'm new to web development, I integrated this slider into my page : Slideshow source+tutorial The slider work if I run it on any local page different to mine it runs perfectly, but on mine the following problems occur : 1-pagination + arrows don't show up 2-I cant center it my CSS : <style> #font-face { font-family: imp1; src: url(fonts/blackchancery/BLKCHCRY.TTF); } * { margin: 0; outline: none; } html { background: #32c951 url(img/noise.png); } body { padding-right: 25px; padding-left: 25px; padding-top: 10px; padding-bottom: 25px; width:1200px; } #header { position:top fixed; padding-bottom:15px; } #menu-bar { margin: 0px 0px 0px 0px; padding: 6px 0px 4px 0px; line-height: 100%; border-radius: 0px; -webkit-border-radius: 0px; -moz-border-radius: 0px; box-shadow: 0px 0px 0px #666666; -webkit-box-shadow: 0px 0px 0px #666666; -moz-box-shadow: 0px 0px 0px #666666; background: #2D964D url(img/noise.png); border: solid 1px #FFFFFF; z-index:999; } #menu-bar li { margin: 0px 0px 3px 0px; padding: 0px 6px 0px 12px; float: left; position: relative; list-style: none; } #menu-bar a { font-weight: bolder; font-family: helvetica; font-style: italic; font-size: 16px; color: #FFFDFD; text-decoration: none; display: block; padding: 6px 20px 6px 20px; margin: 0; margin-bottom: 3px; border-radius: 6px; -webkit-border-radius: 6px; -moz-border-radius: 6px; text-shadow: 0px 0px 0px #000000; } #menu-bar li ul li a { margin: 0; } #menu-bar .active a, #menu-bar li:hover > a { background: #82FF4D; color: #2A7D35; -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .2); -moz-box-shadow: 0 1px 1px rgba(0, 0, 0, .2); box-shadow: 0 1px 1px rgba(0, 0, 0, .2); text-shadow: 0px 0px 0px #FFFFFF; } #menu-bar ul li:hover a, #menu-bar li:hover li a { background: none; border: none; color: #666; -box-shadow: none; -webkit-box-shadow: none; -moz-box-shadow: none; } #menu-bar ul a:hover { background: #82FF4D !important; color: #000000 !important; border-radius: 0; -webkit-border-radius: 0; -moz-border-radius: 0; text-shadow: 0px 0px 0px #FFFFFF; } #menu-bar li:hover > ul { display: block; } #menu-bar ul { background: #2A7D35; display: none; margin: 0; padding: 0; width: 185px; position: absolute; top: 30px; left: 0; border: solid 1px #B4B4B4; border-radius: 10px; -webkit-border-radius: 10px; -moz-border-radius: 10px; -webkit-box-shadow: 2px 2px 3px #222222; -moz-box-shadow: 2px 2px 3px #222222; box-shadow: 2px 2px 3px #222222; } #menu-bar ul li { float: none; margin: 0; padding: 0; } #menu-bar ul a { padding:10px 0px 10px 15px; color:#FFFFFF !important; font-size:15px; font-style:italic; font-family:helvetica; font-weight: bold; text-shadow: 0px 0px 0px #FFFFFF; } #menu-bar ul li:first-child > a { border-top-left-radius: 10px; -webkit-border-top-left-radius: 10px; -moz-border-radius-topleft: 10px; border-top-right-radius: 10px; -webkit-border-top-right-radius: 10px; -moz-border-radius-topright: 10px; } #menu-bar ul li:last-child > a { border-bottom-left-radius: 10px; -webkit-border-bottom-left-radius: 10px; -moz-border-radius-bottomleft: 10px; border-bottom-right-radius: 10px; -webkit-border-bottom-right-radius: 10px; -moz-border-radius-bottomright: 10px; } #menu-bar:after { content: "."; display: block; clear: both; visibility: hidden; line-height: 0; height: 0; } #menu-bar { display: inline-block; } html[xmlns] #menu-bar { display: block; } #wrapper { background-color: rgba(255, 255, 255, 0.8); /* (R, B, G, OPACITY */ position:center; } #main_content { text-align:center; } #footer { position:fixed; height:20px; background-color:red; bottom:0px; left:0px; right:0px; margin-bottom:0px; background:#FFFFFF url(img/noise.png); text-align:center; } #footer_content { width:960px; } #footer li { display:inline; } p { font-family:imp1; } #welco_mes { font-family:imp1; font-size:35px; color:black; } </style> I suspect the whole problem comes from my CSS; an element is causing the slideshow to behave this way. JSFiddle link: https://jsfiddle.net/nvsp94d7/3/ Though if the js+css of the slideshow are included, the slideshow immediatly sticks to the left+all its controls never show up
Here's a fork of your fiddle, https://jsfiddle.net/68z476g2/1/, that has the pagination and the slideshow centered compared to the parent div. I had to replace the slideshow pictures because they were not provided. What comes to pagination not showing, I suspect it is because you didn't copy pagination.png to the correct location. It is referred to by the CSS and therefore it needs to be at ../images/pagination.png compared to the location of craftyslide.css Centering the div was just matter of adding #slideshow { margin: 0 auto; } to your CSS file