JSFiddle - React, Tailwind, and code Playground
by saidulu401
HTML
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,300italic,400italic,700italic"></script>
<!-- Navigation -->
<nav class="navbar navbar-custom navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-main-collapse">
Menu <i class="fa fa-bars"></i>
</button>
<a class="navbar-brand page-scroll" href="#top">
<span class="light">Company</span> Logo
</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-right navbar-main-collapse">
<ul class="nav navbar-nav">
<!-- Hidden li included to remove active class from about link when scrolled up past about section -->
<li class="hidden">
<a href="#top"></a>
</li>
<li>
<a class="page-scroll" href="#about">About</a>
</li>
<li>
<a class="page-scroll" href="#services">Services</a>
</li>
<li>
<a class="page-scroll" href="#portfolio">Portfolio</a>
</li>
<li>
<a class="page-scroll" href="#contact">Contact</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
...
CSS
html,
body {
width: 100%;
height: 100%;
}
body {
font-family: "Source Sans Pro","Helvetica Neue",Helvetica,Arial,sans-serif;
}
.navbar-custom {
margin-bottom: 0;
border-bottom: 1px solid rgba(255, 255, 255, 0.3);
text-transform: uppercase;
font-family: "Montserrat", "Helvetica Neue", Helvetica, Arial, sans-serif;
background-color: #192c3a;
}
.navbar-custom .navbar-toggle {
color: white;
background-color: rgba(255, 255, 255, 0.2);
font-size: 12px;
}
.navbar-custom .navbar-toggle:focus,
.navbar-custom .navbar-toggle:active {
outline: none;
}
.navbar-custom .navbar-brand {
font-weight: 700;
}
.navbar-custom .navbar-brand:focus {
outline: none;
}
.navbar-custom a {
color: white;
}
.navbar-custom .nav li a {
-webkit-transition: background 0.3s ease-in-out;
-moz-transition: background 0.3s ease-in-out;
transition: background 0.3s ease-in-out;
}
.navbar-custom .nav li a:hover {
color: rgba(255, 255, 255, 0.8);
outline: none;
background-color: transparent;
}
.navbar-custom .nav li a:focus,
.navbar-custom .nav li a:active {
outline: none;
background-color: transparent;
}
.navbar-custom .nav li.active {
outline: none;
}
.navbar-custom .nav li.active a {
background-color: rgba(255, 255, 255, 0.3);
}
.navbar-custom .nav li.active a:hover {
color: white;
}
@media (min-width: 768px) {
.navbar-custom {
padding: 20px 0;
border-bottom: none;
letter-spacing: 1px;
background: transparent;
-webkit-transition: background 0.5s ease-in-out, padding 0.5s ease-in-out;
-moz-transition: background 0.5s ease-in-out, padding 0.5s ease-in-out;
transition: background 0.5s ease-in-out, padding 0.5s ease-in-out;
}
.navbar-custom.top-nav-collapse {
padding: 0;
background: #192c3a;
border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}
}
.text-vertical-center {
display: table-cell;
text-align: center;
vertical-align: middle;
}
.intro{
background:...
JavaScript
// Closes the sidebar menu
/* $("#menu-close").click(function(e) {
e.preventDefault();
$("#sidebar-wrapper").toggleClass("active");
}); */
// Opens the sidebar menu
/*$("#menu-toggle").click(function(e) {
e.preventDefault();
$("#sidebar-wrapper").toggleClass("active");
});*/
// jQuery to collapse the navbar on scroll
function collapseNavbar() {
if ($(".navbar").offset().top > 50) {
$(".navbar-fixed-top").addClass("top-nav-collapse");
} else {
$(".navbar-fixed-top").removeClass("top-nav-collapse");
}
}
$(window).scroll(collapseNavbar);
$(document).ready(collapseNavbar);
$(function() {
$(".navbar-collapse .navbar-nav a").click(function(e) {
console.log(1)
e.preventDefault();
//$(".navbar-collapse").removeClass("in");
$('.navbar-toggle').click()
});
// Scrolls to the selected menu item on the page
$('a[href*=#]:not([href=#],[data-toggle],[data-target],[data-slide])').click(function() {
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') || location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
}
});
});
//#to-top button appears after scrolling
var fixed = false;
$(document).scroll(function() {
if ($(this).scrollTop() > 250) {
if (!fixed) {
fixed = true;
// $('#to-top').css({position:'fixed', display:'block'});
$('#to-top').show("slow", function() {
$('#to-top').css({
position: 'fixed',
...