A
A
Anton2015-05-15 13:54:46
css
Anton, 2015-05-15 13:54:46

How to make a script with jquery work?

There is a Script tympanus.net/Development/DialogEffects
The script worked for ok, but after installing it on modx evo and connecting the yams module, it stopped working correctly.
It certainly works and fulfills, but when pressed, a window appears and disappears.
How can I make the script process without refreshing the page?
Poke here: Ooos.ru (Login for clients/CMS-Site Management)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Petrov, 2015-05-15
@Ooos

Why do you need a link?
If you want to leave it, then somewhere in the script it is required

$(document).on('click', '[data-dialog]', function (e) {
  e.preventDefault();
});

Update: No need to paste anything anywhere. Just replace the function in the document itself
$(function () {
  var trigger = $('[data-dialog]'),
    type = trigger.data('dialog'),
    dialog = new DialogFx(type);

  trigger.on('click', function (e) {
    e.preventDefault();
    dialog.toggle.bind(dialog);
  });
})();

And don't forget the monstrous z-index in the .dropdown-menu .

S
Sharov Dmitry, 2015-05-15
@vlom88

If I understand correctly, then this function calls the dialog for you

(function() {
    var dlgtrigger = document.querySelector( '[data-dialog]' ),
        somedialog = document.getElementById( dlgtrigger.getAttribute( 'data-dialog' ) ),
        dlg = new DialogFx( somedialog );

    dlgtrigger.addEventListener( 'click', dlg.toggle.bind(dlg) );

    return false;
})();

Add return false to the end, everything should work, since you are following the link

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question