社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Jquery

jquery delay和get php变量

Rade • 4 年前 • 143 次点击  

我对jquery有一些问题。 我有运行正常的代码,但我想在这两个函数上添加一些延迟(淡入等)。

$(document).ready(function(){
    $(".product-item, .rade-test").mouseover(function(){
        $('.just-to-define').removeClass('rade-test-div');
        $('.just-to-define').addClass('rade-test-div2');
        $('.heredefine').removeClass('rade-test');
        $('.heredefine').addClass('rade-test2');
    });
    $( ".product-item, .rade-test" ).mouseout(function() {
        $('.just-to-define').addClass('rade-test-div');
        $('.just-to-define').removeClass('rade-test-div2');
        $('.heredefine').addClass('rade-test');
        $('.heredefine').removeClass('rade-test2');
    });
});

我试过了

$(".product-item, .rade-test").mouseover(function(){
        $('.just-to-define').removeClass('rade-test-div');
        $('.just-to-define').addClass('rade-test-div2');
        $('.heredefine').removeClass('rade-test');
        $('.heredefine').addClass('rade-test2');
    }, 2000);

但出于某种原因,这行不通。我不知道为什么。所以在这里,当它必须添加类时,我需要淡入/延迟/“处理时间”,并且我已经尝试了 .fadeIn("slow")

第二个问题是,我的模板中有一个表,当鼠标悬停在表上时(见jquery函数),它将打开我编写的每个类(rade-test-div2和rade-test2),当我添加.first()时,它只是第一个ofc。我怎样才能只打开我的鼠标在哪里? product item类在表的tr元素中,因此我可以添加如下内容

@php $uniqueId = uniqId(); @endphp
<tr class="product-item {{$uniqueId}}">

但是如何在jquery中写入来选择这个$uniqueid?我的jquery代码在另一个文件中。

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/38187
 
143 次点击  
文章 [ 1 ]  |  最新文章 4 年前