Skip to content
A universal script that calculates the width of the window without scrolling and the width of the container and its indentation. Further, the matter of arithmetic. You just need to replace the container selector and the block selector that needs to be stretched
HTML JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
img
src
LICENSE
README.md

README.md

Full width block in container

The script on javascript, which allows you to stretch the block in a container for the entire width of the window.
Visually you can look at http://web-bond.com/projects/block-full-width-into-container/

Initialize

<script src="full_width.js" type="text/javascript"></script>
<script>
    fullWidthFinal('container', 'div-2'); // fullWidthFinal('container class', 'block id');
</script>

Initialize with JQuery (if you have jQuery it's more better option)

<script src="https://code.jquery.com/jquery-2.2.4.min.js"
        integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
        crossorigin="anonymous"></script>
<script src="full_width_jquery.js" type="text/javascript"></script>
<script>
    fullWidthFinal('.container', '#div-2'); // fullWidthFinal('container selector', 'block selector');
</script>

Example

<div class="container">
    <div id="div-1"></div>
    <div id="div-2"></div>
    <div id="div-3"></div>
</div>

<!-- javascript -->
<script src="full_width.js" type="text/javascript"></script>
<script>
    fullWidthFinal('container', 'div-2'); // fullWidthFinal('container class', 'block id');
</script>
<!-- end -->

<!-- jQuery -->
<script src="https://code.jquery.com/jquery-2.2.4.min.js"
        integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
        crossorigin="anonymous"></script>
<script src="full_width_jquery.js" type="text/javascript"></script>
<script>
    fullWidthFinal('.container', '#div-2'); // fullWidthFinal('container selector', 'block selector');
</script>
<!-- end -->
You can’t perform that action at this time.