Navigation triangle
How do I make an navigation triangle?
What is a navigation triangle? How do you make a navigation triangle? This script and codes were developed by Samuel Janes on 14 September 2022, Wednesday.
Navigation triangle - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Navigation triangle</title> <link href="https://fonts.googleapis.com/css?family=Oxygen:300,400,700" rel="stylesheet"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <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> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.0/jquery-ui.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Navigation triangle - Script Codes CSS Codes
* { 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;
}
.links ul { list-style: none; padding: 0; position: relative;
}
.links ul li { display: inline-block; padding: 0 15px; text-align: center;
}
.links ul li.last, .links ul li:last-child { padding-right: 0;
}
.links ul li .triangle { width: 25px; height: 25px; background: #197BBD; transform: rotate(45deg); position: absolute; left: 0; top: 30px; z-index: -1;
}
.links ul li a { color: white; text-decoration: none;
}
Navigation triangle - Script Codes JS Codes
$(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) });
});
Developer | Samuel Janes |
Username | SamuelJanes |
Uploaded | September 14, 2022 |
Rating | 4 |
Size | 2,759 Kb |
Views | 24,288 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Material Ripple Effect on Button | 2,972 Kb |
Navigation layout | 3,069 Kb |
Clipped Navigation | 2,966 Kb |
Bottom Right Menu | 2,426 Kb |
Responsive Carousel Slider with Jquery | 3,456 Kb |
Queens of the Stone Age Rated R Album Cover in CSS | 2,958 Kb |
CSS only tooltips | 3,273 Kb |
Modest Mouse Night on the Sun in CSS | 3,042 Kb |
Hamburger Menus | 2,520 Kb |
New Portfolio Idea | 8,720 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Out of the blue | Giaco | 2,537 Kb |
Portfolio Page | HuffmanJ25 | 5,240 Kb |
CSS- UI Element States Pseudo-Classes | Tesla809 | 2,206 Kb |
RAQuote | Naderk007 | 4,412 Kb |
Myprofile | SoufianeAbid | 2,451 Kb |
Shape Outside - Polygon | Stacy | 3,954 Kb |
Static Image to Video Block | Grayghostvisuals | 4,864 Kb |
Review test | Otro_user_gil | 4,054 Kb |
Starting out with Ember.JS | Cfleschhut | 4,808 Kb |
Nested flexbox layout for library catalog | Boycetrus | 3,271 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!