How does Google achieve the fading effect on the home page?

后端 未结 7 2173
猫巷女王i
猫巷女王i 2021-01-14 06:27

If you go to google.com, you notice the menu on top slowly appears once you have mouse over the page. I was wondering what does Google use to control the fading effect?

7条回答
  •  执笔经年
    2021-01-14 06:48

    You could use jQuery and add an onmousemove callback on the tag that fades a hidden div with id "mymenu" in, something like:

    $("html").one("mousemove", function() {
     $("#mymenu").fadeIn("slow")
    });
    

    Warning: this was typed here, so I dunno if it compiles ootb.

提交回复
热议问题