突出显示悬停条件下的多个项目

2023-11-30前端开发问题
6

本文介绍了突出显示悬停条件下的多个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

好吧抱歉标题,不太清楚如何表达它.

Okay sorry for the title, wasn't too sure how to phrase it.

所以我们有一个项目正在进行,并且我们根据人们捐赠的内容提供多种激励措施(类似于 Kickstarter,如果你知道那是什么的话).

So we have a project going, and we are offering multiple incentives depending on what people donate (similar to Kickstarter if you know what that is).

无论如何,我们一直试图弄清楚的是,当有人徘徊在一个价格范围时,我们希望他们将收到的物品完全不透明,然后对于进一步降低的捐赠值也是如此.

Anyway, what we have ben trying to figure out is when someone hovers on one price range we want the items they will receive to have full opacity, and then the same for the further down donation values.

也许图片会更有意义..

Maybe the image will make more sense..

所以蓝色是悬停,当您将鼠标悬停在$1+"上时,项目 1、3、4 是不透明的.但是,当您将鼠标悬停在$15+"上时,只有项目 1、3 是不透明的.

So the blue is the hover, and when you hover over the "$1+", items 1, 3, 4 are opaque. But when you hover over the "$15+" only items 1, 3 are opaque.

大约有 20 种商品,15 个价格等级,所有这些都相互关联.

There are around 20 items, and 15 price brackets, all in which are interlinked with one another.

我认为这必须是 JS 中的一个,我对此一无所知.

I assume this has to be one in JS, something I know nothing about.

谢谢你:]

谢谢你的所有提示.我已经用 css3 完成了这个项目:不是

Thank you for all the tips. I have completed the project with the css3 :not

而后备将是 JS

推荐答案

我会给出一个比较简单的解决方案.

I will give a rather simple solution.

给每个盒子的价格类别,其中应该是不透明的.有点像

Give every boxes classes of price where should be opaque on. Kinda like

<div id="item1" class="p1 p15">Item 1</div>

然后,在您的价格链接上使用类名作为特定链接的 id

Then, on your price links use the classname as the id for the specific links

   <a class="price" id="p1">$1+</a>

然后使用

$(".price").mouseover(function() {
           $(".items").css("opacity", 0.4);
           id = $(this).attr('id');
           $("."+id).css("opacity", 1);
});

这篇关于突出显示悬停条件下的多个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

js删除数组中指定元素的5种方法
在JavaScript中,我们有多种方法可以删除数组中的指定元素。以下给出了5种常见的方法并提供了相应的代码示例: 1.使用splice()方法: let array = [0, 1, 2, 3, 4, 5];let index = array.indexOf(2);if (index -1) { array.splice(index, 1);}// array = [0,...
2024-11-22 前端开发问题
182

layui 单选框、复选框、下拉菜单不显示问题如何解决?
1. 如果是ajax嵌套了 页面, 请确保 只有最外层的页面引入了layui.css 和 layui.js ,内层页面 切记不要再次引入 2. 具体代码如下 layui.use(['form', 'upload'], function(){ var form = layui.form; form.render(); // 加入这一句});...
2024-11-09 前端开发问题
313

layui tree树组件怎么自定义添加图标
经常用到layui的朋友都知道,layui tree默认是不能自定义图标的,那么我们要自定义的话要怎么操作呢? 首先用编辑器软件(修改时候用编辑器记得编码),打开layui.js。搜索: i class="layui-icon layui-icon-file" 改为如下代码: i class="'+ (i.icon || "l...
2024-10-26 前端开发问题
493

layui要如何改变时间日历布局大小?
问题描述 我想改变layui时间日历布局大小,这个要怎么操作呢? 解决办法 可以用css样式对时间日历进行重新布局,具体代码如下: !DOCTYPE htmlhtmlheadmeta charset="UTF-8"title/titlelink rel="stylesheet" href="../../layui/css/layui.css" /style#test-...
2024-10-24 前端开发问题
271

JavaScript小数运算出现多位的解决办法
在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会...
2024-10-18 前端开发问题
301

JavaScript(js)文件字符串中丢失"\"斜线的解决方法
问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转...
2024-10-17 前端开发问题
437