Jquery - zAccordion插件响应模式
Jquery - zAccordion plugin responsive mode
我正在使用Jquery zAccordion插件,我希望它是响应式的。所以我尝试从他们自己的网站的例子中: http://www.armagost.com/zaccordion/a-responsive-example-using-media-queries/
无论如何,我已经在我的wordpress网站上包含了zAccordion,Enquire和下面提到的脚本,但什么也没发生。
怎么了?这是脚本:
jQuery(document).ready(function($) {
var example = $('#media'), defaults = {
buildComplete: function () {
example.css('visibility', 'visible');
},
timeout: 5500
};
function build(x) {
var opts, current;
if (!$.isEmptyObject(example.data())) { /* If an zAccordion is found, rebuild it with new settings. */
example.css('visibility', 'hidden');
current = example.data('current');
opts = $.extend({
startingSlide: current
}, defaults, x);
example.zAccordion('destroy', {
removeStyleAttr: true,
removeClasses: true,
destroyComplete: {
afterDestroy: function() {
try {
console.log('zAccordion destroyed! Attempting to rebuild...');
} catch (e) {}
},
rebuild: opts
}
});
} else { /* If no zAccordion is found, build one from scratch. */
example.css('visibility', 'hidden');
opts = $.extend(defaults, x);
example.zAccordion(opts);
}
}
/* A unique Media Query is registered for each screen size. */
enquire.register('screen and (min-width: 960px)', { /* Standard screen sizes and a default build for browsers that are unsupported. */
match : function () {
build({
slideWidth: 540,
width: 860,
height: 200
});
} /* The *true* value below means this media query will fire by default. */
}, true).register('screen and (min-width: 768px) and (max-width: 959px)', {
match : function () {
build({
slideWidth: 420,
width: 680,
height: 200
});
}
}).register('screen and (min-width: 480px) and (max-width: 767px)', {
match : function () {
build({
slideWidth: 220,
width: 380,
height: 200
});
}
}).register('screen and (max-width: 479px)', {
match : function () {
if (!$.isEmptyObject(example.data())) {
example.zAccordion('destroy', {
removeStyleAttr: true,
removeClasses: true,
destroyComplete: {
afterDestroy: function() {
try {
console.log('zAccordion destroyed!');
} catch (e) {}
}
}
});
}
}
}).listen(5);
});
这是 HTML :
<ul id="media">
<li><img src="http://domain.com/wp-content/uploads/2014/11/1.jpg" width="750" height="300" alt="Image Title"/></li>
<li><img src="http://domain.com/wp-content/uploads/2014/11/2.jpg" width="750" height="300" alt="Image Title"/></li>
<li><img src="http://domain.com/wp-content/uploads/2014/11/3.jpg" width="750" height="300" alt="Image Title"/></li>
<li><img src="http://domain.com/wp-content/uploads/2014/11/4.jpg" width="750" height="300" alt="Image Title"/></li>
</ul>
<pre class="js">
$("#media").zAccordion({
timeout: 4000,
slideWidth: 600,
width: 960,
height: 270
});
</pre>
在 ul 标签后面包含代码,并用"jQuery"删除"$"。
相关文章:
- 针对浏览器的不同响应的Backbone.js路由器模式“;背面“;按钮或直接导航
- 在尝试打开引导模式时,浏览器停止响应
- json模式没有'不适用于空的响应体
- 响应式设计:纵向/横向模式下的图像
- 用于忽略先前请求响应的前端 JavaScript 模式
- 引导模式按钮没有响应
- 如何防止在响应模式下图像换行
- 响应式文件管理器.防止在选择图像时模式关闭
- 通过 JS 模块模式返回 ajax 响应
- Jquery - zAccordion插件响应模式
- 如何在中心显示带有消息的加载程序图像,并防止在 AJAX 响应来自 PHP 文件时关闭引导模式对话框
- HTML5 文件系统信息栏在展台模式下没有响应
- 如果用户在我的响应网站中的纵向模式下单击切换按钮,则导航菜单将在横向模式下消失
- 什么'当从AngularJS中的API响应接收到错误时,触发错误弹出模式的最佳方式
- 如何在响应模式中反转元素的顺序
- 响应模式下的数据表ng-click不起作用
- Angular Material在Chrome调试(设备)模式下没有响应
- IE 11中的角度响应标头无法正常工作,除非处于开发人员模式
- 试图在401服务器响应上启动ui模式
- 如何制作“;导航条固定底部”;在响应模式下点击按钮时向上滑动?(引导程序)