JAVASCRIPT   83
jquery trans js
Guest on 17th August 2022 12:34:47 AM


  1. /*
  2.  * jQuery Cycle Plugin Transition Definitions
  3.  * This script is a plugin for the jQuery Cycle Plugin
  4.  * Examples and documentation at: http://malsup.com/jquery/cycle/
  5.  * Copyright (c) 2007 M. Alsup
  6.  * Version: 2.02
  7.  * Dual licensed under the MIT and GPL licenses:
  8.  * http://www.opensource.org/licenses/mit-license.php
  9.  * http://www.gnu.org/licenses/gpl.html
  10.  */
  11. jQuery.fn.cycle.transitions.scrollUp = function(d, e, f) {
  12.     d.css('overflow', 'hidden');
  13.     f.before.push(function(a, b, c) {
  14.         jQuery(this).show();
  15.         c.cssBefore.top = b.offsetHeight;
  16.         c.animOut.top = 0 - a.offsetHeight
  17.     });
  18.     f.cssFirst = {
  19.         top: 0
  20.     };
  21.     f.animIn = {
  22.         top: 0
  23.     };
  24.     f.cssAfter = {
  25.         display: 'none'
  26.     }
  27. };
  28. jQuery.fn.cycle.transitions.scrollDown = function(d, e, f) {
  29.     d.css('overflow', 'hidden');
  30.     f.before.push(function(a, b, c) {
  31.         jQuery(this).show();
  32.         c.cssBefore.top = 0 - b.offsetHeight;
  33.         c.animOut.top = a.offsetHeight
  34.     });
  35.     f.cssFirst = {
  36.         top: 0
  37.     };
  38.     f.animIn = {
  39.         top: 0
  40.     };
  41.     f.cssAfter = {
  42.         display: 'none'
  43.     }
  44. };
  45. jQuery.fn.cycle.transitions.scrollLeft = function(d, e, f) {
  46.     d.css('overflow', 'hidden');
  47.     f.before.push(function(a, b, c) {
  48.         jQuery(this).show();
  49.         c.cssBefore.left = b.offsetWidth;
  50.         c.animOut.left = 0 - a.offsetWidth
  51.     });
  52.     f.cssFirst = {
  53.         left: 0
  54.     };
  55.     f.animIn = {
  56.         left: 0
  57.     }
  58. };
  59. jQuery.fn.cycle.transitions.scrollRight = function(d, e, f) {
  60.     d.css('overflow', 'hidden');
  61.     f.before.push(function(a, b, c) {
  62.         jQuery(this).show();
  63.         c.cssBefore.left = 0 - b.offsetWidth;
  64.         c.animOut.left = a.offsetWidth
  65.     });
  66.     f.cssFirst = {
  67.         left: 0
  68.     };
  69.     f.animIn = {
  70.         left: 0
  71.     }
  72. };
  73. jQuery.fn.cycle.transitions.scrollHorz = function(f, g, h) {
  74.     f.css('overflow', 'hidden').width();
  75.     h.before.push(function(a, b, c, d) {
  76.         jQuery(this).show();
  77.         var e = a.offsetWidth,
  78.             nextW = b.offsetWidth;
  79.         c.cssBefore = d ? {
  80.             left: nextW
  81.         } : {
  82.             left: -nextW
  83.         };
  84.         c.animIn.left = 0;
  85.         c.animOut.left = d ? -e : e;
  86.         g.not(a).css(c.cssBefore)
  87.     });
  88.     h.cssFirst = {
  89.         left: 0
  90.     };
  91.     h.cssAfter = {
  92.         display: 'none'
  93.     }
  94. };
  95. jQuery.fn.cycle.transitions.scrollVert = function(f, g, h) {
  96.     f.css('overflow', 'hidden');
  97.     h.before.push(function(a, b, c, d) {
  98.         jQuery(this).show();
  99.         var e = a.offsetHeight,
  100.             nextH = b.offsetHeight;
  101.         c.cssBefore = d ? {
  102.             top: -nextH
  103.         } : {
  104.             top: nextH
  105.         };
  106.         c.animIn.top = 0;
  107.         c.animOut.top = d ? e : -e;
  108.         g.not(a).css(c.cssBefore)
  109.     });
  110.     h.cssFirst = {
  111.         top: 0
  112.     };
  113.     h.cssAfter = {
  114.         display: 'none'
  115.     }
  116. };
  117. jQuery.fn.cycle.transitions.slideX = function(a, b, c) {
  118.     c.animIn = {
  119.         width: 'show'
  120.     };
  121.     c.animOut = {
  122.         width: 'hide'
  123.     }
  124. };
  125. jQuery.fn.cycle.transitions.slideY = function(a, b, c) {
  126.     c.animIn = {
  127.         height: 'show'
  128.     };
  129.     c.animOut = {
  130.         height: 'hide'
  131.     }
  132. };
  133. jQuery.fn.cycle.transitions.shuffle = function(f, g, h) {
  134.     var w = f.css('overflow', 'visible').width();
  135.     g.css({
  136.         left: 0,
  137.         top: 0
  138.     });
  139.     h.before.push(function() {
  140.         jQuery(this).show()
  141.     });
  142.     h.speed = h.speed / 2;
  143.     h.random = 0;
  144.     h.shuffle = h.shuffle || {
  145.         left: -w,
  146.         top: 15
  147.     };
  148.     h.els = [];
  149.     for (var i = 0; i < g.length; i++) h.els.push(g[i]);
  150.     for (var i = 0; i < h.startingSlide; i++) h.els.push(h.els.shift());
  151.     h.fxFn = function(a, b, c, d) {
  152.         var e = jQuery(a);
  153.         e.animate(c.shuffle, c.speedIn, c.easeIn, function() {
  154.             c.els.push(c.els.shift());
  155.             for (var i = 0, len = c.els.length; i < len; i++) jQuery(c.els[i]).css('z-index', len - i);
  156.             e.animate({
  157.                 left: 0,
  158.                 top: 0
  159.             }, c.speedOut, c.easeOut, function() {
  160.                 jQuery(this).hide();
  161.                 if (d) d()
  162.             })
  163.         })
  164.     }
  165. };
  166. jQuery.fn.cycle.transitions.turnUp = function(d, e, f) {
  167.     f.before.push(function(a, b, c) {
  168.         jQuery(this).show();
  169.         c.cssBefore.top = b.cycleH;
  170.         c.animIn.height = b.cycleH
  171.     });
  172.     f.cssFirst = {
  173.         top: 0
  174.     };
  175.     f.cssBefore = {
  176.         height: 0
  177.     };
  178.     f.animIn = {
  179.         top: 0
  180.     };
  181.     f.animOut = {
  182.         height: 0
  183.     };
  184.     f.cssAfter = {
  185.         display: 'none'
  186.     }
  187. };
  188. jQuery.fn.cycle.transitions.turnDown = function(d, e, f) {
  189.     f.before.push(function(a, b, c) {
  190.         jQuery(this).show();
  191.         c.animIn.height = b.cycleH;
  192.         c.animOut.top = a.cycleH
  193.     });
  194.     f.cssFirst = {
  195.         top: 0
  196.     };
  197.     f.cssBefore = {
  198.         top: 0,
  199.         height: 0
  200.     };
  201.     f.animOut = {
  202.         height: 0
  203.     };
  204.     f.cssAfter = {
  205.         display: 'none'
  206.     }
  207. };
  208. jQuery.fn.cycle.transitions.turnLeft = function(d, e, f) {
  209.     f.before.push(function(a, b, c) {
  210.         jQuery(this).show();
  211.         c.cssBefore.left = b.cycleW;
  212.         c.animIn.width = b.cycleW
  213.     });
  214.     f.cssBefore = {
  215.         width: 0
  216.     };
  217.     f.animIn = {
  218.         left: 0
  219.     };
  220.     f.animOut = {
  221.         width: 0
  222.     };
  223.     f.cssAfter = {
  224.         display: 'none'
  225.     }
  226. };
  227. jQuery.fn.cycle.transitions.turnRight = function(d, e, f) {
  228.     f.before.push(function(a, b, c) {
  229.         jQuery(this).show();
  230.         c.animIn.width = b.cycleW;
  231.         c.animOut.left = a.cycleW
  232.     });
  233.     f.cssBefore = {
  234.         left: 0,
  235.         width: 0
  236.     };
  237.     f.animIn = {
  238.         left: 0
  239.     };
  240.     f.animOut = {
  241.         width: 0
  242.     };
  243.     f.cssAfter = {
  244.         display: 'none'
  245.     }
  246. };
  247. jQuery.fn.cycle.transitions.zoom = function(d, e, f) {
  248.     f.cssFirst = {
  249.         top: 0,
  250.         left: 0
  251.     };
  252.     f.cssAfter = {
  253.         display: 'none'
  254.     };
  255.     f.before.push(function(a, b, c) {
  256.         jQuery(this).show();
  257.         c.cssBefore = {
  258.             width: 0,
  259.             height: 0,
  260.             top: b.cycleH / 2,
  261.             left: b.cycleW / 2
  262.         };
  263.         c.animIn = {
  264.             top: 0,
  265.             left: 0,
  266.             width: b.cycleW,
  267.             height: b.cycleH
  268.         };
  269.         c.animOut = {
  270.             width: 0,
  271.             height: 0,
  272.             top: a.cycleH / 2,
  273.             left: a.cycleW / 2
  274.         }
  275.     })
  276. };
  277. jQuery.fn.cycle.transitions.fadeZoom = function(d, e, f) {
  278.     f.before.push(function(a, b, c) {
  279.         c.cssBefore = {
  280.             width: 0,
  281.             height: 0,
  282.             opacity: 1,
  283.             left: b.cycleW / 2,
  284.             top: b.cycleH / 2,
  285.             zIndex: 1
  286.         };
  287.         c.animIn = {
  288.             top: 0,
  289.             left: 0,
  290.             width: b.cycleW,
  291.             height: b.cycleH
  292.         }
  293.     });
  294.     f.animOut = {
  295.         opacity: 0
  296.     };
  297.     f.cssAfter = {
  298.         zIndex: 0
  299.     }
  300. };

Raw Paste

Login or Register to edit or fork this paste. It's free.