【问题标题】:How to change background image every click in windows 8 javascript如何在Windows 8 javascript中每次点击更改背景图像
【发布时间】:2012-10-06 16:14:23
【问题描述】:

我正在开发一个 Windows 8 Metro 应用程序。 在我的 default.html 文件中,我有一个背景图片:

<div id="backgroundImage" >
        <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
            <defs>
                <filter id="myGaussianBlur" x="0" y="0">
                    <feGaussianBlur in="SourceGraphic" stdDeviation="2"></feGaussianBlur>
                </filter>
            </defs>
            <image xlink:href="**surf.jpg**" width="100%" height="100%" preserveAspectRatio="none" filter="url(#myGaussianBlur)" />
        </svg>
    </div>

我想替换 href="surf.jpg" 引用。 我还有一个文件,Creator.js,其中包含当前图像:

 var ControlConstructor = WinJS.UI.Pages.define("Creator.html", {
    // This function is called whenever a user navigates to this page. It
    // populates the page elements with the app's data.
    ready: function (element, options) {
        // TODO: Initialize the page here.

        // the options of the Creator are: image.
        // image is the path to the boleh creator's background image.
        options = options || {};
        this._data = WinJS.Binding.as({ image: options.image });

我还有一个 getter 和一个 setter:

 // Getters/setters for image


   image: {
        get: function () { return this._data.image; },
        set: function (value) { this._data.image = value; }
    }

【问题讨论】:

    标签: javascript windows html windows-8 microsoft-metro


    【解决方案1】:

    我在尝试开发应用程序时发现有使用 JavaScript 编写代码的博客阅读器.....我正在分享链接,您可以检查它是否对您有任何帮助。

    http://msdn.microsoft.com/en-us/library/windows/apps/hh974582.aspx

    您还可以查看 Codeproject 中的简单文章.....这也可以帮助您 http://www.codeproject.com/Articles/338916/Windows-8-JavaScript-Metro-Application-Getting-Sta

    【讨论】:

      猜你喜欢
      • 2014-08-19
      • 2023-03-12
      • 1970-01-01
      • 2021-03-16
      • 1970-01-01
      • 2012-11-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多