AnantLabs / jpicker

Automatically exported from code.google.com/p/jpicker
0 stars 0 forks source link

Hidden (display:none) block elements are not instantiated on page load. #17

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a binding picker.
2. Set its style="display:none;"
3. Instantiate the picker on page load and then display:block; the element. The 
picker is not initialized. 

What is the expected output? What do you see instead?
I expected the picker to be instantiated. 

What version of the product are you using? On what operating system?
Latest (1.6) running off a BSD server running apache. 

Please provide any additional information below.
I have a complicated form so I'm hiding most elements on page load. To fix the 
issue I needed to allow all elements to be briefly visible on page load (very 
ugly) and setTimeout() a function after 2 seconds to close them all. Then all 
the pickers were instantiated. 

Would love to know a better way to instantiate them dynamically and dispose of 
them if not needed programatically but I do not see a method to dispose of an 
instance in the API. 

Original issue reported on code.google.com by jasonala...@gmail.com on 28 Mar 2011 at 1:40

GoogleCodeExporter commented 9 years ago
I think this is also affecting the location of my hidden elements. I am 
manually reinitializing them on load of the hidden area. But then the color 
picker dialog is off the screen

Original comment by oll...@gmail.com on 6 Apr 2011 at 4:39

GoogleCodeExporter commented 9 years ago
Location is also not dynamic as mentioned. If any elements position change, the 
picker will not update its location. It makes it difficult for input bound 
elements where the user expects the picker to be somewhere close. Many times 
due to dynamic form changes the picker opens up out of view and I need to 
scroll up and down the page to find it.

Original comment by jasonala...@gmail.com on 6 Apr 2011 at 4:48

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

It seems that jpicker is started, but it is off the screen.

Oddly enough, if you set display is to none by user triggered javascript, 
positioning still works.  But if you have a javascript trigger at the end of 
the page, it does not work.

Go to:
http://www.clickaboutme.com/sigbox/sigbox.php
Click 'icons' and then 'tab' and you'll see this.

Original comment by iateado...@gmail.com on 8 Aug 2011 at 9:49

GoogleCodeExporter commented 9 years ago
I fixed this behavier with this script. It is not nice but it works.

    $(document).delegate('span.jPicker', 'click', function() {
        var els = $('.jPicker.Container');
        for(var i = 0; i < $.jPicker.List.length; i++) {
            var o = $($.jPicker.List[i]).offset();
            $(els.get(i)).offset({top: o.top - 50, left: o.left + 100});
        }
    });

But in general picker should monitor the position of linked input field and 
refresh the container offsets

Original comment by Yaroslav...@gmail.com on 4 Aug 2013 at 10:45