我正在开发一个应用程序,但我遇到了一些导致移动导航栏中的图标重复出现的 javascript 问题。
这是我在页面加载时运行的 javascript:
$('a[dsid="nav_contact"]').css(
'background-image',
'url("'+Tiggzi.getImagePath('75-phone.png')+'")'
);
我已经试过了,但没有成功:
$('a[dsid="nav_contact"]').css(
'background-image',
'url("'+Tiggzi.getImagePath('75-phone.png')+'")'
);
background-repeat: no-repeat;
最佳答案
您的background-repeat
单独挂起。将其包含在类似于您为 background-image
所做的操作中。
$('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'
});
检查此示例 Fiddle
关于javascript - 停止重复背景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19122779/