cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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 class="links">
	<p class="home" >Logo</p>
	<ul>
		<li><a href="#">Link 1</a></li>
		<li><a href="#">Link 2</a></li>
		<li><a href="#">Link 3</a></li>
		<li><a href="#">Link 4</a></li>
		<li><a href="#">Link 5</a></li>
		<li class="last"><a href="#"  >Link Thing</a></li>
		<li><div class="triangle"></div></li>
	</ul>	
</div>	
            
          
!
            
              *
	box-sizing: border-box

body
	font-family: 'Oxygen', sans-serif

.links
	width: 100%
	position: fixed
	top: 0
	left: 0
	background: #197BBD
	display: flex
	padding: 0 20px
	height: 70px
	align-items: center
	justify-content: space-between
	color: white
	ul
		list-style: none
		padding: 0
		position: relative
		li
			display: inline-block
			padding: 0 15px
			text-align: center
			&.last,
			&:last-child
				padding-right: 0
			.triangle
				width: 25px
				height: 25px
				background: #197BBD
				transform: rotate(45deg)
				position: absolute
				left: 0
				top: 30px
				z-index: -1
			a
				color: white
				text-decoration: none
            
          
!
            
              $(document).ready(function(){
	var ulOffsetLeft = $(".links ul").offset().left;
	var OffsetFromLeft = $(".links ul li").first().find("a").offset().left - ulOffsetLeft;
	var firstWidthCenter = $(".links ul li").first().find("a").width() / 2  - 12.5 + OffsetFromLeft;
	$(".triangle").animate({"left": firstWidthCenter }, 350);
	
	$(document).on('click', '.home', function(){
		var ulOffsetLeft = $(".links ul").offset().left;
		var OffsetFromLeft = $(".links ul li").first().find("a").offset().left - ulOffsetLeft;
		var firstWidthCenter = $(".links ul li").first().find("a").width() / 2  - 12.5 + OffsetFromLeft;
		$(".triangle").animate({"left": firstWidthCenter }, 350);
	});
	
	$(document).on('click', ".links ul li a", function(e){
		var ulOffsetLeft = $(".links ul").offset().left;
		var OffsetFromLeft = $(e.target).offset().left - ulOffsetLeft;
		var triangleTarget = $(e.target).width() / 2 - 12.5  + OffsetFromLeft;
		$(".triangle").animate({"left": triangleTarget }, 350)
		
	});
});
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console