cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <div id="conteinter">
	<div id="abas">
		<div aly-for="1">
			<i class="fa fa-american-sign-language-interpreting" aria-hidden="true"></i>
			Aa BbCc
		</div>
		<div aly-for="2">
			<i class="fa fa-blind" aria-hidden="true"></i>
		</div>
		<div aly-for="3">
			<i class="fa fa-envira" aria-hidden="true"></i>
		</div>
		<div aly-for="4">
			<i class="fa fa-gitlab" aria-hidden="true"></i>
		</div>
		<div aly-for="5">
			<i class="fa fa-hand-o-right" aria-hidden="true"></i><i class="fa fa-hand-o-left" aria-hidden="true"></i>
		</div>
	</div>
	<div id="corpos">
		<div aly-id="1">
			Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla euismod pulvinar ipsum. Quisque malesuada sapien bibendum, consequat urna in, facilisis nibh. In gravida non eros non dignissim. Nam iaculis scelerisque aliquet. Nulla eu ligula a velit tincidunt aliquam varius sit amet mauris. Nam a ligula a ex egestas imperdiet. In ac velit in arcu ornare sollicitudin eu eget orci. Suspendisse mollis massa eget purus placerat pretium. Cras ac maximus velit, in semper quam. Integer nec mollis metus. Sed quis malesuada enim. Morbi felis tortor, gravida eu odio quis, consectetur tempor nulla. Sed ac efficitur diam. Suspendisse at elit finibus justo posuere semper nec a ex. Aliquam suscipit libero nec lacus dignissim imperdiet.
		</div>
		<div aly-id="2">
			Aliquam porta magna eget lacus malesuada, vitae scelerisque dolor maximus. Nam sed tincidunt urna. Sed elit tortor, interdum a rhoncus ut, maximus in tellus. Nunc cursus enim lectus, quis fermentum diam sodales eu. Sed ultricies leo convallis diam pulvinar condimentum. Mauris elementum diam ac lectus viverra, ut aliquet ex vulputate. Maecenas et lorem nibh. Nullam a enim turpis.
		</div>
		<div aly-id="3">
			In gravida tellus vel faucibus viverra. Aliquam turpis ipsum, egestas at tortor et, condimentum porttitor nisl. Proin sagittis leo at fringilla dictum. Nulla lobortis vitae orci ut tempus. In cursus ut ante eu porta. Maecenas vitae venenatis mauris, in hendrerit tortor. Nulla vitae tristique purus. In mollis arcu sem, quis porttitor ipsum iaculis at. Maecenas a felis eget tortor sodales iaculis. Sed tristique imperdiet rutrum. Cras laoreet est id turpis eleifend vestibulum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;
		</div>
		<div aly-id="4">
			Curabitur dictum nibh vel iaculis luctus. Vivamus id dictum mauris. Donec eu efficitur ligula. In efficitur non leo eget vestibulum. Nulla eget turpis tincidunt dolor fermentum finibus. Nulla id lacus in felis rutrum venenatis. Aliquam vulputate nunc non justo facilisis, quis blandit diam pellentesque. Phasellus molestie massa diam. Curabitur convallis, velit ut ornare pretium, libero nulla egestas sem, eu ullamcorper erat metus vitae ligula. Praesent finibus euismod odio, vel euismod nisi. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Quisque molestie massa justo. Nam auctor euismod dui pretium aliquet. Maecenas ac eros nunc. Fusce sit amet purus nisl.
		</div>
		<div aly-id="5">
			Aliquam lobortis velit et pharetra tempus. Etiam ac augue sed est tincidunt molestie ut in elit. Cras ac massa non massa fringilla dignissim. Duis libero nunc, consequat vel eros sed, sagittis faucibus justo. Phasellus ligula turpis, sodales commodo dictum nec, commodo et metus. Nunc sit amet ante posuere, scelerisque mi ac, dapibus turpis. Pellentesque posuere velit nunc, id dignissim purus vulputate ut. Suspendisse rhoncus quam aliquam elit fringilla vulputate. Vestibulum vel maximus nunc. Nulla ac tortor consectetur, pulvinar leo eu, suscipit dui. Aenean molestie urna sit amet est cursus, eget consectetur quam facilisis. Vestibulum malesuada, massa eu sodales ultrices, diam augue ullamcorper justo, eu viverra erat purus eu sem. In convallis nulla sem, sit amet euismod lectus lacinia vel. Nullam sed magna in mi imperdiet pulvinar imperdiet quis turpis. Vivamus placerat tellus elit, at tincidunt dolor sodales at. Maecenas maximus ante eu quam fermentum, ac mollis dui pretium.
		</div>
	</div>
</div>
            
          
!
            
              body {
	background: #1482ad;
}
#conteinter {
	width: 300px;
	background: white;
	margin: 0 auto;
	box-shadow: rgba(0,0,0,.4) 2px 2px 16px 2px;
  background-color: rgb(245,245,245);
}
#conteinter * {
  margin: 0;
  padding: 0;
  border: 0;
  box-sizing: border-box;
}
#conteinter #abas {
  width: 100%;
  background-color: rgb(240,240,240);
  /*height: calc(2em + 10px);*/
  white-space: nowrap;
  overflow-x: auto;
  display: inline-flex;
}
#conteinter #abas div {
  min-width: 20px;
  cursor: pointer;
  background-color: rgb(235,235,235);
  color: rgba(100,100,100,.6);
  background-image: linear-gradient(rgba(215,215,215,.8) calc(100% - 5px), #0f6080 calc(100% - 5px));
  /*background-size: 100% 5px;*/
  background-position: 0 100%;
  background-repeat: no-repeat;
  padding: .5em;
  /*-webkit-background-clip: text;*/
  /*-webkit-text-fill-color: transparent;*/
  transition: background-color .4s;
}
#conteinter #abas div:hover {
  background-color: rgb(185,185,185);
}
#conteinter #corpos {
  cursor: default;
  border-top: 1px solid rgb(255,255,255);
  height: 300px;
  white-space: nowrap;
  overflow: hidden;
}
#conteinter #corpos:not([aly-moving]) * {
  transition: .4s;
}
@keyframes example {
  0%   {background-color:red; left:0px}
  50%  {background-color:blue; left:-1200px;}
  100% {background-color:red; left:0px;}
}
#conteinter #corpos div {
  /*animation-name: example;*/
  animation-duration: 4s;
  animation-iteration-count: infinite;
  left: 0;
  position: relative;
  display: inline-block;
  white-space: normal;
  vertical-align: top;
  overflow-y: auto;
  max-height: 100%;
  padding: 5px;
}
            
          
!
            
              var conteiner = document.querySelector("div#conteinter");
var removeSpaces = conteiner.innerHTML;
conteiner.innerHTML = removeSpaces.replace(/\>[\s]+\</g, "><" );

var abas = document.querySelectorAll("div#abas div[aly-for]");
var corpo = document.querySelector("div#corpos");
var corpos = document.querySelectorAll("div#corpos div[aly-id]");

for (var i = 0; i < abas.length; i++) {
	abas[i].addEventListener("click", function(){
		for (var i = 0; i < corpos.length; i++)
			if (corpos[i].getAttribute("aly-id") == this.getAttribute("aly-for"))
				break;
		var theOffset = corpos[i].offsetLeft;

		for (var j = 0; j < corpos.length; j++) {
			var newLeft = i*-corpo.offsetWidth;
			corpos[j].style.left = (Math.round(newLeft / corpos[j].offsetWidth) * corpos[j].offsetWidth)+"px";
		}
	});
}

var acompanhe = false;
var firstPosition;

corpo.addEventListener("mousedown", alyStart);
corpo.addEventListener("touchstart", alyStart);

function alyStart() {
	corpo.setAttribute("aly-moving", true);
	acompanhe = true;
	firstPosition = null;
}

document.querySelector("body").addEventListener("mouseup", alyEnd);
document.querySelector("body").addEventListener("touchend", alyEnd);

function alyEnd() {
	corpo.removeAttribute("aly-moving");
	acompanhe = false;
	firstPosition = null;
	for (var i = 0; i < corpos.length; i++) {
		var stopedLeft = Number(corpos[i].style.left.replace("px", ""));
		var correctLeft = Math.round(stopedLeft / corpos[i].offsetWidth) * corpos[i].offsetWidth;
		corpos[i].style.left = correctLeft+"px";
	}
}

document.querySelector("body").addEventListener("mousemove", function(){
	event.preventDefault();
	alyMove(event);
});
document.querySelector("body").addEventListener("touchmove", function(){
	alyMove(event.changedTouches[0]);
});

function alyMove(event) {
	if (acompanhe) {
		if (firstPosition == null)
			firstPosition = event.clientX;
		var moved = event.clientX - firstPosition;
		firstPosition = event.clientX;
		for (var i = 0; i < corpos.length; i++) {
			var oldLeft = Number(corpos[i].style.left.replace("px", ""));
			corpos[i].style.left = (oldLeft + moved)+"px";

			if (Number(corpos[i].style.left.replace("px", "")) > 0)
				corpos[i].style.left = 0+"px";
			else if (Number(corpos[i].style.left.replace("px", "")) < -((corpos.length - 1) * corpos[i].offsetWidth))
				corpos[i].style.left = -((corpos.length - 1) * corpos[i].offsetWidth)+"px";
		}
	}
}

var alyTimer = setInterval(function(){
	for (var i = 0; i < abas.length; i++) {
		var corpoOffset;
		for (var j = 0; j < corpos.length; j++)
			if (corpos[j].getAttribute("aly-id") == abas[i].getAttribute("aly-for"))
				corpoOffset = (corpos[j].offsetLeft - corpo.offsetLeft) / corpo.offsetWidth;
		abas[i].style.backgroundPositionX = (abas[i].offsetWidth * -corpoOffset)+"px";
	}
}, 1);
            
          
!
999px
Loading ..................

Console