gpt4 book ai didi

javascript - jQuery 不添加背景图片

转载 作者:行者123 更新时间:2023-11-29 22:26:26 25 4
gpt4 key购买 nike

我有一个问题,我想在悬停时添加一个箭头。我想做的是 javascript,因为我也在使用 jquery easing(为此测试停用),如果用户没有 javascript,它将位于链接文本后面

任何填充和背景颜色都有效!但不是图像?我不明白为什么。在 css 中,它的工作原理完全一样!

//arrow
$('.sub-menu a').hover( function(){

$(this).css('padding-top', '10px');
$(this).css('padding-bottom', '10px');
$(this).css('background-color', 'black');
$(this).css('background-image', 'url(http://127.0.0.1/wp-content/themes/nicores/nico/small_arrow_white.png) !important');
$(this).css('background-repeat', 'no-repeat !important');
$(this).css('background-position', '25px 8px !important');
},
function(){

$(this).css('background', 'none');

});

我从 Firebug 得到这个我不知道“背景:无......滚动”来自哪里

padding-top: 10px; padding-bottom: 10px; background: none repeat scroll 0% 0% transparent;

最佳答案

正如@elclanrs 所说,!important 不应该存在。事实上,这是导致问题的原因。尝试将其删除。

这是一个 simplified demo .

关于javascript - jQuery 不添加背景图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9138151/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com