rvera / image-picker

Image Picker is a simple jQuery plugin that transforms a select element into a more user friendly graphical interface.
http://rvera.github.com/image-picker
Other
906 stars 216 forks source link

Additional inputs in titles issue #75

Closed SgtOddball closed 8 years ago

SgtOddball commented 8 years ago

I've done abit of a hack to allow the data-img-label value to allow additional inputs to be added in when the form is submitted (it works pretty well because the original select box still exists after all so any options can be submitted separately and then just loop through the associated form array at the server side).

I'm having an issue with click propagation where clicking on a select/check/radio elements causes the picture to change it's state.

I've tried preventing the propagation through using initialise or clicked options but no dice so far.

I've tried using 'stopPropagation()` directly on the elements but again no luck so far.

SgtOddball commented 8 years ago

Nevermind, figured it out.

Using the initialized option pass in the following as a function;

    initialized: function(e){ 
        $('input,select').each(function(){
        //loops through any input/selects and applies the following;
            $(this).click(function(event){
                //Prevents the click event propagating down to the initial element created by image-picker. This allows options to be set without interference. 
                event.stopImmediatePropagation();
             })
        })
    }
rvera commented 8 years ago

@SgtOddball you never cease to be awesome.

I've been meaning to update the project with a couple of features for a while, anything you think should be on the list?

SgtOddball commented 8 years ago

Nothing springs to mind outside of the lightbox popup I've got running on a double click but again it's abit hacky (it was using the initialize function above which was what gave me the brainwave as to how to address the issue).

Other than that everything works as it should and plays nicely with all the rest of the plugins and soforth that I've written/modified/bodged....