CSS change color on scroll / cut text - overflow z-index

后端 未结 4 777
Happy的楠姐
Happy的楠姐 2020-12-13 18:45

This one is maybe a big riddle. Maybe its not. I want to change the color of a position:fixed menu when scrolling.

4条回答
  •  时光说笑
    2020-12-13 19:23

    If you don't want to have to manage duplicate elements to pull off this effect with CSS clip as per Antony's solution, then you can use a couple jQuery plugins:

    • jq-clipthru - This is a superflexible plugin that can probably do everything you want (and a lot more), but it also requires the jQuery UI library. [Demo]

    • Unobscure Text - This is my very lightweight plugin that has a very specific use case, but it's not compatible with jQuery 3. [Demo]

    If you require jQuery 3 support and don't care for IE 11 and below, then you can use a solution based on SVG clip-path, like this.

提交回复
热议问题