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

Added a json content type. Added the ability to pass arguments to the tr... #22

Open chawkinsuf opened 10 years ago

chawkinsuf commented 10 years ago

I wanted to be able to pull data as json and display it in the popup, rather than render the html server side. The changes are minimal and I think it fits well with the rest of the system. The update to triggerCall might be useful elsewhere as well.

dinbror commented 10 years ago

Are you just showing raw json data in the popup?

If not I would do the logic in the onOpen callback because you need to process your json data. Are you using templating?

chawkinsuf commented 10 years ago

I am processing the json of course, and I am using templating. I tried various different ways to not have to update the code, but nothing was to my satisfaction. I will have to go back and look at your suggestion again, as it's been a while since I last worked on this.

Part of the problem, is the ajax content option uses the $.load function. This puts whatever is loaded directly into the html, including json. That function does not provide direct access to the data loaded with ajax, and I am not sure, but I suspect there might be issues trying to parse the json after it has been inserted into html.

Do you see a problem with having a content type that is specific for json data, or other data that you don't want to be directly inserted into the page?

I also came to like the ability to pass the wrapping div directly to the callback for manipulation. That could easily be done for the other content types as well, and I think improves the usability of the system.

chawkinsuf commented 10 years ago

Do you have an interest in integrating these updates into the project? Are there modifications to my pull request you would suggest before you would pull them?