-
Notifications
You must be signed in to change notification settings - Fork 82
/
jquery.tip_cards.min.js
1 lines (1 loc) · 7.6 KB
/
jquery.tip_cards.min.js
1
!function(e){var t={entrance:"bottom",column:4,margin:"1%",selector:"> li",hoverTilt:"right",triggerSelector:"> li a",cardFlyDirection:"all",closeButton:"X",flipButton:"Flip",navigation:true,beforeOpen:null,afterOpen:null};e.fn.tip_cards=function(n){function s(){if(e(".tc_card.active").prev(".tc_card").length<1){e(".tc_modal_open .tc_prev").addClass("tc_entrance")}else{e(".tc_modal_open .tc_prev").removeClass("tc_entrance")}if(e(".tc_card.active").next(".tc_card").length<1){e(".tc_modal_open .tc_next").addClass("tc_entrance")}else{e(".tc_modal_open .tc_next").removeClass("tc_entrance")}}function o(){var t=100;e(".tc_fake1").addClass("tc_straighten").css({position:"absolute",top:(e(window).height()-e(".tc_modal").height())/2+e(window).scrollTop()+16+"px",left:(e(window).width()-e(".tc_modal").width())/2+e(window).scrollLeft()+"px","-webkit-transform":"scale(0.96)","-moz-transform":"scale(0.96)","-o-transform":"scale(0.96)",transform:"scale(0.96)"});setTimeout(function(){e(".tc_fake2").addClass("tc_straighten").css({position:"absolute",top:(e(window).height()-e(".tc_modal").height())/2+e(window).scrollTop()+12+"px",left:(e(window).width()-e(".tc_modal").width())/2+e(window).scrollLeft()+"px","-webkit-transform":"scale(0.97)","-moz-transform":"scale(0.97)","-o-transform":"scale(0.97)",transform:"scale(0.97)"});setTimeout(function(){e(".tc_fake3").addClass("tc_straighten").css({position:"absolute",top:(e(window).height()-e(".tc_modal").height())/2+e(window).scrollTop()+8+"px",left:(e(window).width()-e(".tc_modal").width())/2+e(window).scrollLeft()+"px","-webkit-transform":"scale(0.98)","-moz-transform":"scale(0.98)","-o-transform":"scale(0.98)",transform:"scale(0.98)"});setTimeout(function(){e(".tc_fake4").addClass("tc_straighten").css({position:"absolute",top:(e(window).height()-e(".tc_modal").height())/2+e(window).scrollTop()+4+"px",left:(e(window).width()-e(".tc_modal").width())/2+e(window).scrollLeft()+"px","-webkit-transform":"scale(0.99)","-moz-transform":"scale(0.99)","-o-transform":"scale(0.99)",transform:"scale(0.99)"});setTimeout(function(){e(".tc_main_modal").css({position:"absolute",top:(e(window).height()-e(".tc_modal").height())/2+e(window).scrollTop()+"px",left:(e(window).width()-e(".tc_modal").width())/2+e(window).scrollLeft()+"px",bottom:"auto",right:"auto",visibility:"visible"});setTimeout(function(){e(".tc_main_modal .tc_inner_modal").removeClass("tc_flipped");if(typeof r.afterOpen=="function")r.afterOpen();s()},500)},t)},t)},t)},t)}var r=e.extend({},t,n),i=e(this);i.addClass("tc_body");e.each(i.find(r.selector),function(t){e(this).addClass("tc_card").hide().css({width:100/r.column-parseInt(r.margin)*2+"%",margin:r.margin}).wrapInner("<div class='tc_inner_card tilt_"+r.hoverTilt+"'></div>");if(e(this).find(".tc_front").length>0){e(this).find(".tc_inner_card").addClass("tc_flipped")}});setTimeout(function(){e.each(i.find(".tc_card"),function(t){var n=e(this);n.addClass("animate tc_entrance_"+r.entrance).show();n.find(".tc_inner_card").prepend("<span class='tc_shadow'></span>");if(n.find(".tc_front").length>0){setTimeout(function(){n.find(".tc_inner_card").removeClass("tc_flipped")},600)}})},100);e(window).resize(function(){o()});i.find(r.triggerSelector).addClass("tc_click_target").click(function(){function i(n){if(n.closeButton!=false){e(".tc_main_modal").prepend("<a class='tc_close' href='#'>"+n.closeButton+"</a>");e(".tc_main_modal .tc_flip_toggle").remove()}if(n.flipButton!=false&&e(".tc_main_modal").find(".tc_front").length>0){e(".tc_main_modal .tc_flip_toggle").remove();e(".tc_main_modal").prepend("<a class='tc_flip_toggle' href='#'>"+n.flipButton+"</a>")}e(".tc_overlay, .tc_close").click(function(){e(".tc_overlay").fadeOut("slow",function(){e(".tc_overlay").remove()});t.closest(".tc_card").removeClass("active");e(".tc_next, .tc_prev").addClass("tc_entrance");e(".tc_next, .tc_prev").one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",function(t){e(".tc_next, .tc_prev").remove()});e(".tc_modal").attr("style","").one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",function(t){e(this).remove();e("body").removeClass("tc_modal_open")});return false});e(".tc_flip_toggle").click(function(){e(".tc_main_modal .tc_inner_modal").toggleClass("tc_flipped");return false})}var t=e(this),n=e(t.attr("href"));t.closest(".tc_card").addClass("active");if(typeof r.beforeOpen=="function")r.beforeOpen();e("body").addClass("tc_modal_open");e("<div class='tc_overlay'></div>").appendTo("body");e("<div class='tc_modal tc_main_modal'><div class='tc_inner_modal'></div></div>").appendTo("body");e(".tc_main_modal .tc_inner_modal").html(n.html());if(e(".tc_main_modal .tc_front").length>0){e(".tc_main_modal .tc_inner_modal").addClass("tc_flipped")}if(r.cardFlyDirection=="all"){e(".tc_main_modal").clone(true).removeClass("tc_main_modal").addClass("tc_fake1 tc_to_top").attr("style","").insertBefore(".tc_main_modal");e(".tc_main_modal").clone(true).removeClass("tc_main_modal").addClass("tc_fake2 tc_to_bottom").attr("style","").insertBefore(".tc_main_modal");e(".tc_main_modal").clone(true).removeClass("tc_main_modal").addClass("tc_fake3 tc_to_left").attr("style","").insertBefore(".tc_main_modal");e(".tc_main_modal").clone(true).removeClass("tc_main_modal").addClass("tc_fake4 tc_to_right").attr("style","").insertBefore(".tc_main_modal")}else{e(".tc_main_modal").clone(true).removeClass("tc_main_modal").addClass("tc_fake1 tc_to_"+r.cardFlyDirection).attr("style","").insertBefore(".tc_main_modal");e(".tc_main_modal").clone(true).removeClass("tc_main_modal").addClass("tc_fake2 tc_to_"+r.cardFlyDirection).attr("style","").insertBefore(".tc_main_modal");e(".tc_main_modal").clone(true).removeClass("tc_main_modal").addClass("tc_fake3 tc_to_"+r.cardFlyDirection).attr("style","").insertBefore(".tc_main_modal");e(".tc_main_modal").clone(true).removeClass("tc_main_modal").addClass("tc_fake4 tc_to_"+r.cardFlyDirection).attr("style","").insertBefore(".tc_main_modal")}i(r);o();if(r.navigation!=false){e("<a class='tc_entrance tc_next' href='#'>»</a>").insertAfter(".tc_overlay");e("<a class='tc_entrance tc_prev' href='#'>«</a>").insertAfter(".tc_overlay")}s();e(".tc_next").click(function(){if(e(".tc_card.active").next(".tc_card").length>0&&!e(this).hasClass("animated")){var t=e(this);t.addClass("animated");var n="<div class='tc_inner_modal'>"+e(e(".tc_card.active").removeClass("active").next(".tc_card").addClass("active").find(".tc_click_target").attr("href")).html()+"</div>";e(".tc_main_modal").addClass("old").clone().removeClass("old").html(n).insertBefore(".tc_main_modal.old");i(r);e(".tc_main_modal.old").addClass("tc_to_bottom force").one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",function(n){e(".tc_main_modal.old.tc_to_bottom").remove();e(".tc_main_modal").removeClass("tc_flipped");t.removeClass("animated");s()})}return false});e(".tc_prev").click(function(){if(e(".tc_card.active").prev(".tc_card").length>0&&!e(this).hasClass("animated")){var t=e(this);t.addClass("animated");var n="<div class='tc_inner_modal'>"+e(e(".tc_card.active").removeClass("active").prev(".tc_card").addClass("active").find(".tc_click_target").attr("href")).html()+"</div>";e(".tc_main_modal").addClass("old").clone().removeClass("old").addClass("tc_to_bottom force").html(n).insertAfter(".tc_main_modal.old");setTimeout(function(){e(".tc_main_modal.tc_to_bottom").removeClass("tc_to_bottom force");e(".tc_main_modal:not(.old)").one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",function(n){e(".tc_main_modal.old").remove();i(r);e(".tc_main_modal").removeClass("tc_flipped");s();t.removeClass("animated")})},100)}return false})})}}(window.jQuery)