Javascript 停止重复背景图像

Javascript 停止重复背景图像,javascript,css,Javascript,Css,我正在开发一个应用程序,我遇到了一些javascript问题,导致移动导航栏中的图标重复出现 以下是我在页面加载时运行的javascript: $('a[dsid="nav_contact"]').css( 'background-image', 'url("'+Tiggzi.getImagePath('75-phone.png')+'")' ); 我试过这个,但运气不好: 这条规则必须与另一条规则分开。因此必须有两个不同的jQuery函数调用 $('a[dsid="nav_c

我正在开发一个应用程序,我遇到了一些javascript问题,导致移动导航栏中的图标重复出现

以下是我在页面加载时运行的javascript:

$('a[dsid="nav_contact"]').css(
    'background-image',
    'url("'+Tiggzi.getImagePath('75-phone.png')+'")'
);
我试过这个,但运气不好:

这条规则必须与另一条规则分开。因此必须有两个不同的jQuery函数调用

$('a[dsid="nav_contact"]').css('background-repeat', 'no-repeat');
你的背景是分开挂起的。将其括起来,类似于您对背景图像所做的操作

检查此样本是否有一个衬里

$('a[dsid="nav_contact"]').css({
       'background-image' : 'url("'+Tiggzi.getImagePath('75-phone.png')+'")',                           
       'background-repeat' : 'no-repeat'});

在继续之前,请先了解Java和javascript之间的区别。要使代码可读,请尝试在行的开头使用4个空格,其中只包含代码非常粗鲁的sotirios DelimanolisI我认为在帖子上打标签而不费心阅读它们是非常粗鲁的-感谢你的懒惰。这不是懒惰。这是缺乏知识。我正在尽我所能。只需链接.css?@Sumurai8我已经更新了我的答案,这是你指的吗?链接应该是$.cssblah.cssblah2,但这个选项更好-@用户2835927很高兴帮助您!如果我想让这个图像水平居中呢?
$('a[dsid="nav_contact"]').css('background-image', 'url("'+Tiggzi.getImagePath('75-phone.png')+'")');
$('a[dsid="nav_contact"]').css('background-repeat', 'no-repeat');
 $('a[dsid="nav_contact"]').css({
    backgroundImage: 'url("'+Tiggzi.getImagePath('75-phone.png')+'")', 
    backgroundRepeat: 'no-repeat'
});
$('a[dsid="nav_contact"]').css({
       'background-image' : 'url("'+Tiggzi.getImagePath('75-phone.png')+'")',                           
       'background-repeat' : 'no-repeat'});