mirror of
https://github.com/mdbootstrap/mdb-ui-kit.git
synced 2024-11-14 13:47:11 +03:00
3 lines
1.6 KiB
JavaScript
3 lines
1.6 KiB
JavaScript
!function(a){a.ripples=function(b){function c(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function d(a){a.off(),a.addClass("ripple-out"),a.on("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){a.remove()})}var e={target:".btn:not(.btn-link), .card-image, .navbar a:not(.withoutripple), .nav-tabs a:not(.withoutripple), .withripple"};b=a.extend(e,b),a(document).on("mousedown touchstart",b.target,function(b){if(c()&&"mousedown"==b.type)return!1;a(this).find(".ripple-wrapper").length||a(this).append("<div class=ripple-wrapper></div>");var e,f,g=a(this).find(".ripple-wrapper"),h=g.offset();if(c()){if(b=b.originalEvent,1!==b.touches.length)return;e=b.touches[0].pageX-h.left,f=b.touches[0].pageY-h.top}else e=b.pageX-h.left,f=b.pageY-h.top;var i=a("<div></div>");i.addClass("ripple"),i.css({left:e,top:f}),i.css({"background-color":window.getComputedStyle(a(this)[0]).color}),g.append(i),function(){return window.getComputedStyle(i[0]).opacity}();var j=Math.max(a(this).outerWidth(),a(this).outerHeight())/i.outerWidth()*2.5;i.css({"-ms-transform":"scale("+j+")","-moz-transform":"scale("+j+")","-webkit-transform":"scale("+j+")",transform:"scale("+j+")"}),i.addClass("ripple-on"),i.data("animating","on"),i.data("mousedown","on"),setTimeout(function(){i.data("animating","off"),"off"==i.data("mousedown")&&d(i)},500),g.on("mouseup mouseleave",function(){i.data("mousedown","off"),"off"==i.data("animating")&&d(i)})})},a.fn.ripples=function(){a.ripples({target:a(this)})}}(jQuery);
|
|
//# sourceMappingURL=ripples.min.js.map
|