Skip to content

Commit

Permalink
add webview opacity for fireball/issues/4406 (cocos#3023)
Browse files Browse the repository at this point in the history
  • Loading branch information
knoxHuang authored and pandamicro committed Jul 27, 2018
1 parent f74f36c commit 3845b74
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cocos2d/webview/webview-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ let WebViewImpl = cc.Class({
div.style.left = "0px";
},

_setOpacity (opacity) {
let iframe = this._iframe;
if (iframe && iframe.style) {
iframe.style.opacity = opacity / 255;
}
},

_createDom (w, h) {
if (WebViewImpl._polyfill.enableDiv) {
this._div = document.createElement("div");
Expand Down Expand Up @@ -377,6 +384,9 @@ let WebViewImpl = cc.Class({
this._div.style['-webkit-transform'] = matrix;
this._div.style['transform-origin'] = '0px 100% 0px';
this._div.style['-webkit-transform-origin'] = '0px 100% 0px';

// chagned iframe opacity
this._setOpacity(node.opacity);
}
});

Expand Down

0 comments on commit 3845b74

Please sign in to comment.