Sticky menu
How do I make an sticky menu?
What is a sticky menu? How do you make a sticky menu? This script and codes were developed by Mori on 26 October 2022, Wednesday.
Sticky menu - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>sticky menu</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div style="height:1000px"> <ul id="oe_menu" class="oe_menu "> <li><a href="javascript: void(0)">a</a> <!--目前在該分類時要加上 class:sticky-menu--> <div class="sticky-menu"> <!--目前在該分類時要加上 h3 sticky title--> <h3 class="sticky-title">sticky-title</h3> <a href="product.php">1</a> <a href="product.php">2</a> <a href="product.php">3</a> <a href="product.php">4</a> </div> </li> <li><a href="javascript: void(0)">b</a> <div> <a href="ic.php">1</a> <a href="repair-services.php">2</a> </div> </li> <li><a href="javascript: void(0)">c</a> <div> <a href="vision.php">1 </a> <a href="company.php">2 </a> <a href="csr-company.php">3 </a> </div> </li> <li><a href="javascript: void(0)">d</a> <div> <a href="governance.php">1 </a> <a href="financials.php">2 </a> <a href="shareholder-meeting.php">3 </a> </div> </li> <li><a href="javascript: void(0)">e</a> <div> <a href="news.php">1</a> <a href="news.php">2</a> </div> </li> </ul> </div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Sticky menu - Script Codes CSS Codes
ul.oe_menu { float: right;
}
ul.oe_menu:after { content: ''; display: block; clear: both;
}
ul.oe_menu > li { display: inline-block; /* position: relative;*/ /* down */
}
ul.oe_menu > li > a { display: block; position: relative; font-size: 16px; padding: 10px 22px 20px 22px; text-align: center; cursor: pointer; height: 30px; color: #000;
}
ul.oe_menu > li > a:after { display: none; content: ""; width: 20px; height: 15px; z-index: 99999; position: absolute; bottom: 5px; left: 40%; background: url(../images/arrow-menu.png) no-repeat;
}
ul.oe_menu > li > a:hover,
ul.oe_menu > li > a .selected > a { color: #003380;
}
ul.oe_menu > li.arrow > a:after { display: block; z-index: 99999;
}
ul.oe_menu > li > div { position: absolute; top: 106px; left: 0px; background: #00669c !important; width: 100%; display: none; padding: 20px 0; z-index: 9998; text-align: center;
}
ul.oe_menu > li > div > a { display: inline-block; color: #fff; width: 200px; padding: 10px 0px; /**/
}
ul.oe_menu > li > div > a:hover { color: #cccccc;
}
ul.oe_menu > li > div img { width: 100%;
}
.oe_wrapper ul.hovered > li > a { background: #fff;
}
/* ------------------------------------- sticky sub menu
------------------------------------- */
.sticky-menu { display: block; width: 100%; min-width: 1000px; margin: 0 auto; z-index: 9999;
}
.sticky-title { color: #fff; position: absolute; left: 7%; top: 22%;
}
.oe_menu .sticky { position: fixed; left: 0; top: 0; z-index: 99999; display: block;
}
Sticky menu - Script Codes JS Codes
//sticky-menu
var flowSub = $(".sticky-menu");
//>280 f5初始不可見
$(".sticky-title").hide();
$(window).scroll(function () {
if ($(this).scrollTop() > 280) {
flowSub.addClass('sticky');
//h2可見
$(".sticky-title").show();
//menu內容可見
$(".sticky").show();
} else {
flowSub.removeClass('sticky');
$(".sticky-title").hide();
$(".sticky").hide();
/*scroll to top hide*/
$oe_menu.children('li').not('.slided').children('div').hide();
}
});
Developer | Mori |
Username | moriko232 |
Uploaded | October 26, 2022 |
Rating | 3 |
Size | 3,297 Kb |
Views | 26,312 |
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 |
Hover menu | 3,040 Kb |
Scroll and change numbers | 2,249 Kb |
Animate hover effect for products | 3,137 Kb |
Tab menu style | 3,615 Kb |
Hover line effect | 2,439 Kb |
Menu item hover line effect | 2,998 Kb |
PACE loadding effect | 2,164 Kb |
FadeToggle | 1,467 Kb |
Auto zoom in background | 1,994 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 |
Knob rotation | Alemesre | 2,122 Kb |
Haml Calendar | Katydecorah | 5,643 Kb |
Sencha Touch 2.3.1 Basic Grid Example | Trozdol | 2,770 Kb |
Sort the Knowlege | Eprouver | 3,915 Kb |
Scifi-style Radio-based Tab | Aaronchuo | 4,427 Kb |
A Pen by Alex Edwards | Exards | 8,218 Kb |
Pure CSS Torch Light | Juliendargelos | 2,727 Kb |
Sign Up Form | Sicontis | 5,272 Kb |
Wip elementary os navbar | Nickcolley | 2,993 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!