Skip to content

Commit

Permalink
Update customize preview css
Browse files Browse the repository at this point in the history
  • Loading branch information
shrimp2t committed Sep 10, 2018
1 parent e88be93 commit 12647fe
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions assets/js/customizer-liveview.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,21 @@
} );
} );

$( window ).resize( function(){
function update_css( ){
var css_code = $( '#onepress-style-inline-css' ).html();
// Fix Chrome Lost CSS When resize ??
$( '#onepress-style-inline-css' ).html( css_code );
$( '#onepress-style-inline-css' ).replaceWith( '<style class="replaced-style" id="onepress-style-inline-css">'+css_code+'</style>' );

}

// When preview ready
wp.customize.bind( 'preview-ready', function() {
update_css();
});

setTimeout( function(){
var css_code = $( '#onepress-style-inline-css' ).html();
// Fix Chrome Lost CSS When resize ??
$( '#onepress-style-inline-css' ).html( css_code );
}, 200 );
$( window ).resize( function(){
update_css();
});


wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function( settings ) {
Expand Down

0 comments on commit 12647fe

Please sign in to comment.