colorbox icon indicating copy to clipboard operation
colorbox copied to clipboard

Issue with jQuery UI datepicker inside colorbox

Open menacestudio opened this issue 13 years ago • 7 comments

I'm basically injecting raw HTML into colorbox's HTML property and calling the onComplete function to add datepicker. It works for inline, but not when using the HTML property. Is this an existing bug or is it an issue with the datepicker itself?

onComplete: function() {
     $(".datebox").datepicker({
              changeMonth: true,
              changeYear: true,
              ...

menacestudio avatar Aug 15 '13 05:08 menacestudio

I don't see any reason why they would behave differently. Can you post a simple demo of your issue with using the html property? I don't have the time at the moment to put together a test case.

jackmoore avatar Aug 15 '13 06:08 jackmoore

Here's a simple demo of a datepicker on a colorbox. http://menacestudio.com/colorbox/ The datepicker works but the month and year selection doesn't.

I'm also using moment, backbone, underscore if that helps. Thanks!

menacestudio avatar Aug 15 '13 17:08 menacestudio

I visited your page using Chrome on Mac and didn't experience any issues. I could change the month and year while Colorbox was open. Was this an issue with a particular browser? Also, try setting Colorbox's trapFocus property to false to see if that resolves the issue (I didn't have to do this, but it could be an issue with another browser).

jackmoore avatar Aug 17 '13 04:08 jackmoore

I visited the page and found the following:

On FF 23.0.1: The month and year selects would not open and I could not select from them. I could pick a day and the arrows beside the month/year worked.

On Chrome 28.0.15: Everything seemed to work fine.

EleventyOne avatar Aug 17 '13 14:08 EleventyOne

Thanks EleventyOne. I tried with FF and experienced that same issue. Then I set the trapFocus property to false and that seemed to resolve it.

jackmoore avatar Aug 17 '13 19:08 jackmoore

Yup that worked! Thanks guys!

menacestudio avatar Aug 17 '13 20:08 menacestudio

I got the same issue. I used an id as selector, but colorbox duplicate the whole html content and the id's too. So if I use $('#myid').doSomething() I got an error, because "myid" was duplicated. Thats the issus.

Use a better selector like $('#colorbox .myidasclass').doSomething() to solve the issue. The same problem is with class selector without the '#colorbox' as additional selector.

sl8ar2rk avatar Nov 30 '18 16:11 sl8ar2rk