Single page website
How do I make an single page website?
Just want to show to create effect similar to http://www.bus-project.info/ with GSAP. What is a single page website? How do you make a single page website? This script and codes were developed by Chrysto on 16 July 2022, Saturday.
Single page website - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Single page website</title> <script src="http://s.codepen.io/assets/libs/modernizr.js" type="text/javascript"></script> <link rel="stylesheet" href="css/style.css">
</head>
<body> <ul class="menu"> <li class="to-home"><a href="#">Home</a></li> <li><a href="#about">About cats</a></li> <li><a href="#gallery">Gallery</a></li> <li><a href="#links">Links</a></li> <li><a href="#contacts">Contacts</a></li> </ul> <div id="about" class="page"> <div class="page-content"> <h2>About cats</h2> <p>Cats are cute</p> </div> </div> <div id="gallery" class="page"> <div class="page-content"> <h2>Gallery</h2> <p>Gallery with cats</p> </div> </div> <div id="links" class="page"> <div class="page-content"> <h2>Links</h2> <p>Links to blogs with cats</p> </div> </div> <div id="contacts" class="page"> <div class="page-content"> <h2>Contacts</h2> <p>Some contact form</p> </div> </div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/TweenMax.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Single page website - Script Codes CSS Codes
body,div,p { margin:0; padding:0; font-family:Helvetica,sans-serif; font-size:18px;
}
html { background:url("http://ivayloyovchev.com/pulsepro/data/img/gallery/wedding/IMG_3312.jpg") no-repeat center center fixed; -webkit-background-size:cover; -moz-background-size:cover; -o-background-size:cover; background-size:cover;
}
.menu { position:fixed; top:10%; left:-40px; z-index:100;
}
.menu li { list-style:none; display:block; margin-bottom:5px; margin-left:0; padding:20px; background-color:rgba(0,0,0,0.7); -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box; text-align:center; width:140px; cursor:pointer;
}
.menu li.active { background-color:rgba(91,193,177,.75); cursor:default;
}
.menu li a { text-decoration:none; color:#fff;
}
.page { position:relative; background-color:rgba(0,0,0,0.7); width:70%; height:100%; position:fixed; left:-70%; overflow:hidden; z-index:10;
}
.page-content { position:absolute; width:55%; height:80%; top:10%; right:15%; color:#fff; overflow:auto;
}
Single page website - Script Codes JS Codes
$(function() {
//Image by Ivaylo Yovchev ( http://ivayloyovchev.com/weddings ) //elements var $menu = $(".menu"); var $pages = $(".page"); var $menuLi = $menu.find("li").not(".to-home"); var $toHome = $menu.find(".to-home"); //interna vars var currentPage = ""; $toHome.on("click", function() { currentPage = ""; TweenMax.to($pages, 0.5, { left: "-70%" }); TweenLite.to($menuLi.filter(".active"), 0.5, { className: "-=active" }); }); $menuLi.on("click", function(event) { var $this = $(this); var thisHref = $this.find("a").attr("href"); if (currentPage !== thisHref && $pages.filter(thisHref).length > 0) { currentPage = thisHref; TweenMax.to($pages, 0.5, { left: "-70%" }); TweenMax.to($pages.filter(thisHref), 0.5, { left: 0 }); TweenLite.to($menuLi.filter(".active"), 0.5, { className: "-=active" }); TweenLite.to($this, 0.5, { className: "+=active" }); } event.preventDefault(); });
});
Developer | Chrysto |
Username | bassta |
Uploaded | July 16, 2022 |
Rating | 4 |
Size | 2,688 Kb |
Views | 44,528 |
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 |
Simple one page header concept | 2,530 Kb |
A Pen by Chrysto | 2,057 Kb |
Page Header animation | 2,828 Kb |
Lastik menu | 2,257 Kb |
GSAP Parallax | 2,513 Kb |
GIF-like animation with single image | 1,807 Kb |
Footer concept | 2,210 Kb |
Fullscreen Parallax | 3,313 Kb |
TweenLite staggerTo | 2,495 Kb |
One page website scrolling effect | 2,764 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 |
Electric worm | Jeffibacache | 2,377 Kb |
Sticky Navbar | Phantomesse | 5,106 Kb |
Sass Get Function | Lukewatts | 2,155 Kb |
Button shaking | SusanneLundblad | 2,227 Kb |
Draggable directive | YahyaKacem | 2,277 Kb |
Subtle site navigation with description | Necks | 3,206 Kb |
SnappySnippet Test | Elmsoftware | 8,385 Kb |
JS Beispiel getElementsByClassName 3 | HSZG-Frontend-Kurs | 1,988 Kb |
Spin | Elalemanyo | 8,262 Kb |
Addthis_button | Esambino | 1,691 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!