Skip to content

Commit

Permalink
Merge pull request #253 from pearlwang1106/master
Browse files Browse the repository at this point in the history
修复悬浮广告bug
  • Loading branch information
momofan1986 authored Dec 23, 2016
2 parents b96aac5 + 37762f3 commit 88ff226
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 15 deletions.
24 changes: 13 additions & 11 deletions mip-ad/mip-ad-baidu.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,20 @@ define(function (require) {
});

if(script) {
script.onload = function() {
setTimeout(function() {
var elem = window.getComputedStyle(document.getElementById(s), null);
var pos = elem && elem.getPropertyValue('position') ?
elem.getPropertyValue('position') : '';

if(pos == 'fixed') {
$elemID.append(document.getElementById(s));
var fixedElement = require('fixed-element');
var layer = fixedElement._fixedLayer;
var child = document.getElementById(s);
child.addEventListener("DOMSubtreeModified", function(e) {
var elem = window.getComputedStyle(child, null);
var pos = elem && elem.getPropertyValue('position') ?
elem.getPropertyValue('position') : '';
if(pos == 'fixed') {
$elemID.append(document.getElementById(s));
if(layer) {
$(layer).append($elemID);
}
}, 100);

};
}
},false);
}

me.applyFillContent(document.getElementById(s), true);
Expand Down
15 changes: 13 additions & 2 deletions mip-ad/mip-baidu-wm-ext.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ define(function (require) {
script.src = document.location.protocol + '//' + domain + '/' + token + '.js';
document.body.appendChild(script);

var fixedElement = require('fixed-element');
var layer = fixedElement._fixedLayer;
var child = document.getElementById(token);

child.addEventListener("DOMSubtreeModified", function(e) {
var elem = window.getComputedStyle(child, null);
var pos = elem && elem.getPropertyValue('position') ?
elem.getPropertyValue('position') : '';
if(pos == 'fixed' && layer) {
$(layer).append(_this);
}
},false);

} else {
console.error('请输入正确的 domain 或者 token');
}
Expand All @@ -29,5 +42,3 @@ define(function (require) {
render: render
}
});


2 changes: 1 addition & 1 deletion mip-ad/setting/example.preset
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
mip-img {
margin: 10px auto;
}
</style
</style>
2 changes: 1 addition & 1 deletion mip-mustache/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mustache模板引擎
----|----
类型|通用
支持布局|不使用布局
所需脚本|http://mipcache.bdstatic.com/static/v1/mip-mustache/mip-mustache.js
所需脚本|https://mipcache.bdstatic.com/static/v1/mip-mustache/mip-mustache.js

## 示例

Expand Down

0 comments on commit 88ff226

Please sign in to comment.