Giter Club home page Giter Club logo

Comments (8)

CyrilKrylatov avatar CyrilKrylatov commented on July 22, 2024 7

Well, I had some issues with Ouibounce & Bootstrap's modal.

Indeed, with only

ouibounce(false, {
        callback: function() {
            $('#your-modal-id').modal('show');
        }
  });

The isDisabled() function will be at true and if so, the ouibounce will never be fired.
So we have to make it false, like this:

document.addEventListener('DOMContentLoaded', function(){
    var _ouibounce = ouibounce(false, {
        aggressive: true,
        timer: 0,
        callback: function() {
            jQuery('#your-modal-id').modal('show');
        }
    });
});

Found the code here #92

Hop it helps!

Anyway @carlsednaoui that's a very nice plugin you made there, great great job. 👍

from ouibounce.

scofield-ua avatar scofield-ua commented on July 22, 2024 5

Maybe, much easier is do something like this:

 ouibounce(false, {
        callback: function() {
            $('#your-modal-id').modal('show');
        }
  });

from ouibounce.

carlsednaoui avatar carlsednaoui commented on July 22, 2024

I think that bootstrap takes over the .modal class.

Did you try renaming your classes? Example:

<div id="ouibounce-modal">
      <div class="underlay"></div>
      <div class="ouibounce-modal">
        <div class="ouibounce-modal-title">
          <h3>This is a OuiBounce modal!</h3>
        </div>

        <div class="ouibounce-modal-body">
          <p>A doge is an elected chief of state lordship, the ruler of the Republic in many of the Italian city states during the medieval and renaissance periods, in the Italian "crowned republics".</p>
          <p>The word is from a Venetian word that descends from the Latin dux (as do the English duke and the standard Italian duce and duca), meaning "leader", especially in a military context. The wife of a doge is styled a dogaressa. <a href="https://en.wikipedia.org/wiki/Doge" target="blank">[1]</a></p>

          <form>
            <input type="text" placeholder="[email protected]">
            <input type="submit" value="learn more &raquo;">
            <p class="form-notice">*this is a fake form</p>
          </form>
        </div>

        <div class="ouibounce-modal-footer">
          <p>no thanks</p>
        </div>
      </div>
    </div>

from ouibounce.

muhammedtufekyapan avatar muhammedtufekyapan commented on July 22, 2024

Thank you Carl! It works!

from ouibounce.

bonswouar avatar bonswouar commented on July 22, 2024

@scofield-ua solution is nice and easy.
Knowing Twitter Bootstrap is very popular, maybe it should be in the documentation ?

from ouibounce.

ibbatta avatar ibbatta commented on July 22, 2024

@muhammedtufekyapan @carlsednaoui the main reason you can't see your element, is for .fade class ( next .modal). That class apply opacity: 0 to you element.

@scofield-ua your solution doesn't work for me. Seems like doesn't reconize $(...) as an element

p.s. sorry for my awful english

from ouibounce.

EssiemLtd avatar EssiemLtd commented on July 22, 2024

Amazing, thanks for this @DaPo .
However, the example gives ways for the user to exit by clicking an exit buttom. How do you incorporate this into the above script?

        document.addEventListener('DOMContentLoaded', function(){       
            var _ouibounce = ouibounce(false, {
                aggressive: true,
                timer: 0,
                callback: function() {
                    jQuery('#your-modal-id').modal('show');
                }
            });
        
        $('body').on('click', function() {
          $('#ouibounce-modal').hide();
        });

        $('#ouibounce-modal .modal-footer').on('click', function() {
           $('#ouibounce-modal').hide();
        });
            
        $('#ouibounce-modal .modal').on('click', function(e) {
            e.stopPropagation();
        });

from ouibounce.

CyrilKrylatov avatar CyrilKrylatov commented on July 22, 2024

@EssiemLtd hello, I'm so so sorry, it's quite a while now, I barely remember what ouibounce does and I don't have much time to try to sort something out for you.

But you maybe need to use modal's event first and search for "javascript detect click outside element" or something like this.

Have fun!

from ouibounce.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.