2010-06-05 4 views
0

Невозможно получить его для прокрутки по горизонтали. Что мне не хватает?Не удается получить горизонтальный свиток для работы

Вот мой код в первом 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> 

Вот мой код в первом-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 */ 
}; 
+0

Есть ли онлайн-демонстрация этого, чтобы мы могли проверить его? – Gavrisimo

ответ

1

Я понял. ScrollderId является содержащим 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> 
0

Просто беглый взгляд на этот HTML snipet говорит мне, что вы не закрывая ваши дивы. Попробуйте этот 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> 

Как я сказал, я не пошел глубже в проблему, то эти первые несколько строк. :)

+0

На самом деле он был закрыт. У div class = "palm-header" есть закрывающий div. Это после слова «Заголовок». – kylex

+0

Oooops .... :) Извините, просто подумал, чтобы ответить на еще один вопрос, а затем ложиться спать, но, похоже, слишком устал отвечать ... <_ < – Gavrisimo