JSFiddle - React, Tailwind, and code Playground
by Juan Muñoz
HTML
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css">
<header class="cd-header">
<div class="header-wrapper">
<div class="logo-wrap">
<a href="#" class="hover-target"><span>your</span>logo</a>
</div>
<div class="nav-but-wrap">
<div class="menu-icon hover-target">
<span class="menu-icon__line menu-icon__line-left"></span>
<span class="menu-icon__line"></span>
<span class="menu-icon__line menu-icon__line-right"></span>
</div>
</div>
</div>
</header>
<div class="nav">
<div class="nav__content">
<ul class="nav__list">
<li class="nav__list-item active-nav"><a href="#" class="hover-target">home</a></li>
<li class="nav__list-item"><a href="#" class="hover-target">studio</a></li>
<li class="nav__list-item"><a href="#" class="hover-target">news</a></li>
<li class="nav__list-item"><a href="#" class="hover-target">contact</a></li>
</ul>
</div>
</div>
https://codepen.io/ig_design/pen/VgaXaY?editors=1100
<div class="section full-height over-hide">
<div class="switch-wrap">
<h1>overlay menu</h1>
<div id="switch" class="hover-target">
<div id="circle"></div>
</div>
<p><span>dark</span> - <span>light</span></p>
</div>
</div>
<div class='cursor' id="cursor"></div>
<div class='cursor2' id="cursor2"></div>
<div class='cursor3' id="cursor3"></div>
<!-- Link to page
================================================== -->
<a href="https://themeforest.net/user/ig_design/portfolio" class="link-to-portfolio hover-target" target=”_blank”></a>
CSS
/* Please ❤ this if you like it! */
@import url('https://fonts.googleapis.com/css?family=Montserrat:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i');
body{
font-family: 'Montserrat', sans-serif;
font-weight: 300;
font-size: 15px;
line-height: 1.7;
color: #c4c3ca;
background-color: #1f2029;
overflow-x: hidden;
-webkit-transition: all 300ms linear;
transition: all 300ms linear;
}
a {
cursor: pointer;
}
a:hover {
text-decoration: none;
}
/* #Cursor
================================================== */
.cursor,
.cursor2,
.cursor3{
position: fixed;
border-radius: 50%;
transform: translateX(-50%) translateY(-50%);
pointer-events: none;
left: -100px;
top: 50%;
mix-blend-mode: difference;
-webkit-transition: all 300ms linear;
transition: all 300ms linear;
}
.cursor{
background-color: #fff;
height: 0;
width: 0;
z-index: 99999;
}
.cursor2,.cursor3{
height: 36px;
width: 36px;
z-index:99998;
-webkit-transition:all 0.3s ease-out;
transition:all 0.3s ease-out
}
.cursor2.hover,
.cursor3.hover{
-webkit-transform:scale(2) translateX(-25%) translateY(-25%);
transform:scale(2) translateX(-25%) translateY(-25%);
border:none
}
.cursor2{
border: 2px solid #fff;
box-shadow: 0 0 22px rgba(255, 255, 255, 0.6);
}
.cursor2.hover{
background: rgba(255,255,255,1);
box-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
}
@media screen and (max-width: 1200px){
.cursor,.cursor2,.cursor3{
display: none
}
}
/* #Primary style
================================================== */
.section {
position: relative;
width: 100%;
display: block;
}
.over-hide{
overflow: hidden;
}
.full-height {
height: 100vh;
}
/* #Navigation
================================================== */
.cd-header{
position: fixed;
width:100%;
top:0;
left:0;
z-index:100;
}
.header-wrapper{
position: relative;
width: calc(100% - 100px);
margin-left: 50px;
}
.logo-wrap {
position: absolute;
display:block;
left:0;
top:...
JavaScript
/* Please ❤ this if you like it! */
(function($) { "use strict";
//Page cursors
document.getElementsByTagName("body")[0].addEventListener("mousemove", function(n) {
t.style.left = n.clientX + "px",
t.style.top = n.clientY + "px",
e.style.left = n.clientX + "px",
e.style.top = n.clientY + "px",
i.style.left = n.clientX + "px",
i.style.top = n.clientY + "px"
});
var t = document.getElementById("cursor"),
e = document.getElementById("cursor2"),
i = document.getElementById("cursor3");
function n(t) {
e.classList.add("hover"), i.classList.add("hover")
}
function s(t) {
e.classList.remove("hover"), i.classList.remove("hover")
}
s();
for (var r = document.querySelectorAll(".hover-target"), a = r.length - 1; a >= 0; a--) {
o(r[a])
}
function o(t) {
t.addEventListener("mouseover", n), t.addEventListener("mouseout", s)
}
//Navigation
var app = function () {
var body = undefined;
var menu = undefined;
var menuItems = undefined;
var init = function init() {
body = document.querySelector('body');
menu = document.querySelector('.menu-icon');
menuItems = document.querySelectorAll('.nav__list-item');
applyListeners();
};
var applyListeners = function applyListeners() {
menu.addEventListener('click', function () {
return toggleClass(body, 'nav-active');
});
};
var toggleClass = function toggleClass(element, stringClass) {
if (element.classList.contains(stringClass)) element.classList.remove(stringClass);else element.classList.add(stringClass);
};
init();
}();
//Switch light/dark
$("#switch").on('click', function () {
if ($("body").hasClass("light")) {
$("body").removeClass("light");
$("#switch").removeClass("switched");
}
else {
$("body").addClass("light");
$("#switch").addClass("switched");
}
});
})(jQuery);