benbarnett / jquery-animate-enhanced

Extend $.animate() to detect CSS transitions for Webkit, Mozilla, IE>=10 and Opera and convert animations automatically.
http://playground.benbarnett.net/jquery-animate-enhanced/
MIT License
1.39k stars 196 forks source link

Conflict with fancybox #127

Closed christian70 closed 11 years ago

christian70 commented 11 years ago

Hello. This jQuery plugin is very useful (I'm using it along with Superslides script) but on the other hand it causes a conflict with Fancybox because it changes the way that script calculates top and left positioning animation. Is there any way to prevent jQuery-Animate-Enhanced from working on divs where Fancybox is expected to be activated? I red the instructions coming with the plugin but I didn't fix it. Any help will be appreciated. Thanx.

christian70 commented 11 years ago

Ok I solved it out by adding manually {avoidCSSTransitions:true} parameter to each animate() function I found in jquery.fancybox.js script. Very rough I know but it works fine.

SoulviES commented 9 years ago

I solved this, add to reposition function (into the jquery.fancybox.js script) a toggle to avoidCSSTransitions when positioning the fancybox.

I really don't like much this solution, but it works.

My code:

    reposition: function(e, onlyAbsolute) {
        var current = F.current,
                wrap = current ? current.wrap : null,
                pos;

        if (wrap) {
            pos = F._getPosition(onlyAbsolute);

            if (e && e.type === 'scroll') {
                delete pos.position;

                wrap.stop(true, true).animate(pos, {avoidCSSTransitions:true}, 200);

            } else {
                $.toggleDisabledByDefault();
                wrap.css(pos);
                setTimeout(function(){
                    $.toggleDisabledByDefault();
                },1);
                current.pos = $.extend({}, current.dim, pos);
            }
        }
    },
benbarnett commented 9 years ago

You can also use the $.toggleDisabledByDefault() on your code, which will automatically disable the plugin. Then you can manually override your animations with { avoidCSSTransitions: false }

intsfanatic commented 7 years ago

Tried your method Ipshal, when scrolling the page via mousewheel, the fancybox window still jumps back and forth between top left and center. Any other solution?