0

不能让它水平滚动。我错过了什么?

这是我在 first-scene.html 中的代码:

<div id="main" class="palm-hasheader">
     <div class="palm-header">Header</div>
      <div id="scrollerId" style="width:500px; height:500px" x-mojo-element="Scroller">
        <div>
        My Text that goes on... and on... and on... horizontally...
        </div>  
    </div>       
</div>

这是我在 first-assistant.js 中的代码:

function FirstAssistant() {
    /* this is the creator function for your scene assistant object. */
}

FirstAssistant.prototype.setup = function() {
    /* this function is for setup tasks that have to happen when the scene is created */

       this.controller.setupWidget("scrollerId",
       this.attributes = {
        mode: 'horizontal'
           }
   );

};

FirstAssistant.prototype.activate = function(event) {
    /* put in event handlers here that should only be in effect when this scene is active. */
};

FirstAssistant.prototype.deactivate = function(event) {
    /* remove any event handlers you added in activate and do any other cleanup */
};

FirstAssistant.prototype.cleanup = function(event) {
    /* this function should do any cleanup needed before the scene is destroyed as 
       a result of being popped off the scene stack */
};
4

2 回答 2

1

我想到了。scrollderId 是包含设置宽度和高度的 div。包含 div 内的 div 设置了一个大于包含 div 的新宽度,以便向后滚动并使用:

<div id="scrollerId" style="width:320px; height:100px" x-mojo-element="Scroller">
    <div style="width:500px">
                Complication's my claim to fame
                And I can't believe there's another
                Constantly just another
                I can't avoid what I can't control
                And I'm losing ground
                Still I can't stand down
                And I know, yeah I know, yeah
                Complication's my claim to fame
                And I can't believe there's another
                Constantly just another
                I can't avoid what I can't control
                And I'm losing ground
                Still I can't stand down
                And I know, yeah I know, yeah
                Complication's my claim to fame
                And I can't believe there's another
                Constantly just another
                I can't avoid what I can't control
                And I'm losing ground
                Still I can't stand down
                And I know, yeah I know, yeah
    </div>
</div>  
于 2010-06-06T01:27:30.753 回答
0

只需快速查看那个 html 片段就告诉我你没有关闭你的 div。试试这个html:

<div id="main" class="palm-hasheader">
    <div class="palm-header">Header</div>
        <div id="scrollerId" style="width:500px; height:500px" x-mojo-element="Scroller">
            <div>
            My Text that goes on... and on... and on... horizontally...
            </div>
        </div>
    </div>
</div>

就像我说的那样,我没有深入研究问题,然后是前几行。:)

于 2010-06-06T01:11:09.860 回答