Home >
Article > Web Front-end > JQuery implements mouse scrolling to display navigation drop-down list_jquery
JQuery implements mouse scrolling to display navigation drop-down list_jquery
WBOYOriginal
2016-05-16 17:22:521042browse
When there are many items in the website navigation bar, we often hide the columns in the same level directory first. Displayed when the user's mouse rolls over. This is a navigation bar drop-down list implemented in javascript. The editor will explain it to you step by step. It is worth noting that we use Jquery, a framework of Javascript, to implement this. Therefore, you must download Jquery when using it.
$(document).ready(function (){ $('#ul').hide(); //Open the page to hide the drop-down list $('#it').hover( //When the mouse slides over the navigation column function(){ $('#ul').show(); //Show drop-down list $(this).css({'color':'red','background-color':'orange'}); //Set the navigation column style, eye-catching }, function(){ $('#ul').hide(); //Hide the drop-down list after the mouse is moved away } ); $('#ul').hover( //The drop-down list itself should also be displayed when the mouse slides over it to prevent the drop-down list from being clickable function(){ $('#ul') .show(); }, function(){ $('#ul').hide(); $('#it').css({'color': 'white','background-color':'black'}); //After the mouse moves away from the drop-down list, the style of the navigation bar is also cleared } ); $('li'). hover( //Mouse over the drop-down list to change the current column style function(){ $(this).css({'color':'red','background-color':'orange'} ); }, function(){ $(this).css({'color':'white','background-color':'black'}); } ); });
Due to the current problem of the website editor, it is not possible to upload pictures. If you don’t have pictures, you can test it locally first to see the effect.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn