簡體   English   中英

如何在Windows 8 JavaScript中每次單擊更改背景圖像

[英]How to change background image every click in windows 8 javascript

我正在使用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 });

而且我還有一個吸氣劑和吸氣劑:

 // Getters/setters for image


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

我在嘗試開發應用程序時發現有代碼使用JavaScript編寫Blog閱讀器.....我正在共享鏈接,您可以檢查它是否以任何方式對您有所幫助。

http://msdn.microsoft.com/zh-CN/library/windows/apps/hh974582.aspx

您還可以查看Codeproject中的簡單文章。....這也可以幫助您http://www.codeproject.com/Articles/338916/Windows-8-JavaScript-Metro-Application-Getting-Sta

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM