【发布时间】:2016-05-02 21:44:10
【问题描述】:
我有一个位于 DOM 中的图标列表,具体取决于视口。 我的脚本到目前为止有效,但不能调整大小。我总是只需要按键盘上的 F5。
怎么了?
$(document).ready(function() {
//
// functions
//
// ----------------------------------------------------------------------------
// select dom element and move to another
// ele = element to move, wrapper = element parant
var moveEle = function(ele,wrapper) {
var getContent = $(ele).contents();
$(getContent).detach().appendTo(wrapper);
}
//
// modernizr
//
// ----------------------------------------------------------------------------
//** viewport check
$(window).on( "resize", function() {
var query = Modernizr.mq('(min-width: 992px)');
if (query) {
moveEle('.action-icons', '.wrap-action-links');
} else {
moveEle('.action-icons', '.quick-links');
}
}).resize();
});
如何优化脚本?
【问题讨论】:
-
请尝试解决您的问题..
标签: jquery dom-manipulation appendto detach