Javascript Blur.js中的缓存前缀是什么?
什么是缓存前缀?我正在尝试Javascript Blur.js中的缓存前缀是什么?,javascript,jquery,html,Javascript,Jquery,Html,什么是缓存前缀?我正在尝试Blur.js的演示代码,但出现了一个错误 Failed to load resource: the server responded with a status of 404 (Not Found) https://localhost:44300/none 我知道它与cacheKeyPrefix:'blurjs-',//localStorage对象中的keyname前缀有关。即使我排除了这个,我仍然会得到相同的错误。我该把这个指向什么对象呢?链接中的文档是有限的。如
Blur.js
的演示代码,但出现了一个错误
Failed to load resource: the server responded with a status of 404 (Not Found) https://localhost:44300/none
我知道它与cacheKeyPrefix:'blurjs-',//localStorage对象中的keyname前缀有关。即使我排除了这个,我仍然会得到相同的错误。我该把这个指向什么对象呢?链接中的文档是有限的。如果您使用过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
});
好的,我解决了这个问题。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>
为什么您认为它与那个变量有关?更可能是因为您为文件包含了错误的路径,并且它不能被删除loaded@PaoloCasciello我正在使用Blur.js的最小化脚本。正准备用完整的脚本找到准确的行。但是在最小化脚本中,错误指向与CacheKeyPrefix
Ok有关的一行代码。我们已经解决了这个问题。您需要指向源代码:'body'
。由于我的图像位于html
上,body
图像返回空值。
$('.blurrys-kids').blurjs({
source: '.blurry',
overlay: 'rgba(255,255,255,0.33)',
radius: 10
});