Make the whole BS4 Navbar (on small screens) area clickable, so anywhere you touch, it shows/hide the...












1















enter image description here



Instead of just having a button, I want the whole navbar area to be touchable. I guess it could be done just rearrenging the default BS4 navbar settings:



HTML:



<nav id="menu-navbar" class="navbar navbar-expand-lg navbar-light bg-light">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler"
aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">{{site.title}}</a>
<div class="collapse navbar-collapse" id="navbarToggler">
<div class="navbar-nav float-right text-right pr-3">
<a class="nav-item nav-link active" href="#">Home <span class="sr-only">(current)</span></a>
<a class="nav-item nav-link" href="purgatorio-anim.html">Animación</a>
<a class="nav-item nav-link" href="purgatorio-inter.html">Interacción</a>
<a class="nav-item nav-link" href="purgatorio-blog.html">Textual/Blog</a>
<a class="nav-item nav-link" href="acerca.html">Acerca</a>
<a class="nav-item nav-link" href="contacto.html">Contacto</a>
</div>
</div>
</nav>









share|improve this question


















  • 1





    You could make #menu-navbar clickable with JS, or you could put the entire contents of your header inside a <button>, but both will create lots of usability and accessibility headaches, which is why you don't often see this. Additionally, since this is pretty far outside the scope of bootstrap, you'll have to alter styling manually to have it look right.

    – Toby
    Dec 28 '18 at 20:02











  • @Toby yeah, I thought why I've never seen this implemented, but thanks.

    – dawn
    Dec 28 '18 at 20:05
















1















enter image description here



Instead of just having a button, I want the whole navbar area to be touchable. I guess it could be done just rearrenging the default BS4 navbar settings:



HTML:



<nav id="menu-navbar" class="navbar navbar-expand-lg navbar-light bg-light">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler"
aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">{{site.title}}</a>
<div class="collapse navbar-collapse" id="navbarToggler">
<div class="navbar-nav float-right text-right pr-3">
<a class="nav-item nav-link active" href="#">Home <span class="sr-only">(current)</span></a>
<a class="nav-item nav-link" href="purgatorio-anim.html">Animación</a>
<a class="nav-item nav-link" href="purgatorio-inter.html">Interacción</a>
<a class="nav-item nav-link" href="purgatorio-blog.html">Textual/Blog</a>
<a class="nav-item nav-link" href="acerca.html">Acerca</a>
<a class="nav-item nav-link" href="contacto.html">Contacto</a>
</div>
</div>
</nav>









share|improve this question


















  • 1





    You could make #menu-navbar clickable with JS, or you could put the entire contents of your header inside a <button>, but both will create lots of usability and accessibility headaches, which is why you don't often see this. Additionally, since this is pretty far outside the scope of bootstrap, you'll have to alter styling manually to have it look right.

    – Toby
    Dec 28 '18 at 20:02











  • @Toby yeah, I thought why I've never seen this implemented, but thanks.

    – dawn
    Dec 28 '18 at 20:05














1












1








1








enter image description here



Instead of just having a button, I want the whole navbar area to be touchable. I guess it could be done just rearrenging the default BS4 navbar settings:



HTML:



<nav id="menu-navbar" class="navbar navbar-expand-lg navbar-light bg-light">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler"
aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">{{site.title}}</a>
<div class="collapse navbar-collapse" id="navbarToggler">
<div class="navbar-nav float-right text-right pr-3">
<a class="nav-item nav-link active" href="#">Home <span class="sr-only">(current)</span></a>
<a class="nav-item nav-link" href="purgatorio-anim.html">Animación</a>
<a class="nav-item nav-link" href="purgatorio-inter.html">Interacción</a>
<a class="nav-item nav-link" href="purgatorio-blog.html">Textual/Blog</a>
<a class="nav-item nav-link" href="acerca.html">Acerca</a>
<a class="nav-item nav-link" href="contacto.html">Contacto</a>
</div>
</div>
</nav>









share|improve this question














enter image description here



Instead of just having a button, I want the whole navbar area to be touchable. I guess it could be done just rearrenging the default BS4 navbar settings:



HTML:



<nav id="menu-navbar" class="navbar navbar-expand-lg navbar-light bg-light">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler"
aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">{{site.title}}</a>
<div class="collapse navbar-collapse" id="navbarToggler">
<div class="navbar-nav float-right text-right pr-3">
<a class="nav-item nav-link active" href="#">Home <span class="sr-only">(current)</span></a>
<a class="nav-item nav-link" href="purgatorio-anim.html">Animación</a>
<a class="nav-item nav-link" href="purgatorio-inter.html">Interacción</a>
<a class="nav-item nav-link" href="purgatorio-blog.html">Textual/Blog</a>
<a class="nav-item nav-link" href="acerca.html">Acerca</a>
<a class="nav-item nav-link" href="contacto.html">Contacto</a>
</div>
</div>
</nav>






javascript html css twitter-bootstrap bootstrap-4






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 28 '18 at 19:33









dawndawn

3271317




3271317








  • 1





    You could make #menu-navbar clickable with JS, or you could put the entire contents of your header inside a <button>, but both will create lots of usability and accessibility headaches, which is why you don't often see this. Additionally, since this is pretty far outside the scope of bootstrap, you'll have to alter styling manually to have it look right.

    – Toby
    Dec 28 '18 at 20:02











  • @Toby yeah, I thought why I've never seen this implemented, but thanks.

    – dawn
    Dec 28 '18 at 20:05














  • 1





    You could make #menu-navbar clickable with JS, or you could put the entire contents of your header inside a <button>, but both will create lots of usability and accessibility headaches, which is why you don't often see this. Additionally, since this is pretty far outside the scope of bootstrap, you'll have to alter styling manually to have it look right.

    – Toby
    Dec 28 '18 at 20:02











  • @Toby yeah, I thought why I've never seen this implemented, but thanks.

    – dawn
    Dec 28 '18 at 20:05








1




1





You could make #menu-navbar clickable with JS, or you could put the entire contents of your header inside a <button>, but both will create lots of usability and accessibility headaches, which is why you don't often see this. Additionally, since this is pretty far outside the scope of bootstrap, you'll have to alter styling manually to have it look right.

– Toby
Dec 28 '18 at 20:02





You could make #menu-navbar clickable with JS, or you could put the entire contents of your header inside a <button>, but both will create lots of usability and accessibility headaches, which is why you don't often see this. Additionally, since this is pretty far outside the scope of bootstrap, you'll have to alter styling manually to have it look right.

– Toby
Dec 28 '18 at 20:02













@Toby yeah, I thought why I've never seen this implemented, but thanks.

– dawn
Dec 28 '18 at 20:05





@Toby yeah, I thought why I've never seen this implemented, but thanks.

– dawn
Dec 28 '18 at 20:05












1 Answer
1






active

oldest

votes


















1














One approach for this is registering a listener on the click event of the navbar. After this, and only in the case that the button is visible (i.e. the navbar is collapsed) you can let this click event to toggle the collapsible element that is part of the navbar. Check next example:






$(document).ready(function()
{
$("#menu-navbar").on("click", () =>
{
// Find toggler button.

var tBtn = $(this).find(".navbar-toggler");

// Check if button is visible (navbar is collapsed). In this case
// toggle the collapsible element.

if (tBtn.is(":visible"))
$(this).find(".collapse").collapse("toggle");
});
});

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>

<nav id="menu-navbar" class="navbar navbar-expand-lg navbar-light bg-light">

<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler" aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>

<a class="navbar-brand" href="#">NAVBAR</a>

<div class="collapse navbar-collapse" id="navbarToggler">
<div class="navbar-nav float-right text-right pr-3">
<a class="nav-item nav-link active" href="#">
Home <span class="sr-only">(current)</span>
</a>
<a class="nav-item nav-link" href="purgatorio-anim.html">
Animación
</a>
<a class="nav-item nav-link" href="purgatorio-inter.html">
Interacción
</a>
<a class="nav-item nav-link" href="purgatorio-blog.html">
Textual/Blog
</a>
<a class="nav-item nav-link" href="acerca.html">
Acerca
</a>
<a class="nav-item nav-link" href="contacto.html">
Contacto
</a>
</div>
</div>

</nav>








share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53963476%2fmake-the-whole-bs4-navbar-on-small-screens-area-clickable-so-anywhere-you-tou%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    One approach for this is registering a listener on the click event of the navbar. After this, and only in the case that the button is visible (i.e. the navbar is collapsed) you can let this click event to toggle the collapsible element that is part of the navbar. Check next example:






    $(document).ready(function()
    {
    $("#menu-navbar").on("click", () =>
    {
    // Find toggler button.

    var tBtn = $(this).find(".navbar-toggler");

    // Check if button is visible (navbar is collapsed). In this case
    // toggle the collapsible element.

    if (tBtn.is(":visible"))
    $(this).find(".collapse").collapse("toggle");
    });
    });

    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>

    <nav id="menu-navbar" class="navbar navbar-expand-lg navbar-light bg-light">

    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler" aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
    </button>

    <a class="navbar-brand" href="#">NAVBAR</a>

    <div class="collapse navbar-collapse" id="navbarToggler">
    <div class="navbar-nav float-right text-right pr-3">
    <a class="nav-item nav-link active" href="#">
    Home <span class="sr-only">(current)</span>
    </a>
    <a class="nav-item nav-link" href="purgatorio-anim.html">
    Animación
    </a>
    <a class="nav-item nav-link" href="purgatorio-inter.html">
    Interacción
    </a>
    <a class="nav-item nav-link" href="purgatorio-blog.html">
    Textual/Blog
    </a>
    <a class="nav-item nav-link" href="acerca.html">
    Acerca
    </a>
    <a class="nav-item nav-link" href="contacto.html">
    Contacto
    </a>
    </div>
    </div>

    </nav>








    share|improve this answer




























      1














      One approach for this is registering a listener on the click event of the navbar. After this, and only in the case that the button is visible (i.e. the navbar is collapsed) you can let this click event to toggle the collapsible element that is part of the navbar. Check next example:






      $(document).ready(function()
      {
      $("#menu-navbar").on("click", () =>
      {
      // Find toggler button.

      var tBtn = $(this).find(".navbar-toggler");

      // Check if button is visible (navbar is collapsed). In this case
      // toggle the collapsible element.

      if (tBtn.is(":visible"))
      $(this).find(".collapse").collapse("toggle");
      });
      });

      <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
      <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
      <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
      <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>

      <nav id="menu-navbar" class="navbar navbar-expand-lg navbar-light bg-light">

      <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler" aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
      </button>

      <a class="navbar-brand" href="#">NAVBAR</a>

      <div class="collapse navbar-collapse" id="navbarToggler">
      <div class="navbar-nav float-right text-right pr-3">
      <a class="nav-item nav-link active" href="#">
      Home <span class="sr-only">(current)</span>
      </a>
      <a class="nav-item nav-link" href="purgatorio-anim.html">
      Animación
      </a>
      <a class="nav-item nav-link" href="purgatorio-inter.html">
      Interacción
      </a>
      <a class="nav-item nav-link" href="purgatorio-blog.html">
      Textual/Blog
      </a>
      <a class="nav-item nav-link" href="acerca.html">
      Acerca
      </a>
      <a class="nav-item nav-link" href="contacto.html">
      Contacto
      </a>
      </div>
      </div>

      </nav>








      share|improve this answer


























        1












        1








        1







        One approach for this is registering a listener on the click event of the navbar. After this, and only in the case that the button is visible (i.e. the navbar is collapsed) you can let this click event to toggle the collapsible element that is part of the navbar. Check next example:






        $(document).ready(function()
        {
        $("#menu-navbar").on("click", () =>
        {
        // Find toggler button.

        var tBtn = $(this).find(".navbar-toggler");

        // Check if button is visible (navbar is collapsed). In this case
        // toggle the collapsible element.

        if (tBtn.is(":visible"))
        $(this).find(".collapse").collapse("toggle");
        });
        });

        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>

        <nav id="menu-navbar" class="navbar navbar-expand-lg navbar-light bg-light">

        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler" aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
        </button>

        <a class="navbar-brand" href="#">NAVBAR</a>

        <div class="collapse navbar-collapse" id="navbarToggler">
        <div class="navbar-nav float-right text-right pr-3">
        <a class="nav-item nav-link active" href="#">
        Home <span class="sr-only">(current)</span>
        </a>
        <a class="nav-item nav-link" href="purgatorio-anim.html">
        Animación
        </a>
        <a class="nav-item nav-link" href="purgatorio-inter.html">
        Interacción
        </a>
        <a class="nav-item nav-link" href="purgatorio-blog.html">
        Textual/Blog
        </a>
        <a class="nav-item nav-link" href="acerca.html">
        Acerca
        </a>
        <a class="nav-item nav-link" href="contacto.html">
        Contacto
        </a>
        </div>
        </div>

        </nav>








        share|improve this answer













        One approach for this is registering a listener on the click event of the navbar. After this, and only in the case that the button is visible (i.e. the navbar is collapsed) you can let this click event to toggle the collapsible element that is part of the navbar. Check next example:






        $(document).ready(function()
        {
        $("#menu-navbar").on("click", () =>
        {
        // Find toggler button.

        var tBtn = $(this).find(".navbar-toggler");

        // Check if button is visible (navbar is collapsed). In this case
        // toggle the collapsible element.

        if (tBtn.is(":visible"))
        $(this).find(".collapse").collapse("toggle");
        });
        });

        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>

        <nav id="menu-navbar" class="navbar navbar-expand-lg navbar-light bg-light">

        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler" aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
        </button>

        <a class="navbar-brand" href="#">NAVBAR</a>

        <div class="collapse navbar-collapse" id="navbarToggler">
        <div class="navbar-nav float-right text-right pr-3">
        <a class="nav-item nav-link active" href="#">
        Home <span class="sr-only">(current)</span>
        </a>
        <a class="nav-item nav-link" href="purgatorio-anim.html">
        Animación
        </a>
        <a class="nav-item nav-link" href="purgatorio-inter.html">
        Interacción
        </a>
        <a class="nav-item nav-link" href="purgatorio-blog.html">
        Textual/Blog
        </a>
        <a class="nav-item nav-link" href="acerca.html">
        Acerca
        </a>
        <a class="nav-item nav-link" href="contacto.html">
        Contacto
        </a>
        </div>
        </div>

        </nav>








        $(document).ready(function()
        {
        $("#menu-navbar").on("click", () =>
        {
        // Find toggler button.

        var tBtn = $(this).find(".navbar-toggler");

        // Check if button is visible (navbar is collapsed). In this case
        // toggle the collapsible element.

        if (tBtn.is(":visible"))
        $(this).find(".collapse").collapse("toggle");
        });
        });

        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>

        <nav id="menu-navbar" class="navbar navbar-expand-lg navbar-light bg-light">

        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler" aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
        </button>

        <a class="navbar-brand" href="#">NAVBAR</a>

        <div class="collapse navbar-collapse" id="navbarToggler">
        <div class="navbar-nav float-right text-right pr-3">
        <a class="nav-item nav-link active" href="#">
        Home <span class="sr-only">(current)</span>
        </a>
        <a class="nav-item nav-link" href="purgatorio-anim.html">
        Animación
        </a>
        <a class="nav-item nav-link" href="purgatorio-inter.html">
        Interacción
        </a>
        <a class="nav-item nav-link" href="purgatorio-blog.html">
        Textual/Blog
        </a>
        <a class="nav-item nav-link" href="acerca.html">
        Acerca
        </a>
        <a class="nav-item nav-link" href="contacto.html">
        Contacto
        </a>
        </div>
        </div>

        </nav>





        $(document).ready(function()
        {
        $("#menu-navbar").on("click", () =>
        {
        // Find toggler button.

        var tBtn = $(this).find(".navbar-toggler");

        // Check if button is visible (navbar is collapsed). In this case
        // toggle the collapsible element.

        if (tBtn.is(":visible"))
        $(this).find(".collapse").collapse("toggle");
        });
        });

        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>

        <nav id="menu-navbar" class="navbar navbar-expand-lg navbar-light bg-light">

        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler" aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
        </button>

        <a class="navbar-brand" href="#">NAVBAR</a>

        <div class="collapse navbar-collapse" id="navbarToggler">
        <div class="navbar-nav float-right text-right pr-3">
        <a class="nav-item nav-link active" href="#">
        Home <span class="sr-only">(current)</span>
        </a>
        <a class="nav-item nav-link" href="purgatorio-anim.html">
        Animación
        </a>
        <a class="nav-item nav-link" href="purgatorio-inter.html">
        Interacción
        </a>
        <a class="nav-item nav-link" href="purgatorio-blog.html">
        Textual/Blog
        </a>
        <a class="nav-item nav-link" href="acerca.html">
        Acerca
        </a>
        <a class="nav-item nav-link" href="contacto.html">
        Contacto
        </a>
        </div>
        </div>

        </nav>






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 29 '18 at 4:10









        ShiderszShidersz

        4,6312529




        4,6312529






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53963476%2fmake-the-whole-bs4-navbar-on-small-screens-area-clickable-so-anywhere-you-tou%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Angular Downloading a file using contenturl with Basic Authentication

            Olmecas

            Can't read property showImagePicker of undefined in react native iOS