Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/474.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript “选择背景图像的方法”;只有";在jquery中?_Javascript_Jquery_Html_Css_Select - Fatal编程技术网

Javascript “选择背景图像的方法”;只有";在jquery中?

Javascript “选择背景图像的方法”;只有";在jquery中?,javascript,jquery,html,css,select,Javascript,Jquery,Html,Css,Select,我在jQuery中设置为“仅”在背景图像上提供scale属性,但div本身不断变大。像这样: 这就是我在jQuery和HTML中的设置方式 var bg=$('.news\u box\u long').css('background-image','img/img\u 09.jpg')) $('.news\u box\u long').mouseenter(函数(){ 如果(!$(bg).is(':animated')){ $(this.css({'transform':'scale('+1.

我在jQuery中设置为“仅”在背景图像上提供scale属性,但div本身不断变大。像这样:

这就是我在jQuery和HTML中的设置方式

var bg=$('.news\u box\u long').css('background-image','img/img\u 09.jpg'))
$('.news\u box\u long').mouseenter(函数(){
如果(!$(bg).is(':animated')){
$(this.css({'transform':'scale('+1.1+'))})
}
})

您不需要jQuery。CSS就足够了

.news\u box\u long{
高度:200px;
}
.背景{
背景:50%50%/100%无重复;
过渡:背景0.5s;
}
.背景:悬停{
背景大小:150%;
}

lol我不知道CSS会起作用。谢谢你的回答。