[英]How to close and re-open indexedDB database without reloading the page?
[英]Re-open SqueezeBox without double animation
我在屏幕上有一个打开的SqueezeBox ,并想用其他URL重新打开它,以响应单击框中的链接。 我正在尝试各种方法以新的(不同的)大小打开新的URL,以便动画是平滑的并且只能运行一次。 不幸的是,标准方法( open
方法)似乎要进行两次动画处理(或运行无意义的“小故障”动画)。
作为一种替代方案,我正在尝试setContent
,但这似乎没有提供设置选项的方法,并且从源代码中可以看出,一旦设置了选项, SqueezeBox.initialize
不会执行任何操作。
// (Attempt 1)
// This animation is a bit glitchy, have tried resetting resizeFx
// and sizeLoading to reduce bounce. Ideally want it to morph from
// current size to size{} without shrinking to sizeLoading{} first.
if ( false ) {
SqueezeBox.open(
url,
{
size: { x: 500, y: 500 },
sizeLoading: { x: 500, y: 500 },
resizeFx: {
duration: 0
}
}
);
}
// (Attempt 2)
// Empty SqueezeBox then reset its contents
$( 'sbox-content' ).empty();
// Unfortunately here there appears no way to reset the size with
// the ajax method,
// and the call to initialize is ignored.
SqueezeBox.initialize(
{
size: { x: 100, y: 400 },
/* Set the loading size to the current size? */
sizeLoading: { x: 700, y: 700 }
}
);
// Load the new content in via ajax
SqueezeBox.setContent( 'ajax', url );
// So, I would need to call resize() here, causing a second animation
我在这里看到了建议切换到另一个模式灯箱插件的建议,但是离开SB并不是真正的选择,而且我不希望同时运行两者。
啊哈,这是一个解决方案-避免SqueezeBox通话! 相反,我使用标准的MooTools AJAX调用手动加载内容。 这不会打开通常的等待微调器,但是我希望可以解决该问题。
// Let's load page in AJAX manually; reopening with open() or
// setContents() appears to cause double or glitchy animations.
var myRequest = new Request.HTML(
{
url: url,
method: 'get',
evalScripts: true,
update: $( 'sbox-content' )
}
).send();
// @todo If no size change is needed don't run this
// to avoid glitchy animation
SqueezeBox.resize(
{ x: 500, y: 500 },
false
);
请注意,我正在使用evalScripts: true
,以便可运行代码段中的所有JavaScript都可以像使用SqueezeBox.open()
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.