当我打开我的主页seodevs.com时,它的工作方式正是我想要的,但是,如果我在PC上更改浏览器大小或者在Android上旋转屏幕,它会完全锁定设备的CPU。我试过firefox,chrome,android chrome和三星互联网。我确信它在下面的代码中有一些不太正确的东西,但在通过删除停用的插件和诸如此类的搜索和错误测试之后,我得出的结论是在下面的代码中有些问题。
我希望有人可以解决可能存在的问题并帮助我已经退缩的发际线。
提前致谢。
<?php
$list = get_posts($default);
do_action( 'before' );
$id = 'seo_reponsive_post_slider_'.rand().time();
if ( count($list) > 0 ){
?>
<div class="clear"></div>
<div id="<?php echo esc_attr( $id ) ?>" class="responsive-post-slider
responsive-slider clearfix loading" data-lg="<?php echo esc_attr( $rows ); ?
>" data-md="<?php echo esc_attr( $rows1 ); ?>" data-sm="<?php echo esc_attr(
$rows2 ); ?>" data-xs="<?php echo esc_attr( $rows3 ); ?>" data-mobile="<?php
echo esc_attr( $rows4 ); ?>" data-speed="<?php echo esc_attr( $speed ); ?>"
data-scroll="<?php echo esc_attr( $scroll ); ?>" data-interval="<?php echo
esc_attr( $interval ); ?>" data-autoplay="<?php echo esc_attr( $autoplay );
?>">
<div class="resp-slider-container">
<div class="block-title">
<?php
$titles = strpos($title2, ' ');
$title = ($titles !== false) ? '<span>' . substr($title2, 0,
$titles) . '</span>' .' '. substr($title2, $titles + 1): $title2 ;
echo '<h3>'. $title .'</h3>';
?>
</div>
<div class="slider responsive">
<?php foreach ($list as $post){ ?>
<?php if($post->post_content != $excerpt) { ?>
<div class="item widget-pformat-detail">
<div class="item-inner">
<div class="item-detail">
<h1 style="font-family:Georgia,Cambria,Times New
Roman,Times,serif;color:#000!important;font-weight:800;margin-
top:1em;margin-bottom:1em;line-height:1.2;"><a href="<?php echo
get_permalink($post->ID)?>"><?php echo $post->post_title;?></a></h1>
<div class="postau author media">
<figure class="media-left">
<img alt=""
src="https://s.gravatar.com/avatar/329a319f935970449afd69dd28fa4f5f?s=80"
srcset="https://s.gravatar.com/avatar/329a319f935970449afd69dd28fa4f5f?s=80"
class="avatar photo img-circle"><?php esc_html_e('', 'seodevs'); ?>
</figure>
<div class="media-body media-middle">
<p>
by Mal Tonge
</p>
</div>
</div>
<div class="img_over">
<a href="<?php echo get_permalink($post->ID)?>"
>
<?php
if ( has_post_thumbnail( $post->ID ) ){
echo get_the_post_thumbnail( $post->ID,
'seodevs_blog-responsive1' ) ? get_the_post_thumbnail( $post->ID,
'seodevs_blog-responsive1' ): '<img
src="'.get_template_directory_uri().'/assets/img/placeholder/'.'large'.'.png"
alt="No thumb">';
}else{
echo '<img src="'.get_template_directory_uri().'/assets/img/placeholder/'.'large'.'.png" alt="No thumb">';
}
?></a>
</div>
<div class="entry-content">
<div class="item-title">
<p class="description">
<?php
$content =
self::ya_trim_words($post->post_excerpt, $length, '999');
echo $content;
?>
</p>
</div>
<div class="readmore"><a href="<?php echo get_permalink($post->ID);?>" title="View more" ><?php esc_html_e('Read more','seo_core');?><i class="fa fa-caret-right"></i></a></div>
<div class="entry-
comment"style="font-size:26;color:#8dbf42;">
<p class="entry-comments pull-cc-left">
<span class="comments-number"><?php echo $post->comment_count . ( ( $post-
>comment_count > 1 )); ?></span>
<span class="comments-text">
<h4> Comments<h4/></span>
</p>
<?php extract( shortcode_atts( array(
'show_share' => 'true',
), $atts )); {
$postTitle = get_the_title();
echo '<div class="ts-isotope-posts-social">';
echo '<a href="http://pinterest.com/pin/create/link/?url=' . get_permalink($post->ID) . '&description=' . $postTitle . '" class="ts-isotope-posts-social-holder" rel="external" target="_blank"><span class="ts-isotope-posts-social-pinterest"></span></a>';
echo '<a href="https://plusone.google.com/_/+1/confirm?hl=en&url=' . get_permalink($post->ID) . '&name=' . $postTitle . '" class="ts-isotope-posts-social-holder" rel="external" target="_blank"><span class="ts-isotope-posts-social-google"></span></a>';
echo '<a href="http://twitter.com/share?text=' . $postTitle . '&url=' . get_permalink($post->ID) . '" class="ts-isotope-posts-social-holder" rel="external" target="_blank"><span class="ts-isotope-posts-social-twitter"></span></a>';
echo '<a href="http://www.facebook.com/sharer.php?u=' . get_permalink($post->ID) . '" class="ts-isotope-posts-social-holder" rel="external" target="_blank"><span class="ts-isotope-posts-social-facebook"></span></a>';
echo '</div>';
}
?>
</div>
</div>
</div>
</div>
</div>
<?php } ?>
<?php }?>
</div>
</div>
似乎是wordpress附带的JS文件。 jquery.js文件中的resize函数导致了问题。这是被调用的JS,但我对js没用。我试过从这个js中删除函数,但只是导致内容不加载。但是通过右键单击站点并检查转到元素选项卡,然后转到事件监听器选项卡。向下滚动以调整窗口大小并单击删除,然后页面无任何问题,并像梦一样调整大小。
这是JS代码。
var ka = /^(?:input|select|textarea)$/i,
la = /^key/,
ma = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
na = /^(?:focusinfocus|focusoutblur)$/,
oa = /^([^.]*)(?:\.(.+)|)/;
function pa() {
return !0
}
function qa() {
return !1
}
function ra() {
try {
return d.activeElement
} catch(a) {}
}
function sa(a, b, c, d, e, f) {
var g, h;
if("object" == typeof b) {
"string" != typeof c && (d = d || c, c = void 0);
for(h in b) sa(a, h, c, d, b[h], f);
return a
}
if(null == d && null == e ? (e = c, d = c = void 0) : null == e && ("string" == typeof c ? (e = d, d = void 0) : (e = d, d = c, c = void 0)), e === !1) e = qa;
else if(!e) return a;
return 1 === f && (g = e, e = function(a) {
return n().off(a), g.apply(this, arguments)
}, e.guid = g.guid || (g.guid = n.guid++)), a.each(function() {
n.event.add(this, b, e, d, c)
})
}
n.event = {
global: {},
add: function(a, b, c, d, e) {
var f, g, h, i, j, k, l, m, o, p, q, r = n._data(a);
if(r) {
c.handler && (i = c, c = i.handler, e = i.selector), c.guid || (c.guid = n.guid++), (g = r.events) || (g = r.events = {}), (k = r.handle) || (k = r.handle = function(a) {
return "undefined" == typeof n || a && n.event.triggered === a.type ? void 0 : n.event.dispatch.apply(k.elem, arguments)
}, k.elem = a), b = (b || "").match(G) || [""], h = b.length;
while(h--) f = oa.exec(b[h]) || [], o = q = f[1], p = (f[2] || "").split(".").sort(), o && (j = n.event.special[o] || {}, o = (e ? j.delegateType : j.bindType) || o, j = n.event.special[o] || {}, l = n.extend({
type: o,
origType: q,
data: d,
handler: c,
guid: c.guid,
selector: e,
needsContext: e && n.expr.match.needsContext.test(e),
namespace: p.join(".")
}, i), (m = g[o]) || (m = g[o] = [], m.delegateCount = 0, j.setup && j.setup.call(a, d, p, k) !== !1 || (a.addEventListener ? a.addEventListener(o, k, !1) : a.attachEvent && a.attachEvent("on" + o, k))), j.add && (j.add.call(a, l), l.handler.guid || (l.handler.guid = c.guid)), e ? m.splice(m.delegateCount++, 0, l) : m.push(l), n.event.global[o] = !0);
a = null
}
},
remove: function(a, b, c, d, e) {
var f, g, h, i, j, k, l, m, o, p, q, r = n.hasData(a) && n._data(a);
if(r && (k = r.events)) {
b = (b || "").match(G) || [""], j = b.length;
while(j--)
if(h = oa.exec(b[j]) || [], o = q = h[1], p = (h[2] || "").split(".").sort(), o) {
l = n.event.special[o] || {}, o = (d ? l.delegateType : l.bindType) || o, m = k[o] || [], h = h[2] && new RegExp("(^|\\.)" + p.join("\\.(?:.*\\.|)") + "(\\.|$)"), i = f = m.length;
while(f--) g = m[f], !e && q !== g.origType || c && c.guid !== g.guid || h && !h.test(g.namespace) || d && d !== g.selector && ("**" !== d || !g.selector) || (m.splice(f, 1), g.selector && m.delegateCount--, l.remove && l.remove.call(a, g));
i && !m.length && (l.teardown && l.teardown.call(a, p, r.handle) !== !1 || n.removeEvent(a, o, r.handle), delete k[o])
} else
for(o in k) n.event.remove(a, o + b[j], c, d, !0);
n.isEmptyObject(k) && (delete r.handle, n._removeData(a, "events"))
}
},
trigger: function(b, c, e, f) {
var g, h, i, j, l, m, o, p = [e || d],
q = k.call(b, "type") ? b.type : b,
r = k.call(b, "namespace") ? b.namespace.split(".") : [];
if(i = m = e = e || d, 3 !== e.nodeType && 8 !== e.nodeType && !na.test(q + n.event.triggered) && (q.indexOf(".") > -1 && (r = q.split("."), q = r.shift(), r.sort()), h = q.indexOf(":") < 0 && "on" + q, b = b[n.expando] ? b : new n.Event(q, "object" == typeof b && b), b.isTrigger = f ? 2 : 3, b.namespace = r.join("."), b.rnamespace = b.namespace ? new RegExp("(^|\\.)" + r.join("\\.(?:.*\\.|)") + "(\\.|$)") : null, b.result = void 0, b.target || (b.target = e), c = null == c ? [b] : n.makeArray(c, [b]), l = n.event.special[q] || {}, f || !l.trigger || l.trigger.apply(e, c) !== !1)) {
if(!f && !l.noBubble && !n.isWindow(e)) {
for(j = l.delegateType || q, na.test(j + q) || (i = i.parentNode); i; i = i.parentNode) p.push(i), m = i;
m === (e.ownerDocument || d) && p.push(m.defaultView || m.parentWindow || a)
}
o = 0;
while((i = p[o++]) && !b.isPropagationStopped()) b.type = o > 1 ? j : l.bindType || q, g = (n._data(i, "events") || {})[b.type] && n._data(i, "handle"), g && g.apply(i, c), g = h && i[h], g && g.apply && M(i) && (b.result = g.apply(i, c), b.result === !1 && b.preventDefault());
if(b.type = q, !f && !b.isDefaultPrevented() && (!l._default || l._default.apply(p.pop(), c) === !1) && M(e) && h && e[q] && !n.isWindow(e)) {
m = e[h], m && (e[h] = null), n.event.triggered = q;
try {
e[q]()
} catch(s) {}
n.event.triggered = void 0, m && (e[h] = m)
}
return b.result
}
},
dispatch: function(a) {
a = n.event.fix(a);
var b, c, d, f, g, h = [],
i = e.call(arguments),
j = (n._data(this, "events") || {})[a.type] || [],
k = n.event.special[a.type] || {};
if(i[0] = a, a.delegateTarget = this, !k.preDispatch || k.preDispatch.call(this, a) !== !1) {
h = n.event.handlers.call(this, a, j), b = 0;
while((f = h[b++]) && !a.isPropagationStopped()) {
a.currentTarget = f.elem, c = 0;
while((g = f.handlers[c++]) && !a.isImmediatePropagationStopped()) a.rnamespace && !a.rnamespace.test(g.namespace) || (a.handleObj = g, a.data = g.data, d = ((n.event.special[g.origType] || {}).handle || g.handler).apply(f.elem, i), void 0 !== d && (a.result = d) === !1 && (a.preventDefault(), a.stopPropagation()))
}
return k.postDispatch && k.postDispatch.call(this, a), a.result
}
},
handlers: function(a, b) {
var c, d, e, f, g = [],
h = b.delegateCount,
i = a.target;
if(h && i.nodeType && ("click" !== a.type || isNaN(a.button) || a.button < 1))
for(; i != this; i = i.parentNode || this)
if(1 === i.nodeType && (i.disabled !== !0 || "click" !== a.type)) {
for(d = [], c = 0; h > c; c++) f = b[c], e = f.selector + " ", void 0 === d[e] && (d[e] = f.needsContext ? n(e, this).index(i) > -1 : n.find(e, this, null, [i]).length), d[e] && d.push(f);
d.length && g.push({
elem: i,
handlers: d
})
}
return h < b.length && g.push({
elem: this,
handlers: b.slice(h)
}), g
},
fix: function(a) {
if(a[n.expando]) return a;
var b, c, e, f = a.type,
g = a,
h = this.fixHooks[f];
h || (this.fixHooks[f] = h = ma.test(f) ? this.mouseHooks : la.test(f) ? this.keyHooks : {}), e = h.props ? this.props.concat(h.props) : this.props, a = new n.Event(g), b = e.length;
while(b--) c = e[b], a[c] = g[c];
return a.target || (a.target = g.srcElement || d), 3 === a.target.nodeType && (a.target = a.target.parentNode), a.metaKey = !!a.metaKey, h.filter ? h.filter(a, g) : a
},
props: "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
fixHooks: {},
keyHooks: {
props: "char charCode key keyCode".split(" "),
filter: function(a, b) {
return null == a.which && (a.which = null != b.charCode ? b.charCode : b.keyCode), a
}
},
mouseHooks: {
props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
filter: function(a, b) {
var c, e, f, g = b.button,
h = b.fromElement;
return null == a.pageX && null != b.clientX && (e = a.target.ownerDocument || d, f = e.documentElement, c = e.body, a.pageX = b.clientX + (f && f.scrollLeft || c && c.scrollLeft || 0) - (f && f.clientLeft || c && c.clientLeft || 0), a.pageY = b.clientY + (f && f.scrollTop || c && c.scrollTop || 0) - (f && f.clientTop || c && c.clientTop || 0)), !a.relatedTarget && h && (a.relatedTarget = h === a.target ? b.toElement : h), a.which || void 0 === g || (a.which = 1 & g ? 1 : 2 & g ? 3 : 4 & g ? 2 : 0), a
}
},
special: {
load: {
noBubble: !0
},
focus: {
trigger: function() {
if(this !== ra() && this.focus) try {
return this.focus(), !1
} catch(a) {}
},
delegateType: "focusin"
},
blur: {
trigger: function() {
return this === ra() && this.blur ? (this.blur(), !1) : void 0
},
delegateType: "focusout"
},
click: {
trigger: function() {
return n.nodeName(this, "input") && "checkbox" === this.type && this.click ? (this.click(), !1) : void 0
},
_default: function(a) {
return n.nodeName(a.target, "a")
}
},
beforeunload: {
postDispatch: function(a) {
void 0 !== a.result && a.originalEvent && (a.originalEvent.returnValue = a.result)
}
}
},
simulate: function(a, b, c) {
var d = n.extend(new n.Event, c, {
type: a,
isSimulated: !0
});
n.event.trigger(d, null, b), d.isDefaultPrevented() && c.preventDefault()
}
}, n.removeEvent = d.removeEventListener ? function(a, b, c) {
a.removeEventListener && a.removeEventListener(b, c)
} : function(a, b, c) {
var d = "on" + b;
a.detachEvent && ("undefined" == typeof a[d] && (a[d] = null), a.detachEvent(d, c))
}, n.Event = function(a, b) {
return this instanceof n.Event ? (a && a.type ? (this.originalEvent = a, this.type = a.type, this.isDefaultPrevented = a.defaultPrevented || void 0 === a.defaultPrevented && a.returnValue === !1 ? pa : qa) : this.type = a, b && n.extend(this, b), this.timeStamp = a && a.timeStamp || n.now(), void(this[n.expando] = !0)) : new n.Event(a, b)
}, n.Event.prototype = {
constructor: n.Event,
isDefaultPrevented: qa,
isPropagationStopped: qa,
isImmediatePropagationStopped: qa,
preventDefault: function() {
var a = this.originalEvent;
this.isDefaultPrevented = pa, a && (a.preventDefault ? a.preventDefault() : a.returnValue = !1)
},
stopPropagation: function() {
var a = this.originalEvent;
this.isPropagationStopped = pa, a && !this.isSimulated && (a.stopPropagation && a.stopPropagation(), a.cancelBubble = !0)
},
stopImmediatePropagation: function() {
var a = this.originalEvent;
this.isImmediatePropagationStopped = pa, a && a.stopImmediatePropagation && a.stopImmediatePropagation(), this.stopPropagation()
}
}, n.each({
mouseenter: "mouseover",
mouseleave: "mouseout",
pointerenter: "pointerover",
pointerleave: "pointerout"
}, function(a, b) {
n.event.special[a] = {
delegateType: b,
bindType: b,
handle: function(a) {
var c, d = this,
e = a.relatedTarget,
f = a.handleObj;
return e && (e === d || n.contains(d, e)) || (a.type = f.origType, c = f.handler.apply(this, arguments), a.type = b), c
}
}
}), l.submit || (n.event.special.submit = {
setup: function() {
return n.nodeName(this, "form") ? !1 : void n.event.add(this, "click._submit keypress._submit", function(a) {
var b = a.target,
c = n.nodeName(b, "input") || n.nodeName(b, "button") ? n.prop(b, "form") : void 0;
c && !n._data(c, "submit") && (n.event.add(c, "submit._submit", function(a) {
a._submitBubble = !0
}), n._data(c, "submit", !0))
})
},
postDispatch: function(a) {
a._submitBubble && (delete a._submitBubble, this.parentNode && !a.isTrigger && n.event.simulate("submit", this.parentNode, a))
},
teardown: function() {
return n.nodeName(this, "form") ? !1 : void n.event.remove(this, "._submit")
}
}), l.change || (n.event.special.change = {
setup: function() {
return ka.test(this.nodeName) ? ("checkbox" !== this.type && "radio" !== this.type || (n.event.add(this, "propertychange._change", function(a) {
"checked" === a.originalEvent.propertyName && (this._justChanged = !0)
}), n.event.add(this, "click._change", function(a) {
this._justChanged && !a.isTrigger && (this._justChanged = !1), n.event.simulate("change", this, a)
})), !1) : void n.event.add(this, "beforeactivate._change", function(a) {
var b = a.target;
ka.test(b.nodeName) && !n._data(b, "change") && (n.event.add(b, "change._change", function(a) {
!this.parentNode || a.isSimulated || a.isTrigger || n.event.simulate("change", this.parentNode, a)
}), n._data(b, "change", !0))
})
},
handle: function(a) {
var b = a.target;
return this !== b || a.isSimulated || a.isTrigger || "radio" !== b.type && "checkbox" !== b.type ? a.handleObj.handler.apply(this, arguments) : void 0
},
teardown: function() {
return n.event.remove(this, "._change"), !ka.test(this.nodeName)
}
}), l.focusin || n.each({
focus: "focusin",
blur: "focusout"
}, function(a, b) {
var c = function(a) {
n.event.simulate(b, a.target, n.event.fix(a))
};
n.event.special[b] = {
setup: function() {
var d = this.ownerDocument || this,
e = n._data(d, b);
e || d.addEventListener(a, c, !0), n._data(d, b, (e || 0) + 1)
},
teardown: function() {
var d = this.ownerDocument || this,
e = n._data(d, b) - 1;
e ? n._data(d, b, e) : (d.removeEventListener(a, c, !0), n._removeData(d, b))
}
}
}), n.fn.extend({
on: function(a, b, c, d) {
return sa(this, a, b, c, d)
},
one: function(a, b, c, d) {
return sa(this, a, b, c, d, 1)
},
off: function(a, b, c) {
var d, e;
if(a && a.preventDefault && a.handleObj) return d = a.handleObj, n(a.delegateTarget).off(d.namespace ? d.origType + "." + d.namespace : d.origType, d.selector, d.handler), this;
if("object" == typeof a) {
for(e in a) this.off(e, b, a[e]);
return this
}
return b !== !1 && "function" != typeof b || (c = b, b = void 0), c === !1 && (c = qa), this.each(function() {
n.event.remove(this, a, c, b)
})
},
trigger: function(a, b) {
return this.each(function() {
n.event.trigger(a, b, this)
})
},
triggerHandler: function(a, b) {
var c = this[0];
return c ? n.event.trigger(a, b, c, !0) : void 0
}