Using MyBB.popupWindow
#1
Exclamation 
Hello there !

I'm trying to understand how to use the MyBB js functions, but I fail.

I want to use MyBB.popupWindow to simply open a modal popup (for the imgur plugin next version), so I did:

In my imgur_popup template:
<div class="modal">
  <div style="overflow-y: auto; max-height: 400px;" class="modal_{$pid}">
    <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
  <td class="thead">Test imgur</td>
      </tr>
      <tr>
        <td class="tcat">This is a test</td>
      </tr>
    </table>
</div>
</div>

The button is:
<a href="/misc.php?action=imgur" onclick="MyBB.popupWindow('/misc.php?action=imgur&popup=true&editor=MyBBEditor'); return false;">{$lang->imgur_open}</a>

And when I click my button, my popup content is added in the page but not showed (class modal is hidden).
I can't understand why it works fine for existing popups (smilies, buddylist, ...) and not for this.

Did I miss something ? I don't find any particular code for the smilies popup, but I'm sure there is one to do the modal:open...

Thanks by advance.

Regards,
CrazyCat
[MyBB 1.8 mods] - Offer me a coffee
Do not ask me help through PM or Discord
Reply
#2
this guidance might help => Using MyBB Modals (see also some responses there)
Reply
#3
Thanks .m.,
I'd already read it, and I was looking for a simpliest way with a MyBB native function.

I'll follow this tutorial and adapt it.
[MyBB 1.8 mods] - Offer me a coffee
Do not ask me help through PM or Discord
Reply
#4
^ simple method is already available in the suggested guidance thread (in a reply) and here is an example
Reply
#5
Ok, I think I can now manage with the modal Smile

Thanks a lot
[MyBB 1.8 mods] - Offer me a coffee
Do not ask me help through PM or Discord
Reply
#6
Back with this subject...

I now well open my modal and use it, but I dislike the way I close it.
It has to be automaticaly closed on a ajax success, the only way I found to do that working is:
$('.modal').remove();
$('.jquery-modal.blocker').remove();
$('body').css('overflow', 'auto');

Is there a simpliest way to close it ?
[MyBB 1.8 mods] - Offer me a coffee
Do not ask me help through PM or Discord
Reply
#7
(2015-06-18, 08:51 AM)Crazycat Wrote: Back with this subject...

I now well open my modal and use it, but I dislike the way I close it.
It has to be automaticaly closed on a ajax success, the only way I found to do that working is:
$('.modal').remove();
$('.jquery-modal.blocker').remove();
$('body').css('overflow', 'auto');

Is there a simpliest way to close it ?

more simpliest is using
$.modal.close();
Reply
#8
... So simple...

Thanks martec !
[MyBB 1.8 mods] - Offer me a coffee
Do not ask me help through PM or Discord
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)