简体   繁体   English

jQuery插件冲突

[英]jQuery plug-in conflict

So, today I have one more question: HOW I COULD I HAVE BROKEN MASONRY JQUERY AND FANCYBOX (LIGHTBOX) ?所以,今天我还有一个问题:我怎么能破坏砌体 JQUERYFANCYBOX(灯箱)

I really need this.我真的需要这个。 I have lost few hours trying solve this by myself, but i really can't.我已经失去了几个小时试图自己解决这个问题,但我真的做不到。 :/ :/

This is my script where I'm calling fancybox and masonry:这是我的脚本,我将其称为 fancybox 和 masonry:

<script type="text/javascript">
        $(function(){
            var $container = $("#galeria");
            $container.imagesLoaded(function(){
                $container.masonry({
                itemSelector : 'li',
                columnWidth : 200
                });
            });
        });
       $(document).ready(function() {
            $("#pre-enviar-imagem").fancybox({
                'padding'       : 0,
                'centerOnScroll' : true
            });

            $("a#pictures").fancybox({
                    'transitionIn' : 'none',
                    'transitionOut' : 'none',
                    'changeSpeed' : 0,
                    'changeFade' :    0,
                    'padding'       : 0,
                    'titlePosition' : 'over',
                    'onComplete'    :   function() {
                            $("#galeria-wrap").hover(function() {
                                    $("#galeria-title").show();
                            }, function() {
                                    $("#galeria-title").hide();
                            });
                    }
            });
          });
   </script>

To be brief, my problem is on overlapping, but as you can see, I'm already using imagesLoaded plug-in, and more.简而言之,我的问题在于重叠,但正如您所见,我已经在使用 imagesLoaded 插件等等。 I already tried to set all of images width/height, but it still doesn't work.我已经尝试设置所有图像的宽度/高度,但它仍然不起作用。

Thank you.谢谢你。

I need to press the mouse scroll to work.我需要按鼠标滚动才能工作。 Ideas?想法?

I rewritten your code:我重写了你的代码:

<script type="text/javascript">
    $.noConflict();
    $(function(){
        var $container = $("#galeria");
        $container.imagesLoaded(function(){
            $container.masonry({
            itemSelector : 'li',
            columnWidth : 200
            });
        });
    });
   jQuery(document).ready(function($) {
        $("#pre-enviar-imagem").fancybox({
            'padding'       : 0,
            'centerOnScroll' : true
        });

        $("a#pictures").fancybox({
                'transitionIn' : 'none',
                'transitionOut' : 'none',
                'changeSpeed' : 0,
                'changeFade' :    0,
                'padding'       : 0,
                'titlePosition' : 'over',
                'onComplete'    :   function() {
                        $("#galeria-wrap").hover(function() {
                                $("#galeria-title").show();
                        }, function() {
                                $("#galeria-title").hide();
                        });
                }
        });
      });
</script>

Hope this works on you.希望这对你有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM