【问题标题】:How can i put image in webOS application如何将图像放入 webOS 应用程序
【发布时间】:2011-07-29 10:35:28
【问题描述】:

我想在 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;
}

如果有人有设置图片的代码和图片的点击事件,请回复。

【问题讨论】:

    标签: webos enyo


    【解决方案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);
    

    【讨论】:

      【解决方案2】:
         // 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)
                                 });
      

      【讨论】:

        猜你喜欢
        • 2018-01-06
        • 1970-01-01
        • 1970-01-01
        • 2021-07-30
        • 1970-01-01
        • 1970-01-01
        • 2020-02-20
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多