alexander-ruehle / paper-collapse

Collapsible paper cards.
http://bbo-code.com/components/paper-collapse
163 stars 60 forks source link

Have a gallery inside paper-collapse? #4

Closed AMDesign-1 closed 9 years ago

AMDesign-1 commented 9 years ago

Thank you so much for the script it works great and from my testing scales very well. I have one issue, when I put a gallery lightbox inside a collapse-card and then i click it, it opens the gallery lightbox perfect but it closes collapse card. Anyway to have it ignore just the gallery image? Or perhaps a better way to do that?

alexander-ruehle commented 9 years ago

Hello and thank you for your feedback. Im activly working on the next version of this plugin and adding an option to determine a slideup handler. With this you can control which element should be able to toggle the body.

In the meantime you can add an click event handler to your gallery image/button etc... to prevent the click event from bubbling up the DOM tree. I think this link is helpfull http://api.jquery.com/event.stoppropagation/.

Stay tuned ;).

AMDesign-1 commented 9 years ago

Great, cant wait to see the next version! Thanks for the tip!

AMDesign-1 commented 9 years ago

In case someone comes across this issue ill write down what I did.

I am using Blueimp Gallery

And added the code below:

<script>
    $(document).ready(function() {
        document.getElementById('links').onclick = function (event) {
            event.stopPropagation();
            event = event || window.event;
            var target = event.target || event.srcElement,
                link = target.src ? target.parentNode : target,
                options = {index: link, event: event},
                links = this.getElementsByTagName('a');
            blueimp.Gallery(links, options);
        };
    });
</script>
alexander-ruehle commented 9 years ago

Thanks, i appreciate this.