2016-12-06 71 views
0

我無法使background-image節點屬性工作。節點背景圖像不工作(僅限Flickr顯示的圖像)

我簡單地使用「Images & breadthfirst layout」演示作爲測試示例(位於https://gist.github.com/maxkfranz/aedff159b0df05ccfaa5),但我甚至無法使其工作。

在演示中,在'code.js'文件中,如果我將任何圖像路徑更改爲staticflickr以外的任何圖像,則圖像將不會顯示。例如:

如果更改

.selector('#bird') 
    .css({ 
    'background-image': 'https://farm8.staticflickr.com/7272/7633179468_3e19e45a0c_b.jpg' 
    }) 

.selector('#bird') 
    .css({ 
    'background-image': 'http://astromatrix.org/Content/Images/Objects/Bird.jpg' 
    }) 

該圖像示出了圖中的空白灰色(如示出的附加的圖像中)。

我已經嘗試過本地文件,在不同網站上託管的多個其他圖片,我可以上班的唯一圖片來自flickr。

我完全錯過了什麼嗎?

在此先感謝您擁有自己的服務器上

Blank image for bird when I change the image URL from flickr image

+0

我有404你把爲例圖像。你是否在Network開發者工具中檢查過? –

+0

@ leo.fcx抱歉,我以錯誤圖片爲例。你是對的,我首先使用的圖像給出了一個404錯誤,所以我將它改成了一個仍然在圖形中產生一個空白節點的工作示例。 – Joelb92

+0

@ leo.fcx,我不知道在詢問我是否從開發人員工具中檢查網絡時,我知道您指的是什麼。 – Joelb92

回答

0

使用的圖片。如果服務器不發送正確的標題,則不能使用圖像。

請務必參閱log in the debug console

Access to Image at 'http://astromatrix.org/Content/Images/Objects/Bird.jpg' from origin 'http://astromatrix.org' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8888' is therefore not allowed access.