


jquery implements how to automatically fix navigation that exceeds the display range to the top of the screen_jquery
In fact, it is not difficult to implement. Let's think about the implementation process in general. First, if the navigation is within the display range, there is no need to modify it. When the navigation exceeds the display range, that is, when the distance between the navigation and the top of the screen is less than 0, we need to let it float on the top of the screen, and then when it is greater than 0, perform a restoration operation. The principle is that simple. Take a rough look at the renderings. Bar
$().ready (function(){
//Navigation distance from the top of the screen
var _defautlTop = $("#navigator").offset().top - $(window).scrollTop();
//Navigation Distance from the left side of the screen
var _defautlLeft = $("#navigator").offset().left - $(window).scrollLeft();
//Navigation default style record, required when restoring the initial style
var _position = $("#navigator").css('position');
var _top = $("#navigator").css('top');
var _left = $(" #navigator").css('left');
var _zIndex = $("#navigator").css('z-index');
//Mouse scroll event
$(window) .scroll(function(){
if($(this).scrollTop() > _defautlTop){
//IE6 does not recognize position:fixed, use position:absolute alone to simulate
if($. browser.msie && $.browser.version=="6.0"){
$("#top").css({'position':'absolute','top':eval(document.documentElement.scrollTop) ,'left':_defautlLeft,'z-index':99999});
//Prevent jitter
$("html,body").css({'background-image':'url(about :blank)','background-attachment':'fixed'});
}else{
$("#navigator").css({'position':'fixed','top':0 ,'left':_defautlLeft,'z-index':99999});
}
}else{
$("#navigator").css({'position':_position,'top' :_top,'left':_left,'z-index':_zIndex});
}
});
});
Not much to say , one thing to note is that IE6 does not recognize position:fixed, so you need to use position:absolute to simulate it, and then calculate the value of top in real time. In addition, you need to add two styles to html and body to prevent jitter when scrolling. Specifically, you can Learn about "Perfect solution to the bug that IE6 does not support position:fixed".
Another thing to note is that the width of the navigation must be a fixed value. It cannot be auto or 100% because fixed and absolute are not recognized. Of course, you can also manually obtain the width of the navigation and then write it to float. In the navigation style, there is a premise. The original navigation style cannot have: position: relative. This may be the case. The simplest way is to set the navigation width.
The above code can be copied to the HTML footer code set in the background. If there is a problem with the floating navigation width, please refer to the solution I just did.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The football navigation voice package in the "Amap Navigation" software is one of the navigation voice packages for the car version of the Amap map. The content is the navigation voice of Huang Jianxiang's football commentary version. Setting method: 1. Open the Amap software; 2. Click to enter the "More Tools" - "Navigation Voice" option; 3. Find "Huang Jianxiang Passionate Voice" and click "Download"; 4. On the pop-up page, click " Just use voice".

Both Android and iOS versions of Baidu Map App have released version 18.8.0, which introduces the traffic light radar function for the first time, leading the industry. According to the official introduction, after turning on the traffic light radar, it supports automatic detection of traffic lights while driving without having to enter a destination. Beidou High-Precision can position in real time. , 1 million+ traffic lights across the country automatically trigger green wave reminders. In addition, the new function also provides full silent navigation, making the map area more concise, key information clear at a glance, and no voice broadcast, allowing the driver to focus more on driving. Baidu Maps will launch a traffic light countdown function in October 2020, supporting real-time countdown prediction. Judgment, the navigation will automatically display the remaining seconds of the countdown when approaching a traffic light intersection, allowing users to always grasp the road conditions ahead. Traffic light countdown to December 31, 2022

The horizontal figure 8 on the navigation map means haze, moderate is a yellow 8 warning signal, and severe is an orange 8 warning signal.

According to news from this site on April 29, Amap officially announced the launch of an upgraded version of driving ETA (Note from this site: ETA is the estimated time of arrival, which refers to the estimated time it will take for the user to depart from the current moment and follow a given route to the destination. ) service, which aims to help users make more accurate route planning duration and traffic condition estimates, and assist users in making travel decisions. This map application is the latest upgraded Amap App. It introduces the "ultra-large-scale graph convolutional neural network model", which can better capture and learn traffic flow patterns, support urban road networks and highway systems, and can Accurately depict the spatiotemporal dynamic changes of traffic conditions. In addition, the new version of the map further integrates the iTransformer time series prediction model to support real-time analysis.

How to implement page jumps and navigation in uniapp. uniapp is a front-end framework that supports one-time coding and multi-end publishing. It is based on Vue.js. Developers can use uniapp to quickly develop mobile applications. In uniapp, implementing page jumps and navigation is a very common requirement. This article will introduce how to implement page jump and navigation in uniapp, and provide specific code examples. 1. Page jump Use the methods provided by uniapp to jump the page. uniapp provides a set of methods for implementation.

How to implement image browsing and thumbnail navigation through Vue? With the development of web applications, pictures play an increasingly important role in our daily lives. In many cases, we need to implement image browsing and thumbnail navigation functions. This article will introduce how to use the Vue framework to implement this function and provide code examples. In Vue, we can use the Vue plug-in to implement image browsing and thumbnail navigation functions. A popular plugin is vue-gallery, which provides a simple and easy-to-use interface

Use PHP and XML to implement web page navigation and menus. Navigation and menus are common elements in web pages. They allow users to quickly find the information or functions they need. In web development, PHP and XML are often used to process and store navigation and menu data. This article will introduce how to use PHP and XML to implement web page navigation and menus, and provide relevant code examples. 1. Create an XML menu data file First, we need to create an XML file to store our menu data. The following is an example XML file that

Baidu Map is used by many friends when going out. It can provide the fastest route and can also check various different travel methods. If you want to set navigation screen constants, come to the PHP Chinese website to see what the editor brought Method. How to set the navigation screen to stay on on Baidu Map: 1. First click to open the Baidu Map APP on your mobile phone and then click [Personal Avatar] on the upper left corner of the page to open it. 2. After coming to the personal center page, find the [Settings] function and click on it to enter. 3. Next, click the [General Settings] item in the settings page to enter. 4. There is a [Screen Always On] function in the general settings page. There is a switch button displayed behind it. Click the circular slider to set the button to on.
