本文介绍了反转文字的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个横向滚动的页面,我有一个浮动菜单。我想让菜单中的文字反转它下面的颜色。有没有办法用HTML5,Javascript和/或jQuery来做到这一点?

I have a page that scrolls sideways and I have a floating menu. I want the text in the menu to invert the color that is under it. Is there a way to do that with HTML5, Javascript, and/or jQuery?

新增:在页面的不同部分? CSS?

Added: How would you invert an image when it goes over different parts of the page? CSS?

这是我用于菜单的CSS的一部分

This is the bit of CSS I use for the menu

body{
  background:#000;
  font-family:Georgia;
  font-size: 34px;
  font-style: italic;
  letter-spacing:-1px;
  width:12000px;
  position:absolute;
  top:0px;
  left:0px;
  bottom:0px;
}
ul#banner{
  position: fixed;
  line-height: 45px;
  margin: 0 30px; padding: 0;
}


推荐答案

step1。获取菜单的位置



step2。删除菜单并获取放置在位置上的元素



也许您可以使用document.elementFromPoint

step1. Get the position of your menu

step2. Remove your menu and get an element that is placed on the position

maybe you can use document.elementFromPoint

这篇关于反转文字的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 04:25