如何将图像放入 webOS 应用程序中

发布于 2024-11-27 05:23:23 字数 565 浏览 2 评论 0原文

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

如果有人有设置图像的代码并单击图像事件然后回复,

i want to add image in the webos application and want to add click event for it. i am also not able to put background image in the application. i put this code to set background image in Basic.css file

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;
}

if anyone have code for set image and click event for image then reply.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

鸠魁 2024-12-04 05:23:23

您是否确定包含了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);

Did you make sure to include the Basic.css file from your index.html? Did you make sure the path to the images was correct, relative the placement of the CSS file?

To set a click handler for an image you'll want to do something like the following:

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

And later you'll want to stop listening

Mojo.Event.stopListening($("myImg"), Mojo.Event.tap, this.onTapHandler);
孤城病女 2024-12-04 05:23:23
   // 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)
                           });
   // 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)
                           });
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文