2011-12-03 85 views
0

即时通讯试图在iScroll的JavaScript内使用背景图像。该脚本似乎在javascript中使用CSS,并允许我添加背景颜色,但出于某种原因而不是图像。有没有办法解决这个问题,以便我可以使用图像?我怎样才能让我的背景显示在JavaScript的CSS

这里是我尝试去显示背景图片(图片/ scrollbar_bg.png)

if (that.options.scrollbarClass) 
bar.className = that.options.scrollbarClass + dir.toUpperCase(); 

else bar.style.cssText = 'position:absolute;z-index:100; 
absolute; left: 0px; margin-left: 14px; background-url: images/scrollbar_bg.png; ' 

+ (dir == 'h' ? 'height:7px; bottom:20px; left:2px; right: 
' + (that.vScrollbar ? '7' : '2') + 'px' : 'width:7px;bottom:' 
+ (that.hScrollbar ? '7' : '2') + 
'px;top:14px;right:1px -border-radius:3px;border-radius:3px'); 

感谢

回答

1

你从哪里得到background-url的代码段?正确的语法是这样的:

background-image: url(images/scrollbar_bg.png); 

而且,你有一个随机absolute;坐在你的z-indexleft性质的中间。然而

+0

感谢animuson代码似乎给我一个错误在Dreamweaver中并不起作用:( – Farreal

+0

@丹:什么错误 – animuson

+0

我只是似乎得到一条红线上该行的时候我用你的语法 看到了什么?为自己
如果(that.options.scrollbarClass)bar.className = that.options.scrollbarClass + dir.toUpperCase(); \t \t \t别的bar.style.cssText =“的位置是:绝对的; z索引:100 ; left:0px; margin-left:14px; background-image:url(images/scrollbar_bg.png); '+(dir =='h'?'height:7px; bottom:20px; left:2px; right: '+(that.vScrollbar?'7':'2')+'px':'width:7px ;底部:'+(that.hScrollbar? '7':'2')+'px; top:14px; right:1px -border-radius:3px; border-radius:3px'); – Farreal

相关问题