经过无休止的搜索,我希望能弄清楚这一点。本质上,当浏览器窗口调整大小时,我需要编写一个脚本并重新启动它。我对 JS 的了解只有足够的危险。
该脚本是响应式模板中的非响应式滑块。目前,根据窗口最初加载的分辨率,脚本会更改其输出并适当地显示。但是,如果您调整窗口大小,脚本会变得疯狂并且看起来很糟糕。
我宁愿能够重写脚本来监听调整大小并重新计算大小,但不幸的是,据我所知,这将是压倒性的。我希望通过重新启动脚本来达到类似的结果。
这是调用幻灯片的时间:
$(document).ready(function()
{
$("#showcase").awShowcase(
{
content_height: 640,
fit_to_parent: true,
auto: false,
interval: 5000,
continuous: true,
loading: true,
tooltip_width: 200,
tooltip_icon_width: 32,
tooltip_icon_height: 32,
tooltip_offsetx: 18,
tooltip_offsety: 0,
arrows: true,
buttons: false,
btn_numbers: true,
keybord_keys: true,
mousetrace: false, /* Trace x and y coordinates for the mouse */
pauseonover: true,
stoponclick: false,
transition: 'hslide', /* hslide/vslide/fade */
transition_speed: 500,
transition_delay: 300,
show_caption: 'show', /* onload/onhover/show */
thumbnails: true,
thumbnails_position: 'outside-last', /* outside-last/outside-first/inside-last/inside-first */
thumbnails_direction: 'horizontal', /* vertical/horizontal */
thumbnails_slidex: 0, /* 0 = auto / 1 = slide one thumbnail / 2 = slide two thumbnails / etc. */
dynamic_height: true, /* For dynamic height to work in webkit you need to set the width and height of images in the source. Usually works to only set the dimension of the first slide in the showcase. */
speed_change: false, /* Set to true to prevent users from swithing more then one slide at once. */
viewline: true /* If set to true content_width, thumbnails, transition and dynamic_height will be disabled. As for dynamic height you need to set the width and height of images in the source. It's OK with only the width. */
});
});
我也有检测窗口调整大小的代码,等待 150 毫秒,但后来我迷路了。
var resizeTimer;
$(window).resize(function() {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function() {
}, 150);
});