dinbror / bpopup

bPopup is a lightweight jQuery modal popup plugin (only 1.34KB gzipped). It doesn't create or style your popup but provides you with all the logic like centering, modal overlay, events and more. It gives you a lot of opportunities to customize so it will fit your needs.
http://dinbror.dk/bPopup
427 stars 260 forks source link

Fade happens when programatically using .Close on a bPopup that isn't currently open #36

Closed Joshdw closed 8 years ago

Joshdw commented 10 years ago

I use bPopup mainly to display AJAX content in popups. I use the plugin Jquery Address to make the whole ajax content SEO-viable.

To allow forward/back browser button usage, I needed to programatically close the bPopups (for instance, if a popup is open, and you hit the back button, it will close the popup and show the main page). I noticed that using the .Close function when a bPopup is NOT open, it will still try to animate the fadeTo transition.

I've narrowed it down to Line 315:

if (o.modal) { $('.b-modal.'+$popup.data('id')) .fadeTo(o.speed, 0, function() { $(this).remove(); }); }

By removing the .fadeTo funtion and just using the remove function I have noticed no problems anymore, it won't show the animation from "black" to transparent transition.

Just thought I would mention it, it is not a huge issue, but maybe worth looking into an alternative fix.

And sorry if this is in a wrong format/section, I'm relatively new to github :)

dinbror commented 9 years ago

How are you calling the close function? Like this:

var bPopup = $(‘element_to_pop_up’).bPopup(); bPopup.close();

dinbror commented 8 years ago

Closing due to inactivity