3

webosアプリケーションに画像を追加し、クリックイベントを追加したい。また、アプリケーションに背景画像を入れることができません。このコードを入れて、Basic.cssファイルに背景画像を設定します

body.palm-default {
    background: url('../images/comman_bg.png') top left no-repeat;
    z-index: -1;
    position: fixed;
    top: 0px;
    left: 0px;
    width: 320px;
    height: 480px;
}
/* "splash" below is the scene name. Replace it with your scene name to get it to have a custom background */
#mojo-scene-splash-scene-scroller {
    background: url('../images/splash-screenshot-default.png') top left no-repeat;
}

誰かが画像を設定するためのコードを持っていて、画像のイベントをクリックしてから返信する場合。

4

2 に答える 2

1

index.htmlのBasic.cssファイルを必ず含めましたか?CSSファイルの配置に対して、画像へのパスが正しいことを確認しましたか?

画像のクリックハンドラーを設定するには、次のような操作を行います。

this.onTapHandler = this.onTap.bind(this);
Mojo.Event.listen($("myImg"), Mojo.Event.tap, this.onTapHandler);

そして後であなたは聞くのをやめたいでしょう

Mojo.Event.stopListening($("myImg"), Mojo.Event.tap, this.onTapHandler);
于 2011-08-03T13:58:21.047 に答える
1
   // set up the image view widget
   this.tfdImages = this.controller.get("tfd-images");
   this.tfdWidget = this.controller.setupWidget("tfd-images", {noExtractFS: true}, this.imageModel = 
                           {
                              onLeftFunction: function() { this.updateImages(-1); }.bind(this),
                              onRightFunction: function() { this.updateImages(1); }.bind(this)
                           });
于 2011-08-12T12:54:01.830 に答える