2014-01-21 96 views
1

什麼是Blur.js中的高速緩存前綴?我想演示代碼爲Blur.js,卻得到了錯誤什麼是Blur.js中的緩存前綴?

Failed to load resource: the server responded with a status of 404 (Not Found) https://localhost:44300/none 

我理解它是與cacheKeyPrefix: 'blurjs-', //Prefix to the keyname in the localStorage object。即使我排除這個,我仍然會得到同樣的錯誤。我想這個對象是什麼?鏈接中的文檔是有限的。請如果您使用Blur.js幫我。

$('.target').blurjs({ 
    source: 'body',   //Background to blur 
    radius: 5,   //Blur Radius 
    overlay: '',   //Overlay Color, follow CSS3's rgba() syntax 
    offset: {   //Pixel offset of background-position 
     x: 0, 
     y: 0 
    }, 
    optClass: '',   //Class to add to all affected elements 
    cache: false,   //If set to true, blurred image will be cached and used in the future. If image is in cache already, it will be used. 
    cacheKeyPrefix: 'blurjs-', //Prefix to the keyname in the localStorage object 
    draggable: false  //Only used if jQuery UI is present. Will change background-position to fixed 
}); 
+0

你覺得爲什麼它與該變量做一個div? –

+0

這很可能是因爲您的文件包含錯誤路徑,無法加載 – Felix

+0

@PaoloCasciello我正在使用最小化的Blur.js腳本。只需要找到完整腳本的確切路線。但在最小化腳本中,錯誤指向與CacheKeyPrefix相關的一行代碼。 –

回答

1

好的我解決了這個問題。 source變量必須選擇任何具有您想要模糊的圖像的元素。

所以,如果我有一個像

<div class="blurry"> 
<div class="blurrys-kids"><div> 
</div> 
<style> 
.blurry { 
background: url('../Images/BlurryHasBadKids.jpg');// Important for blurry to have a Background Image 
} 
</style> 

然後,你必須使用Blur.js作爲

$('.blurrys-kids').blurjs({ 
    source: '.blurry', 
    overlay: 'rgba(255,255,255,0.33)', 
    radius: 10 
});