我试图添加一个悬停功能,它将类添加到我的标题。我已经得到了这个代码,但在滚动上。Jquery头添加类上悬停
$(document).ready(function(){
jQuery(window).trigger('resize').trigger('scroll');
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll >= 1) {
header.removeClass('scroll').addClass("cover");
$('#phantom').show();
$('#phantom').css('height', Heightcalculate+'px');
} else {
header.removeClass("cover").addClass('scroll');
$('#phantom').hide();
}
});
有没有办法编辑这个现有的代码,所以它相同,但悬停?我试过了我能想到的一切,它不会工作。 在此先感谢。
你试过['.hover()'](https://api.jquery.com/hover/)功能? – Satpal
https://api.jquery.com/hover/ –
尝试'$(“elemnt”)。hover()' – Nadim