Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

after TB modal is closed the body is not scrollable #28

Open
twentyfortysix opened this issue May 12, 2015 · 2 comments
Open

after TB modal is closed the body is not scrollable #28

twentyfortysix opened this issue May 12, 2015 · 2 comments
Labels

Comments

@twentyfortysix
Copy link

hello

This might not be completely related to CCTM ..
I use the CCTM and also the "Multiple featured image" plugin, which is old but works.

The problem is that you guys use both the TB modal.
Normally when the modal is called within wordpress it adds the "modal-open" class to the body. That hides the scrollbar. One you close the modal it removes the class and makes the body scrollable.

The problem is that if I want to add a secondary featured image to the post it opens old media WP uploader in TB modal view. This action adds the "modal-open" class to the body as well. When I close the modal view it closes but it does not remove the "modal-open" class from the body.

I tried to hooked up a onclick on the close button but without luck. I found out that you use the TB modal as well and load the your thinckbox.js where you unbind from the "#TB_closeWindowButton" the click function.

So I hacked in to your thickbox.js my piece of code:
jQuery("body").removeClass('modal-open');

so it looks like this:

function tb_remove() { jQuery("#TB_imageOff").unbind("click"); jQuery("#TB_closeWindowButton").unbind("click"); jQuery("body").removeClass('modal-open'); // jQuery("#TB_window").fadeOut("fast",function(){jQuery('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();}); jQuery("#TB_window").fadeOut("fast",function(){jQuery('#TB_window,#TB_overlay,#TB_HideSelect').unload("#TB_ajaxContent").unbind().remove();}); jQuery("#TB_load").remove(); if (typeof document.body.style.maxHeight == "undefined") {//if IE 6 jQuery("body","html").css({height: "auto", width: "auto"}); jQuery("html").css("overflow",""); } jQuery(document).unbind('.thickbox'); return false; }

I guess the problem might occur also in cases where you use the modal view within CCTM it self in some cases.. I'm not sure.
My question is, if it is necessary to use the unbind on the close button?
Because if not I can add mine js fix and hook it up on the close button as well without hacking your code.

thanks

@fireproofsocks
Copy link
Member

Yeah, if 2 plugins attempt to tie into the WP media modal window (as the CCTM does for Image or Media custom fields), I can only imagine that problems pop up -- the WP code surrounding that modal window is ugly to say the least. The more I wrestle with it, and the more bugs I file around it, the more convinced I become that the only proper solution is to write my own code to handle the modal and the management of assets.

It would be helpful if you could fork the code and submit a pull request per normal Git contributing practices.

@IanFarrellCreative
Copy link

Did this ever get forked and pulled? I'm happy to have a go at it if nobody else is, be good to get this one fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants