Home > Web Front-end > JS Tutorial > body text

JS implements navigation bar hover effect (continued 2)_javascript skills

WBOY
Release: 2016-05-16 17:21:31
Original
1168 people have browsed it

[JS-implement navigation bar hover]
[JS-implement navigation bar hover (continued)]

After rewriting this page with Jquery , found that the original method still has several problems:

1. First of all, the Js code is redundant, and the Tab on the navigation bar uses js to implement jumps instead of hyperlinks;

2 .Also the navigation bar itself is positioned with fixed, but it is not set to be horizontally centered. Instead, the left value is changed in JS to center it.

Problem 2 results in that when the size of the browser window changes, the position of the div in the browser changes, which results in the inability to dynamically fix the fixed div through the div in the page. Position the navigation bar to locate.

The final code changes are as follows:

test.html

Copy code The code is as follows:






Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!