Slide to Navigation
How do I make an slide to navigation?
Slide up/down based on DOM order. What is a slide to navigation? How do you make a slide to navigation? This script and codes were developed by Jakob-e on 04 July 2022, Monday.
Slide to Navigation - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Slide to Navigation</title> <script src="http://s.codepen.io/assets/libs/modernizr.js" type="text/javascript"></script> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<article> <section id="a"> <h2>A</h2> <a href="#a">Go to A</a> <a href="#b">Go to B</a> <a href="#c">Go to C</a> <a href="#d">Go to D</a> </section> <section id="b"> <h2>B</h2> <a href="#a">Go to A</a> <a href="#b">Go to B</a> <a href="#c">Go to C</a> <a href="#d">Go to D</a> </section> <section id="c"> <h2>C</h2> <a href="#a">Go to A</a> <a href="#b">Go to B</a> <a href="#c">Go to C</a> <a href="#d">Go to D</a> </section> <section id="d"> <h2>D</h2> <a href="#a">Go to A</a> <a href="#b">Go to B</a> <a href="#c">Go to C</a> <a href="#d">Go to D</a> </section>
</article> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Slide to Navigation - Script Codes CSS Codes
@import url(http://fonts.googleapis.com/css?family=Lato:100,300,400,italic300);
*, :before, :after { box-sizing: border-box; margin: 0; padding: 0;
}
html, body { height: 100%;
}
article { position: relative; display: block; width: 100%; height: 400px; overflow: hidden;
}
section { position: absolute; display: block; width: 100%; top: 400px; height: 400px; text-align: center;
}
#a { background: gold;
}
#b { background: magenta;
}
#c { background: olive;
}
#d { background: dodgerblue;
}
h2 { font: 300 4em/2 'Lato', sans-serif; color: #fff;
}
a { font: 300 1em/2 'Lato', sans-serif; color: #fff; display: inline-block; padding: 1em; text-decoration: none; border-radius: 4px; margin: .5em;
}
#a a { background: #e6c200;
}
#a a:hover { background: #f5ce00;
}
#b a { background: #e600e6;
}
#b a:hover { background: #f500f5;
}
#c a { background: #676700;
}
#c a:hover { background: #767600;
}
#d a { background: #0583ff;
}
#d a:hover { background: #148bff;
}
Slide to Navigation - Script Codes JS Codes
var zTop = 1;
$('a').on('click',function(e){ e.preventDefault(); // Animate up or down based on DOM index var index = $($(this).attr('href')).index(); var wh = $(window).height(); $('section').each(function(){ var $tgt = $(this); var idx = $tgt.index(); $tgt.removeClass(); if(index == idx){ $tgt.stop(true,true).animate({top:0},'linear').addClass('active').css({'z-index':zTop}); } if(index < idx) { $tgt.stop(true,true).animate({top:wh},'linear').addClass('below'); } if(index > idx ){ $tgt.stop(true,true).animate({top:-wh},'linear').addClass('above'); } }); zTop++;
})
// Trigger first section animation
$('a[href="#a"]').trigger('click');
// Set height
$(window).on('resize',function(){ var wh = $(window).height(); $('article, section').height(wh); $('.active').css({top:0}); $('.above').css({top:-wh}); $('.below').css({top:wh});
}).trigger('resize');
Developer | Jakob-e |
Username | jakob-e |
Uploaded | July 04, 2022 |
Rating | 4.5 |
Size | 3,063 Kb |
Views | 38,456 |
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 |
Profile Top | 8,420 Kb |
Snap to base-line | 4,943 Kb |
CSS Shapes | 14,064 Kb |
SVG Encoding | 3,280 Kb |
SVG Path Circle | 2,166 Kb |
Baseline, Scale and Element Queries | 8,635 Kb |
Encode SVG SCSS | 14,772 Kb |
Angular Range Filter | 3,968 Kb |
SCSS z-index | 7,745 Kb |
Navigation highlighting using waypoints.js | 6,689 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 |
Sencha Touch 2.3.1 Basic Grid Example | Trozdol | 2,770 Kb |
3D-box | Parthviroja | 2,346 Kb |
Arrow Navigation | Hinducows | 1,973 Kb |
Two Element Typeface | Chrisota | 4,942 Kb |
Gears | Synvox | 3,278 Kb |
Sample Profile Screen | OurDailyBread | 5,375 Kb |
Electric worm | Jeffibacache | 2,377 Kb |
CSS Bot Confusion | Jpod | 3,456 Kb |
Horizontal Navigation with Floats | Gymratpacks | 5,403 Kb |
CSS Donut Charts | Seanstopnik | 2,908 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!