javascript - Customizing and positioning a vertical slider in HTML/CSS -


i'm trying create remote control app using cordova.

there should 2 vertical sliders (<input type="range">, customizations (height, width, color, etc.). 1 should on left, positioned @ 25% of page width; , other on right, @ 75% of page width.

the sliders should centered on correct point (ex. calc(25% - 20px); slider on left if 40px wide, be).

the other requirement webpage works on ios safari (really cordova, uses apple's webkit same). opera/firefox nice. it not have ie compatible (you're welcome).

i don't mind using javascript/jquery, prefer css.

also, reasons unexplained, sliders go off top of page, must fixed. 1 last bug have applying position: fixed; left: 0px; slider not move left, centerinviewport() function offset.

here's jsfiddle: https://jsfiddle.net/coder256/6zjnk3qt/

i tried -webkit-appearance: slider-vertical. doesn't allow styling. sliders, -webkit-appearance value aside none i've tried doesn't let style anything.

update: sorry if wasn't clear. question is: how correctly position sliders while keeping customization, correctly being not far off page , @ correct x position described above?

the trick set margin-topto half of sliders width keep sliders being far off page.

same principle x position. use calc set left 25% / 75% minus half of sliders width correct position.

html, body {margin: 0; padding: 0; width: 100%; height: 100%}    h1 {    text-align: center;  }    .app {    width: 100%;  }    .sliders {    position: relative;  }    input[type=range].vslider {    -webkit-appearance: none;    transform: rotate(270deg) translatey(-50%);    margin-top: 200px; /* 50% of width because of transformation */    width: 400px;    height: 40px;    outline: none;    position: absolute;  }    input[type=range].vslider::-webkit-slider-thumb {    -webkit-appearance: none;    background-color: #777;    opacity: 0.75;    width: 25px;    height: 40px;    transform: translatey(-10px);  }    input[type=range].vslider::-webkit-slider-runnable-track {    -webkit-appearance: none;    background-color: #444;    color: #444;    height: 20px;    width: 400px;  }    #lslider {    left: calc(25% - 200px); /* 50% of width because of transformation */  }    #rslider {    left: calc(75% - 200px); /* 50% of width because of transformation */  }
<div class="app">    <h1>rc car test</h1>    <div id="sliders">      <input type="range" min="-256" max="256" step="1" defaultvalue="0" class="vslider" id="lslider" />      <input type="range" min="-256" max="256" step="1" defaultvalue="0" class="vslider" id="rslider" />    </div>  </div>


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -