ericjgagnon / wickedpicker

A simple jQuery timepicker
http://ericjgagnon.github.io/wickedpicker/
MIT License
93 stars 78 forks source link

Clicking the Picker textbox wont open the Time picker #81

Open pankajmehra009 opened 5 years ago

pankajmehra009 commented 5 years ago

In case there are 2 or more Pickers on a page and one of them is open, On clicking any other picker textbox wont open the picker for that textbox.

Expected is when we click a textbox then picker for that textbox should popup and the already open should close.

I added below code for it but IE11 page freezes:

      $('.bc-c-selectTime__input.js-clock').on('click', function() {
            if($(".wickedpicker:visible").length > 0 &&
               ($(".wickedpicker").offset().left !=  $(this).offset().left
                || $(".wickedpicker").offset().top !=  $(this).offset().top + $(this).height()
                )
               ){
                    $('.bc-c-selectTime__input.js-clock').wickedpicker("hide")
                    $(this).trigger('click');
            }
        });
pankajmehra009 commented 5 years ago

to fix the above issue, I added a function in wicked.min.js

_showWPicker:function(e){this.showPicker(e);window.lastTimePickerControl=$(this);}

After _hide method.

and calling from the HTML as

        $('.bc-c-selectTime__input.js-clock').on('click', function(event) {                    
            if($(".wickedpicker:visible").length > 0 &&
               ($(".wickedpicker").offset().left !=  $(this).offset().left
                || $(".wickedpicker").offset().top !=  $(this).offset().top + $(this).height()
                )
               ){
                $(this).wickedpicker('showWPicker', 0 ,$(this));
            }
        });

Hope this helps!