Giter VIP home page Giter VIP logo

Comments (5)

vodkabears avatar vodkabears commented on July 25, 2024

Hi! Download the latest version(https://github.com/VodkaBears/Remodal/releases/tag/0.1.7) and read the last post of #23, there was the same problem.

from remodal.

cbanicolas avatar cbanicolas commented on July 25, 2024

Hi, i downloaded the last version and i have the following problems:

var inst = $.remodal.lookup[$('[data-remodal-id=modal]').data('remodal')];

inst.open();

That code it is not working now because of this: "TypeError: inst is undefined"

So, i solved the problem using this :

var options = {"closeOnConfirm": false};

$('[data-remodal-id=modal]').remodal(options).open();

But the close modification it is still uncomfortable, when the user press confirm i place a cookie on the browser so i need to close the modal and let him navigate on the web. When he press outside the modal, click close or cancel i use the close and cancel events to redirect the user to my index page.

So, how can i close the modal once the user clicked confirm not triggering the cancel or close events ???

I tried this but once the modal close the close event triggers ... i need to skip that event if the user press confirm.

$(document).on('confirm', '.remodal', function () {
...................
var inst = $.remodal.lookup[$('[data-remodal-id=modal]').data('remodal')];
inst.close();
});

Thanks a lot !

from remodal.

cbanicolas avatar cbanicolas commented on July 25, 2024

Well, i solved using a global var (redirect_on_close) that it is defined to "false" in confirm event to check if event close must redirects or not !

from remodal.

vodkabears avatar vodkabears commented on July 25, 2024

Hi, i downloaded the last version and i have the following problems:
var inst = $.remodal.lookup[$('[data-remodal-id=modal]').data('remodal')];
inst.open();
That code it is not working now because of this: "TypeError: inst is undefined"

This code must work. Write correct selector and do it when DOM is ready. And, yes, it is not initialization, use it if you need to find already created instance.

$(document).ready(function() {
    var inst = $.remodal.lookup[$('[data-remodal-id=your_modal_id]').data('remodal')];
    inst.open();
});

or get it in the event handler:

$(document).on('confirm', '.remodal', function () {
    var inst = $.remodal.lookup[$(this).data('remodal')];
});

So, i solved the problem using this :
var options = {"closeOnConfirm": false};
$('[data-remodal-id=modal]').remodal(options).open();

Use it if you need to create new modal via JS. Note that remodal creates instances automaticly if you have html like that:

<div class="remodal" data-remodal-id="modal" data-remodal-options='{ "closeOnConfirm": false }'>
...
</div>

Well, i solved using a global var (redirect_on_close) that it is defined to "false" in confirm event to
check if event close must redirects or not!

Ok, that's good.

from remodal.

cbanicolas avatar cbanicolas commented on July 25, 2024

Thanks for your work. Your script it is the best modal script i found.

from remodal.

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.