准备添加类,在mouseenter上删除类 [英] Add Class on ready, remove class on mouseenter
问题描述
我正在创建我的投资组合网站。我期望在准备好的文档上添加类,并在悬停时移除/更改该类到不同的类。我正在使用lightgallery& CSS克过滤到我的图像加载和悬停。
之前,我添加了一个列表。不幸的是,它不适合我的需求。 以前的代码 (
$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ ());
},
mouseleave:function(){
$ (this).find(。nak-gallery-poster)。removeClass(mayfair).addClass(inkwell);
}
});
我改变了jQuery以匹配前面代码的内容。这没有奏效。请帮忙。我的 CodePen
删除代码
$ lg.lightGallery();
$ lg.append(slide);
$ lg.data('lightGallery')。destroy(true);
$ lg.lightGallery();
从你的codepen,然后所有工作正常
好像你错过了一些插件或者放错了代码
I'm creating my portfolio website. I'm looking to add class on document ready, and remove/change that class to a different class on hover. I'm using lightgallery & CSS gram filters to my images on load and hover. Previously, I added a list. Unfortunately it did not work well for my needs. Previous code
$("#gallery a").on({
mouseenter : function() {
$(this).find(".nak-gallery-poster").removeClass("inkwell").addClass("mayfair");
},
mouseleave : function() {
$(this).find(".nak-gallery-poster").removeClass("mayfair").addClass("inkwell");
}
});
I altered the jQuery to match the content from the previous code. This did not work. Please Help. My CodePen
remove code
$lg.lightGallery();
$lg.append(slide);
$lg.data('lightGallery').destroy(true);
$lg.lightGallery();
from your codepen, then all works fine
seems like you missed some plugin or placed wrong code
这篇关于准备添加类,在mouseenter上删除类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!