如何更改每个Dojo移动视图的背景图像?

时间:2015-03-24 20:28:03

标签: javascript html dojo

是否可以使用Dojo Mobile更改每个视图的背景图像?

例如:

<div id="view1" data-dojo-type="dojox/mobile/View">
 <h1 data-dojo-type="dojox/mobile/Heading">View 1</h1>
 <ul data-dojo-type="dojox/mobile/RoundRectList">
    <li data-dojo-type="dojox/mobile/ListItem"
      data-dojo-props='icon:"images/i-icon-1.png",
                     moveTo:"view2",
                     transition:"slide"'>Go To View 2</li>
 </ul>
</div>

<div id="view2" data-dojo-type="dojox/mobile/View">
 <h1 data-dojo-type="dojox/mobile/Heading"
  data-dojo-props='back:"View 1",
                   moveTo:"view1"'>View 2</h1>
</div>

此处示例:http://dojotoolkit.org/reference-guide/1.10/dojox/mobile/View.html

如果我提出类似的东西     在view1的div部分中,style =&#34; background-image:url(../ images / test-background.png),只有div会被图像背景化,而我希望整个身体都是背景的。如果我用图像背景主体,图像在其他视图中被分割(因为视图在同一个主体中),而我只是希望view1被图像背景化。

有什么建议吗?

提前致谢

2 个答案:

答案 0 :(得分:1)

您可以使用常规CSS设置移动视图的背景样式。

见下面的示例图片;它显示this demo并选择了Buttons视图,使用Developer Tools以紫色背景设置样式。如果您的背景样式未正确应用于整个视图,请发布您的代码或代码片段以演示问题,因为我怀疑您的样式应用不正确。

enter image description here

答案 1 :(得分:1)

第一个答案有效,但不适用于整个视图,仅适用于div:

有效的是:

<div style="background:yellow;min-height:100%" id="view0" data-dojo-type="dojox/mobile/View">
    //whatever you want
</div>

重要的是 min-height:100%

没有它:

enter image description here

用它:

enter image description here