Created
November 21, 2019 13:38
-
-
Save nk-o/f0f2e5bb92a8c52ba38f7cb5308a6092 to your computer and use it in GitHub Desktop.
.DOC: Advanced Backgrounds https://wpbackgrounds.com/documentation/getting-started/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Documentation Advanced Backgrounds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
var $body = $('body'); | |
// fullwidth gutenberg feature. | |
function stretchAWB() { | |
var wndW = $body.width(); | |
$('.nk-awb.alignfull > .nk-awb-wrap').each(function () { | |
var $this = $(this); | |
var rect = this.getBoundingClientRect(); | |
var left = rect.left; | |
var right = wndW - rect.right; | |
var ml = parseFloat($this.css('margin-left') || 0); | |
var mr = parseFloat($this.css('margin-right') || 0); | |
$this.css({ | |
'margin-left': ml - left, | |
'margin-right': mr - right, | |
}); | |
}); | |
} | |
stretchAWB(); | |
$(window).on('resize orientationchange load', stretchAWB); | |
}(jQuery)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment