How To Create Menu Slider
Submitted by alpha_luna on Saturday, April 9, 2016 - 12:12.
In this tutorial, we are going to learn on How To Create Menu Slider. This script is used to change the menu when your cursor will hover to the link menu list. It will show the menu list and its corresponding image screen shot immediately.
In this code below, we used jQuery script function to have this effect. And, the image screen shot has corresponding links.
So what can you say about this work? Share your thoughts in the comment section below or email me at [email protected]. Practice Coding. Hope you find this tutorial useful. Thank you.
HTML
This is the HTML code where the menu list and the link image screen shot found and you can edit after you download the source code. And put anything that you want.- <div id="example_menu">
- </div>
- <div id="example_slider">
- <a href="http://www.sourcecodester.com/php/10181/simple-shopping-cart-application-php-mysql.html">
- <img id="shopping-images" src="image/4.png">
- </a>
- <a href="http://www.sourcecodester.com/tutorials/htmlcss/10188/css-geometric-shapes.html">
- <img id="geometric-images" src="image/1.png">
- </a>
- <a href="http://www.sourcecodester.com/tutorials/javascript/10186/how-create-login-form-using-javascript-part-ii.html">
- <img id="login-ii-images" src="image/2.png">
- </a>
- <a href="http://www.sourcecodester.com/tutorials/php/10185/php-include-files.html">
- <img id="include-images" src="image/3.png">
- </a>
- <a href="http://www.sourcecodester.com/tutorials/javascript/10179/how-create-password-protect-using-javascript.html">
- <img id="create-images" src="image/6.png">
- </a>
- <a href="http://www.sourcecodester.com/node/10180">
- <img id="login-images" src="image/5.png">
- </a>
- </div>
CSS
This is our CSS style.- <style type="text/css">
- #example_menu {
- width: 150px;
- float: left;
- }
- #example_menu .example_title_menu {
- display: block;
- line-height: 35px;
- padding: 0px 10px;
- background: skyblue;
- margin-bottom:1px;
- color: #fff;
- cursor:pointer;
- }
- #example_menu .example_title_menu:hover {
- display: block;
- line-height: 35px;
- padding: 0px 10px;
- background: blue;
- margin-bottom:1px;
- color: #000;
- cursor:pointer;
- font-size:15px;
- font-weight:bold;
- }
- #example_menu .example_title_menu.active:after {
- content: "";
- border-color: transparent transparent transparent blue;
- border-style: solid;
- border-width: 18px;
- width: 0;
- height: 0;
- position: absolute;
- right: -50px;
- left: 158px;
- }
- #example_slider {
- height: 215px;
- width: 400px;
- border: red 3px solid;
- left: 180px;
- position: absolute;
- padding: 8px;
- }
- #example_slider img {
- display:none;
- position:absolute;
- }
- </style>
jQuery Script
This script happens if your cursor will hover to the menu list, then, the image will respond immediately from right to left for the slide effect.- <script type="text/JavaScript">
- $(document).ready(function() {
- $("#example_slider img").first().show();
- $("#example_menu .example_title_menu").hover(
- function(){
- $('#example_menu .example_title_menu').removeClass('active');
- $(this).addClass('active');
- var menu_title = $(this).attr('id');
- $("#example_slider img").hide();
- $("#"+menu_title+"-images").show("slide",{direction:'right'},500);
- },
- function(){}
- );
- });
- </script>
Add new comment
- 81 views