5.JavaScript optimization and the secret behind the navigation menu

Source: Internet
Author: User

JavaScript optimization and the secret equipmengt behind the navigation menu

Learning Goals
1. Learn more about front-end optimization
Learn how to write good javascirpt
2. Learn how to use javascirpt through navigation
JavaScript plays a vital role in the implementation of user experience optimization
3. Front-end development related tools and means to understand
Learn about JavaScript development-related tools and techniques

Catalogue CONTENTS
1 review: HTML semantics, CSS Advanced
2 Writing high-efficiency JavaScript
3 Understanding the navigation menu and its development
4 Performance acceleration for navigation menus
5 Secrets of Cracked ox x navigation menu
5 JS debugging, compression, obfuscation and cracking


Chapter I: review: HTML semantics, CSS Advanced
1 HTML Semantics
① Web page principle
The pages that humans see are text and pictures, and computers see pages that are code
②html semantics
Some recruitment requirements: "A deep understanding of web standards ... "
③ semantic example
How to make it easier for your computer to understand your code

<p><b> Network </b> The goal is: to create a full stack of engineers, the achievement of the future cto</p>
<p ><strong> Network </strong> goal is: To create a full stack of engineers, the achievement of the future cto</p>

<div> full stack engineer </div> and
<span style= "Display:block" > Full stack Engineer </span>

Select the question
which is the benefit of the HTML structure to be spent? C
A. When the style is lost, the page can be rendered with a clear structure
B. Make it easy for a device that does not support CSS to "read" your Web page (such as a blind Internet tool) based on your markup
C. Crawler crawling for search engines, crawler dependencies and semantic tags to determine the context and the weights of each key word.
D. Better browser compatibility
E. Facilitates team development and maintenance


1 CSS Rendering order
Use an example to experience

HTML
headtitle "Web p ..."
Bodydiv
H1 "Web p ..."
P "this ..."

1, render in order from top to bottom
2, side download side render
3, turn on separate connection to fetch resources
4, subsequent definitions overwrite the preceding
5, Reflow, and Repaint

2 CSS Rendering principle
How the browser renders

page rendering is the process by which the browser displays HTML code in a browser window based on the rules defined by the CSS

to get the three-point CSS Optimization principle:
A, CSS Top
B, use sprite to reduce data connection
C, JS Dom operation optimization principle

2 Considerations for the language itself
① avoidance of meaningless calculations
② Minimizing calculations
③ Avoid using global variables
④ always declares local variables, unconscious global variables are disasters

Debug JS "Use Strict"

④ How to detect IsNaN
⑤ know the pit, how many false, with caution?
⑥ sentence at the end of the best to add semicolons
⑦ character channeling stitching for efficient, no fixed paradigm



1, the biggest performance problem lies in DOM operation
① to use an efficient selector
① 20,000-time comparison
② Save the selector result as a local variable
① 20,000-time comparison
③ first operation and then display (think about the principle of rendering)
④ first assemble and attach to DOM.
⑤ reduce page DOM node points
⑥ event binding and operation delay




5.JavaScript optimization and the secret behind the navigation menu

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.