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

License

web-bond/full-width-block-in-container

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
img
 
 
src
 
 
 
 
 
 

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 -->

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published