revolution.extension.navigation.js 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984
  1. /********************************************
  2. * REVOLUTION 5.0 EXTENSION - NAVIGATION
  3. * @version: 1.0.3 (25.09.2015)
  4. * @requires jquery.themepunch.revolution.js
  5. * @author ThemePunch
  6. *********************************************/
  7. (function($) {
  8. var _R = jQuery.fn.revolution,
  9. _ISM = _R.is_mobile();
  10. ///////////////////////////////////////////
  11. // EXTENDED FUNCTIONS AVAILABLE GLOBAL //
  12. ///////////////////////////////////////////
  13. jQuery.extend(true,_R, {
  14. hideUnHideNav : function(opt) {
  15. var w = opt.c.width(),
  16. a = opt.navigation.arrows,
  17. b = opt.navigation.bullets,
  18. c = opt.navigation.thumbnails,
  19. d = opt.navigation.tabs;
  20. if (ckNO(a)) biggerNav(opt.c.find('.tparrows'),a.hide_under,w,a.hide_over);
  21. if (ckNO(b)) biggerNav(opt.c.find('.tp-bullets'),b.hide_under,w,b.hide_over);
  22. if (ckNO(c)) biggerNav(opt.c.parent().find('.tp-thumbs'),c.hide_under,w,c.hide_over);
  23. if (ckNO(d)) biggerNav(opt.c.parent().find('.tp-tabs'),d.hide_under,w,d.hide_over);
  24. setONHeights(opt);
  25. },
  26. resizeThumbsTabs : function(opt) {
  27. if ((opt.navigation && opt.navigation.tabs.enable) || (opt.navigation && opt.navigation.thumbnails.enable)) {
  28. var f = (jQuery(window).width()-480) / 500,
  29. tws = new punchgs.TimelineLite(),
  30. otab = opt.navigation.tabs,
  31. othu = opt.navigation.thumbnails;
  32. tws.pause();
  33. f = f>1 ? 1 : f<0 ? 0 : f;
  34. if (ckNO(otab) && otab.width>otab.min_width) rtt(f,tws,opt.c,otab,opt.slideamount,'tab');
  35. if (ckNO(othu) && othu.width>othu.min_width) rtt(f,tws,opt.c,othu,opt.slideamount,'thumb');
  36. tws.play();
  37. setONHeights(opt);
  38. }
  39. return true;
  40. },
  41. // PUT NAVIGATION IN POSITION AND MAKE SURE THUMBS AND TABS SHOWING TO THE RIGHT POSITION
  42. manageNavigation : function(opt) {
  43. var lof = _R.getHorizontalOffset(opt.c.parent(),"left"),
  44. rof = _R.getHorizontalOffset(opt.c.parent(),"right");
  45. if (ckNO(opt.navigation.bullets)) {
  46. if (opt.sliderLayout!="fullscreen" && opt.sliderLayout!="fullwidth") {
  47. // OFFSET ADJUSTEMENT FOR LEFT ARROWS BASED ON THUMBNAILS AND TABS OUTTER
  48. opt.navigation.bullets.h_offset_old = opt.navigation.bullets.h_offset_old === undefined ? opt.navigation.bullets.h_offset : opt.navigation.bullets.h_offset_old;
  49. opt.navigation.bullets.h_offset = opt.navigation.bullets.h_align==="center" ? opt.navigation.bullets.h_offset_old+lof/2 -rof/2: opt.navigation.bullets.h_offset_old+lof-rof;
  50. }
  51. setNavElPositions(opt.c.find('.tp-bullets'),opt.navigation.bullets);
  52. }
  53. if (ckNO(opt.navigation.thumbnails))
  54. setNavElPositions(opt.c.parent().find('.tp-thumbs'),opt.navigation.thumbnails);
  55. if (ckNO(opt.navigation.tabs))
  56. setNavElPositions(opt.c.parent().find('.tp-tabs'),opt.navigation.tabs);
  57. if (ckNO(opt.navigation.arrows)) {
  58. if (opt.sliderLayout!="fullscreen" && opt.sliderLayout!="fullwidth") {
  59. // OFFSET ADJUSTEMENT FOR LEFT ARROWS BASED ON THUMBNAILS AND TABS OUTTER
  60. opt.navigation.arrows.left.h_offset_old = opt.navigation.arrows.left.h_offset_old === undefined ? opt.navigation.arrows.left.h_offset : opt.navigation.arrows.left.h_offset_old;
  61. opt.navigation.arrows.left.h_offset = opt.navigation.arrows.left.h_align==="right" ? opt.navigation.arrows.left.h_offset_old+rof : opt.navigation.arrows.left.h_offset_old+lof;
  62. opt.navigation.arrows.right.h_offset_old = opt.navigation.arrows.right.h_offset_old === undefined ? opt.navigation.arrows.right.h_offset : opt.navigation.arrows.right.h_offset_old;
  63. opt.navigation.arrows.right.h_offset = opt.navigation.arrows.right.h_align==="right" ? opt.navigation.arrows.right.h_offset_old+rof : opt.navigation.arrows.right.h_offset_old+lof;
  64. }
  65. setNavElPositions(opt.c.find('.tp-leftarrow.tparrows'),opt.navigation.arrows.left);
  66. setNavElPositions(opt.c.find('.tp-rightarrow.tparrows'),opt.navigation.arrows.right);
  67. }
  68. if (ckNO(opt.navigation.thumbnails))
  69. moveThumbsInPosition(opt.c.parent().find('.tp-thumbs'),opt.navigation.thumbnails);
  70. if (ckNO(opt.navigation.tabs))
  71. moveThumbsInPosition(opt.c.parent().find('.tp-tabs'),opt.navigation.tabs);
  72. },
  73. // MANAGE THE NAVIGATION
  74. createNavigation : function(container,opt) {
  75. var cp = container.parent(),
  76. _a = opt.navigation.arrows, _b = opt.navigation.bullets, _c = opt.navigation.thumbnails, _d = opt.navigation.tabs,
  77. a = ckNO(_a), b = ckNO(_b), c = ckNO(_c), d = ckNO(_d);
  78. // Initialise Keyboard Navigation if Option set so
  79. initKeyboard(container,opt);
  80. // Initialise Mouse Scroll Navigation if Option set so
  81. initMouseScroll(container,opt);
  82. //Draw the Arrows
  83. if (a) initArrows(container,_a,opt);
  84. // BUILD BULLETS, THUMBS and TABS
  85. opt.li.each(function(index) {
  86. var li = jQuery(this);
  87. if (b) addBullet(container,_b,li,opt);
  88. if (c) addThumb(container,_c,li,'tp-thumb',opt);
  89. if (d) addThumb(container,_d,li,'tp-tab',opt);
  90. });
  91. // LISTEN TO SLIDE CHANGE - SET ACTIVE SLIDE BULLET
  92. container.bind('revolution.slide.onafterswap revolution.nextslide.waiting',function() {
  93. //cp.find('.tp-bullet, .tp-thumb, .tp-tab').removeClass("selected");
  94. var si = container.find(".next-revslide").length==0 ? container.find(".active-revslide").data("index") : container.find(".next-revslide").data("index");
  95. container.find('.tp-bullet').each(function() {
  96. var _t = jQuery(this);
  97. if (_t.data('liref')===si)
  98. _t.addClass("selected");
  99. else
  100. _t.removeClass("selected");
  101. });
  102. cp.find('.tp-thumb, .tp-tab').each(function() {
  103. var _t = jQuery(this);
  104. if (_t.data('liref')===si) {
  105. _t.addClass("selected");
  106. if (_t.hasClass("tp-tab"))
  107. moveThumbsInPosition(cp.find('.tp-tabs'),_d);
  108. else
  109. moveThumbsInPosition(cp.find('.tp-thumbs'),_c);
  110. } else
  111. _t.removeClass("selected");
  112. });
  113. var ai = 0,
  114. f = false;
  115. if (opt.thumbs)
  116. jQuery.each(opt.thumbs,function(i,obj) {
  117. ai = f === false ? i : ai;
  118. f = obj.id === si || i === si ? true : f;
  119. });
  120. var pi = ai>0 ? ai-1 : opt.slideamount-1,
  121. ni = (ai+1)==opt.slideamount ? 0 : ai+1;
  122. if (_a.enable === true) {
  123. var inst = _a.tmp;
  124. jQuery.each(opt.thumbs[pi].params,function(i,obj) {
  125. inst = inst.replace(obj.from,obj.to);
  126. });
  127. _a.left.j.html(inst);
  128. inst = _a.tmp;
  129. jQuery.each(opt.thumbs[ni].params,function(i,obj) {
  130. inst = inst.replace(obj.from,obj.to);
  131. });
  132. _a.right.j.html(inst);
  133. punchgs.TweenLite.set(_a.left.j.find('.tp-arr-imgholder'),{backgroundImage:"url("+opt.thumbs[pi].src+")"});
  134. punchgs.TweenLite.set(_a.right.j.find('.tp-arr-imgholder'),{backgroundImage:"url("+opt.thumbs[ni].src+")"});
  135. }
  136. });
  137. hdResets(_a);
  138. hdResets(_b);
  139. hdResets(_c);
  140. hdResets(_d);
  141. // HOVER OVER ELEMENTS SHOULD SHOW/HIDE NAVIGATION ELEMENTS
  142. cp.on("mouseenter mousemove",function() {
  143. if (!cp.hasClass("tp-mouseover")) {
  144. cp.addClass("tp-mouseover");
  145. punchgs.TweenLite.killDelayedCallsTo(showHideNavElements);
  146. if (a && _a.hide_onleave) showHideNavElements(cp.find('.tparrows'),_a,"show");
  147. if (b && _b.hide_onleave) showHideNavElements(cp.find('.tp-bullets'),_b,"show");
  148. if (c && _c.hide_onleave) showHideNavElements(cp.find('.tp-thumbs'),_c,"show");
  149. if (d && _d.hide_onleave) showHideNavElements(cp.find('.tp-tabs'),_d,"show");
  150. // ON MOBILE WE NEED TO HIDE ELEMENTS EVEN AFTER TOUCH
  151. if (_ISM) {
  152. cp.removeClass("tp-mouseover");
  153. callAllDelayedCalls(container,opt);
  154. }
  155. }
  156. });
  157. cp.on("mouseleave",function() {
  158. cp.removeClass("tp-mouseover");
  159. callAllDelayedCalls(container,opt);
  160. });
  161. // FIRST RUN HIDE ALL ELEMENTS
  162. if (a && _a.hide_onleave) showHideNavElements(cp.find('.tparrows'),_a,"hide",0);
  163. if (b && _b.hide_onleave) showHideNavElements(cp.find('.tp-bullets'),_b,"hide",0);
  164. if (c && _c.hide_onleave) showHideNavElements(cp.find('.tp-thumbs'),_c,"hide",0);
  165. if (d && _d.hide_onleave) showHideNavElements(cp.find('.tp-tabs'),_d,"hide",0);
  166. // Initialise Swipe Navigation
  167. if (c) swipeAction(cp.find('.tp-thumbs'),opt);
  168. if (d) swipeAction(cp.find('.tp-tabs'),opt);
  169. if (opt.sliderType==="carousel") swipeAction(container,opt,true);
  170. if (opt.navigation.touch.touchenabled=="on") swipeAction(container,opt,"swipebased");
  171. }
  172. });
  173. /////////////////////////////////
  174. // - INTERNAL FUNCTIONS - ///
  175. /////////////////////////////////
  176. var moveThumbsInPosition = function(container,opt) {
  177. var thumbs = container.hasClass("tp-thumbs") ? ".tp-thumbs" : ".tp-tabs",
  178. thumbmask = container.hasClass("tp-thumbs") ? ".tp-thumb-mask" : ".tp-tab-mask",
  179. thumbsiw = container.hasClass("tp-thumbs") ? ".tp-thumbs-inner-wrapper" : ".tp-tabs-inner-wrapper",
  180. thumb = container.hasClass("tp-thumbs") ? ".tp-thumb" : ".tp-tab",
  181. t=container.find(thumbmask),
  182. el = t.find(thumbsiw),
  183. thumbdir = opt.direction,
  184. tw = thumbdir==="vertical" ? t.find(thumb).first().outerHeight(true)+opt.space : t.find(thumb).first().outerWidth(true)+opt.space,
  185. tmw = thumbdir==="vertical" ? t.height() : t.width(),
  186. ti = parseInt(t.find(thumb+'.selected').data('liindex'),0),
  187. me = tmw/tw,
  188. ts = thumbdir==="vertical" ? t.height() : t.width(),
  189. tp = 0-(ti * tw),
  190. els = thumbdir==="vertical" ? el.height() : el.width(),
  191. curpos = tp < 0-(els-ts) ? 0-(els-ts) : curpos > 0 ? 0 : tp,
  192. elp = el.data('offset');
  193. if (me>2) {
  194. curpos = tp - (elp+tw) <= 0 ? tp - (elp+tw) < 0-tw ? elp : curpos + tw : curpos;
  195. curpos = ( (tp-tw + elp + tmw)< tw && tp + (Math.round(me)-2)*tw < elp) ? tp + (Math.round(me)-2)*tw : curpos;
  196. }
  197. curpos = curpos < 0-(els-ts) ? 0-(els-ts) : curpos > 0 ? 0 : curpos;
  198. if (thumbdir!=="vertical" && t.width()>=el.width()) curpos = 0;
  199. if (thumbdir==="vertical" && t.height()>=el.height()) curpos = 0;
  200. if (!container.hasClass("dragged")) {
  201. if (thumbdir==="vertical")
  202. el.data('tmmove',punchgs.TweenLite.to(el,0.5,{top:curpos+"px",ease:punchgs.Power3.easeInOut}));
  203. else
  204. el.data('tmmove',punchgs.TweenLite.to(el,0.5,{left:curpos+"px",ease:punchgs.Power3.easeInOut}));
  205. el.data('offset',curpos);
  206. }
  207. };
  208. // RESIZE THE THUMBS BASED ON ORIGINAL SIZE AND CURRENT SIZE OF WINDOW
  209. var rtt = function(f,tws,c,o,lis,wh) {
  210. var h = c.parent().find('.tp-'+wh+'s'),
  211. ins = h.find('.tp-'+wh+'s-inner-wrapper'),
  212. mask = h.find('.tp-'+wh+'-mask'),
  213. cw = o.width*f < o.min_width ? o.min_width : Math.round(o.width*f),
  214. ch = Math.round((cw/o.width) * o.height),
  215. iw = o.direction === "vertical" ? cw : (cw*lis) + ((o.space)*(lis-1)),
  216. ih = o.direction === "vertical" ? (ch*lis) + ((o.space)*(lis-1)) : ch,
  217. anm = o.direction === "vertical" ? {width:cw+"px"} : {height:ch+"px"};
  218. tws.add(punchgs.TweenLite.set(h,anm));
  219. tws.add(punchgs.TweenLite.set(ins,{width:iw+"px",height:ih+"px"}));
  220. tws.add(punchgs.TweenLite.set(mask,{width:iw+"px",height:ih+"px"}));
  221. var fin = ins.find('.tp-'+wh+'');
  222. if (fin)
  223. jQuery.each(fin,function(i,el) {
  224. if (o.direction === "vertical")
  225. tws.add(punchgs.TweenLite.set(el,{top:(i*(ch+parseInt((o.space===undefined? 0:o.space),0))),width:cw+"px",height:ch+"px"}));
  226. else
  227. if (o.direction === "horizontal")
  228. tws.add(punchgs.TweenLite.set(el,{left:(i*(cw+parseInt((o.space===undefined? 0:o.space),0))),width:cw+"px",height:ch+"px"}));
  229. });
  230. return tws;
  231. };
  232. // INTERNAL FUNCTIONS
  233. var normalizeWheel = function( event) /*object*/ {
  234. var sX = 0, sY = 0, // spinX, spinY
  235. pX = 0, pY = 0, // pixelX, pixelY
  236. PIXEL_STEP = 1,
  237. LINE_HEIGHT = 1,
  238. PAGE_HEIGHT = 1;
  239. // Legacy
  240. if ('detail' in event) { sY = event.detail; }
  241. if ('wheelDelta' in event) { sY = -event.wheelDelta / 120; }
  242. if ('wheelDeltaY' in event) { sY = -event.wheelDeltaY / 120; }
  243. if ('wheelDeltaX' in event) { sX = -event.wheelDeltaX / 120; }
  244. //sY = navigator.userAgent.match(/mozilla/i) ? sY*10 : sY;
  245. // side scrolling on FF with DOMMouseScroll
  246. if ( 'axis' in event && event.axis === event.HORIZONTAL_AXIS ) {
  247. sX = sY;
  248. sY = 0;
  249. }
  250. pX = sX * PIXEL_STEP;
  251. pY = sY * PIXEL_STEP;
  252. if ('deltaY' in event) { pY = event.deltaY; }
  253. if ('deltaX' in event) { pX = event.deltaX; }
  254. if ((pX || pY) && event.deltaMode) {
  255. if (event.deltaMode == 1) { // delta in LINE units
  256. pX *= LINE_HEIGHT;
  257. pY *= LINE_HEIGHT;
  258. } else { // delta in PAGE units
  259. pX *= PAGE_HEIGHT;
  260. pY *= PAGE_HEIGHT;
  261. }
  262. }
  263. // Fall-back if spin cannot be determined
  264. if (pX && !sX) { sX = (pX < 1) ? -1 : 1; }
  265. if (pY && !sY) { sY = (pY < 1) ? -1 : 1; }
  266. pY = navigator.userAgent.match(/mozilla/i) ? pY*10 : pY;
  267. if (pY>300 || pY<-300) pY = pY/10;
  268. return { spinX : sX,
  269. spinY : sY,
  270. pixelX : pX,
  271. pixelY : pY };
  272. };
  273. var initKeyboard = function(container,opt) {
  274. if (opt.navigation.keyboardNavigation!=="on") return;
  275. jQuery(document).keydown(function(e){
  276. if ((opt.navigation.keyboard_direction=="horizontal" && e.keyCode == 39) || (opt.navigation.keyboard_direction=="vertical" && e.keyCode==40)) {
  277. opt.sc_indicator="arrow";
  278. opt.sc_indicator_dir = 0;
  279. _R.callingNewSlide(opt,container,1);
  280. }
  281. if ((opt.navigation.keyboard_direction=="horizontal" && e.keyCode == 37) || (opt.navigation.keyboard_direction=="vertical" && e.keyCode==38)) {
  282. opt.sc_indicator="arrow";
  283. opt.sc_indicator_dir = 1;
  284. _R.callingNewSlide(opt,container,-1);
  285. }
  286. });
  287. };
  288. var initMouseScroll = function(container,opt) {
  289. if (opt.navigation.mouseScrollNavigation!=="on") return;
  290. var bl = navigator.userAgent.match(/mozilla/i) ? -29 : -49,
  291. tl = navigator.userAgent.match(/mozilla/i) ? 29 : 49;
  292. container.on('mousewheel DOMMouseScroll', function(e) {
  293. var res = normalizeWheel(e.originalEvent),
  294. asi = container.find('.tp-revslider-slidesli.active-revslide').index(),
  295. psi = container.find('.tp-revslider-slidesli.processing-revslide').index(),
  296. fs = asi!=-1 && asi==0 || psi!=-1 && psi==0 ? true : false,
  297. ls = asi!=-1 && asi==opt.slideamount-1 || psi!=1 && psi==opt.slideamount-1 ? true:false;
  298. if (psi==-1) {
  299. if(res.pixelY<bl) {
  300. if (!fs) {
  301. opt.sc_indicator="arrow";
  302. opt.sc_indicator_dir = 0;
  303. _R.callingNewSlide(opt,container,-1);
  304. return false;
  305. }
  306. }
  307. else
  308. if(res.pixelY>tl) {
  309. if (!ls) {
  310. opt.sc_indicator="arrow";
  311. opt.sc_indicator_dir = 1;
  312. _R.callingNewSlide(opt,container,1);
  313. return false;
  314. }
  315. }
  316. } else {
  317. if (!ls)
  318. return false;
  319. }
  320. e.preventDefault();
  321. });
  322. };
  323. var isme = function (a,c,e) {
  324. a = _ISM ? jQuery(e.target).closest('.'+a).length || jQuery(e.srcElement).closest('.'+a).length : jQuery(e.toElement).closest('.'+a).length || jQuery(e.originalTarget).closest('.'+a).length;
  325. return a === true || a=== 1 ? 1 : 0;
  326. };
  327. // - SET THE SWIPE FUNCTION //
  328. var swipeAction = function(container,opt,vertical) {
  329. container.data('opt',opt);
  330. // TOUCH ENABLED SCROLL
  331. var _ = opt.carousel;
  332. jQuery(".bullet, .bullets, .tp-bullets, .tparrows").addClass("noSwipe");
  333. _.Limit = "endless";
  334. var notonbody = _ISM || _R.get_browser()==="Firefox",
  335. SwipeOn = container, //notonbody ? container : jQuery('body'),
  336. pagescroll = opt.navigation.thumbnails.direction==="vertical" || opt.navigation.tabs.direction==="vertical"? "none" : "vertical",
  337. swipe_wait_dir = opt.navigation.touch.swipe_direction || "horizontal";
  338. pagescroll = vertical == "swipebased" && swipe_wait_dir=="vertical" ? "none" : vertical ? "vertical" : pagescroll;
  339. if (!jQuery.fn.swipetp) jQuery.fn.swipetp = jQuery.fn.swipe;
  340. if (!jQuery.fn.swipetp.defaults || !jQuery.fn.swipetp.defaults.excludedElements) {
  341. if (!jQuery.fn.swipetp.defaults)
  342. jQuery.fn.swipetp.defaults = new Object();
  343. jQuery.fn.swipetp.defaults.excludedElements = "label, button, input, select, textarea, a, .noSwipe"
  344. }
  345. SwipeOn.swipetp({
  346. allowPageScroll:pagescroll,
  347. triggerOnTouchLeave:true,
  348. excludeElements:jQuery.fn.swipetp.defaults.excludedElements,
  349. swipeStatus:function(event,phase,direction,distance,duration,fingerCount,fingerData) {
  350. var withinslider = isme('rev_slider_wrapper',container,event),
  351. withinthumbs = isme('tp-thumbs',container,event),
  352. withintabs = isme('tp-tabs',container,event),
  353. starget = jQuery(this).attr('class'),
  354. istt = starget.match(/tp-tabs|tp-thumb/gi) ? true : false;
  355. // SWIPE OVER SLIDER, TO SWIPE SLIDES IN CAROUSEL MODE
  356. if (opt.sliderType==="carousel" &&
  357. (((phase==="move" || phase==="end" || phase=="cancel") && (opt.dragStartedOverSlider && !opt.dragStartedOverThumbs && !opt.dragStartedOverTabs))
  358. || (phase==="start" && withinslider>0 && withinthumbs===0 && withintabs===0))) {
  359. opt.dragStartedOverSlider = true;
  360. distance = (direction && direction.match(/left|up/g)) ? Math.round(distance * -1) : distance = Math.round(distance * 1);
  361. switch (phase) {
  362. case "start":
  363. if (_.positionanim!==undefined) {
  364. _.positionanim.kill();
  365. _.slide_globaloffset = _.infinity==="off" ? _.slide_offset : _R.simp(_.slide_offset, _.maxwidth);
  366. }
  367. _.overpull = "none";
  368. _.wrap.addClass("dragged");
  369. break;
  370. case "move":
  371. _.slide_offset = _.infinity==="off" ? _.slide_globaloffset + distance : _R.simp(_.slide_globaloffset + distance, _.maxwidth);
  372. if (_.infinity==="off") {
  373. var bb = _.horizontal_align==="center" ? ((_.wrapwidth/2-_.slide_width/2) - _.slide_offset) / _.slide_width : (0 - _.slide_offset) / _.slide_width;
  374. if ((_.overpull ==="none" || _.overpull===0) && (bb<0 || bb>opt.slideamount-1))
  375. _.overpull = distance;
  376. else
  377. if (bb>=0 && bb<=opt.slideamount-1 && ((bb>=0 && distance>_.overpull) || (bb<=opt.slideamount-1 && distance<_.overpull)))
  378. _.overpull = 0;
  379. _.slide_offset = bb<0 ? _.slide_offset+ (_.overpull-distance)/1.1 + Math.sqrt(Math.abs((_.overpull-distance)/1.1)) :
  380. bb>opt.slideamount-1 ? _.slide_offset+ (_.overpull-distance)/1.1 - Math.sqrt(Math.abs((_.overpull-distance)/1.1)) : _.slide_offset ;
  381. }
  382. _R.organiseCarousel(opt,direction,true,true);
  383. break;
  384. case "end":
  385. case "cancel":
  386. //duration !!
  387. _.slide_globaloffset = _.slide_offset;
  388. _.wrap.removeClass("dragged");
  389. _R.carouselToEvalPosition(opt,direction);
  390. opt.dragStartedOverSlider = false;
  391. opt.dragStartedOverThumbs = false;
  392. opt.dragStartedOverTabs = false;
  393. break;
  394. }
  395. } else
  396. // SWIPE OVER THUMBS OR TABS
  397. if ((
  398. ((phase==="move" || phase==="end" || phase=="cancel") && (!opt.dragStartedOverSlider && (opt.dragStartedOverThumbs || opt.dragStartedOverTabs)))
  399. ||
  400. (phase==="start" && (withinslider>0 && (withinthumbs>0 || withintabs>0))))) {
  401. if (withinthumbs>0) opt.dragStartedOverThumbs = true;
  402. if (withintabs>0) opt.dragStartedOverTabs = true;
  403. var thumbs = opt.dragStartedOverThumbs ? ".tp-thumbs" : ".tp-tabs",
  404. thumbmask = opt.dragStartedOverThumbs ? ".tp-thumb-mask" : ".tp-tab-mask",
  405. thumbsiw = opt.dragStartedOverThumbs ? ".tp-thumbs-inner-wrapper" : ".tp-tabs-inner-wrapper",
  406. thumb = opt.dragStartedOverThumbs ? ".tp-thumb" : ".tp-tab",
  407. _o = opt.dragStartedOverThumbs ? opt.navigation.thumbnails : opt.navigation.tabs;
  408. distance = (direction && direction.match(/left|up/g)) ? Math.round(distance * -1) : distance = Math.round(distance * 1);
  409. var t= container.parent().find(thumbmask),
  410. el = t.find(thumbsiw),
  411. tdir = _o.direction,
  412. els = tdir==="vertical" ? el.height() : el.width(),
  413. ts = tdir==="vertical" ? t.height() : t.width(),
  414. tw = tdir==="vertical" ? t.find(thumb).first().outerHeight(true)+_o.space : t.find(thumb).first().outerWidth(true)+_o.space,
  415. newpos = (el.data('offset') === undefined ? 0 : parseInt(el.data('offset'),0)),
  416. curpos = 0;
  417. switch (phase) {
  418. case "start":
  419. container.parent().find(thumbs).addClass("dragged");
  420. newpos = tdir === "vertical" ? el.position().top : el.position().left;
  421. el.data('offset',newpos);
  422. if (el.data('tmmove')) el.data('tmmove').pause();
  423. break;
  424. case "move":
  425. if (els<=ts) return false;
  426. curpos = newpos + distance;
  427. curpos = curpos>0 ? tdir==="horizontal" ? curpos - (el.width() * (curpos/el.width() * curpos/el.width())) : curpos - (el.height() * (curpos/el.height() * curpos/el.height())) : curpos;
  428. var dif = tdir==="vertical" ? 0-(el.height()-t.height()) : 0-(el.width()-t.width());
  429. curpos = curpos < dif ? tdir==="horizontal" ? curpos + (el.width() * (curpos-dif)/el.width() * (curpos-dif)/el.width()) : curpos + (el.height() * (curpos-dif)/el.height() * (curpos-dif)/el.height()) : curpos;
  430. if (tdir==="vertical")
  431. punchgs.TweenLite.set(el,{top:curpos+"px"});
  432. else
  433. punchgs.TweenLite.set(el,{left:curpos+"px"});
  434. break;
  435. case "end":
  436. case "cancel":
  437. if (istt) {
  438. curpos = newpos + distance;
  439. curpos = tdir==="vertical" ? curpos < 0-(el.height()-t.height()) ? 0-(el.height()-t.height()) : curpos : curpos < 0-(el.width()-t.width()) ? 0-(el.width()-t.width()) : curpos;
  440. curpos = curpos > 0 ? 0 : curpos;
  441. curpos = Math.abs(distance)>tw/10 ? distance<=0 ? Math.floor(curpos/tw)*tw : Math.ceil(curpos/tw)*tw : distance<0 ? Math.ceil(curpos/tw)*tw : Math.floor(curpos/tw)*tw;
  442. curpos = tdir==="vertical" ? curpos < 0-(el.height()-t.height()) ? 0-(el.height()-t.height()) : curpos : curpos < 0-(el.width()-t.width()) ? 0-(el.width()-t.width()) : curpos;
  443. curpos = curpos > 0 ? 0 : curpos;
  444. if (tdir==="vertical")
  445. punchgs.TweenLite.to(el,0.5,{top:curpos+"px",ease:punchgs.Power3.easeOut});
  446. else
  447. punchgs.TweenLite.to(el,0.5,{left:curpos+"px",ease:punchgs.Power3.easeOut});
  448. curpos = !curpos ? tdir==="vertical" ? el.position().top : el.position().left : curpos;
  449. el.data('offset',curpos);
  450. el.data('distance',distance);
  451. setTimeout(function() {
  452. opt.dragStartedOverSlider = false;
  453. opt.dragStartedOverThumbs = false;
  454. opt.dragStartedOverTabs = false;
  455. },100);
  456. container.parent().find(thumbs).removeClass("dragged");
  457. return false;
  458. }
  459. break;
  460. }
  461. }
  462. else {
  463. if (phase=="end" && !istt) {
  464. opt.sc_indicator="arrow";
  465. if ((swipe_wait_dir=="horizontal" && direction == "left") || (swipe_wait_dir=="vertical" && direction == "up")) {
  466. opt.sc_indicator_dir = 0;
  467. _R.callingNewSlide(opt,opt.c,1);
  468. return false;
  469. }
  470. if ((swipe_wait_dir=="horizontal" && direction == "right") || (swipe_wait_dir=="vertical" && direction == "down")) {
  471. opt.sc_indicator_dir = 1;
  472. _R.callingNewSlide(opt,opt.c,-1);
  473. return false;
  474. }
  475. }
  476. opt.dragStartedOverSlider = false;
  477. opt.dragStartedOverThumbs = false;
  478. opt.dragStartedOverTabs = false;
  479. return true;
  480. }
  481. }
  482. });
  483. };
  484. // NAVIGATION HELPER FUNCTIONS
  485. var hdResets = function(o) {
  486. o.hide_delay = !jQuery.isNumeric(parseInt(o.hide_delay,0)) ? 0.2 : o.hide_delay/1000;
  487. o.hide_delay_mobile = !jQuery.isNumeric(parseInt(o.hide_delay_mobile,0)) ? 0.2 : o.hide_delay_mobile/1000;
  488. };
  489. var ckNO = function(opt) {
  490. return opt && opt.enable;
  491. };
  492. var ckNOLO = function(opt) {
  493. return opt && opt.enable && opt.hide_onleave===true && (opt.position===undefined ? true : !opt.position.match(/outer/g));
  494. };
  495. var callAllDelayedCalls = function(container,opt) {
  496. var cp = container.parent();
  497. if (ckNOLO(opt.navigation.arrows))
  498. punchgs.TweenLite.delayedCall(_ISM ? opt.navigation.arrows.hide_delay_mobile : opt.navigation.arrows.hide_delay,showHideNavElements,[cp.find('.tparrows'),opt.navigation.arrows,"hide"]);
  499. if (ckNOLO(opt.navigation.bullets))
  500. punchgs.TweenLite.delayedCall(_ISM ? opt.navigation.bullets.hide_delay_mobile : opt.navigation.bullets.hide_delay,showHideNavElements,[cp.find('.tp-bullets'),opt.navigation.bullets,"hide"]);
  501. if (ckNOLO(opt.navigation.thumbnails))
  502. punchgs.TweenLite.delayedCall(_ISM ? opt.navigation.thumbnails.hide_delay_mobile : opt.navigation.thumbnails.hide_delay,showHideNavElements,[cp.find('.tp-thumbs'),opt.navigation.thumbnails,"hide"]);
  503. if (ckNOLO(opt.navigation.tabs))
  504. punchgs.TweenLite.delayedCall(_ISM ? opt.navigation.tabs.hide_delay_mobile : opt.navigation.tabs.hide_delay,showHideNavElements,[cp.find('.tp-tabs'),opt.navigation.tabs,"hide"]);
  505. };
  506. var showHideNavElements = function(container,opt,dir,speed) {
  507. speed = speed===undefined ? 0.5 : speed;
  508. switch (dir) {
  509. case "show":
  510. punchgs.TweenLite.to(container,speed, {autoAlpha:1,ease:punchgs.Power3.easeInOut,overwrite:"auto"});
  511. break;
  512. case "hide":
  513. punchgs.TweenLite.to(container,speed, {autoAlpha:0,ease:punchgs.Power3.easeInOu,overwrite:"auto"});
  514. break;
  515. }
  516. };
  517. // ADD ARROWS
  518. var initArrows = function(container,o,opt) {
  519. // SET oIONAL CLASSES
  520. o.style = o.style === undefined ? "" : o.style;
  521. o.left.style = o.left.style === undefined ? "" : o.left.style;
  522. o.right.style = o.right.style === undefined ? "" : o.right.style;
  523. // ADD LEFT AND RIGHT ARROWS
  524. if (container.find('.tp-leftarrow.tparrows').length===0)
  525. container.append('<div class="tp-leftarrow tparrows '+o.style+' '+o.left.style+'">'+o.tmp+'</div>');
  526. if (container.find('.tp-rightarrow.tparrows').length===0)
  527. container.append('<div class="tp-rightarrow tparrows '+o.style+' '+o.right.style+'">'+o.tmp+'</div>');
  528. var la = container.find('.tp-leftarrow.tparrows'),
  529. ra = container.find('.tp-rightarrow.tparrows');
  530. // CLICK HANDLINGS ON LEFT AND RIGHT ARROWS
  531. ra.click(function() { opt.sc_indicator="arrow"; opt.sc_indicator_dir = 0;container.revnext();});
  532. la.click(function() { opt.sc_indicator="arrow"; opt.sc_indicator_dir = 1;container.revprev();});
  533. // SHORTCUTS
  534. o.right.j = container.find('.tp-rightarrow.tparrows');
  535. o.left.j = container.find('.tp-leftarrow.tparrows')
  536. // OUTTUER PADDING DEFAULTS
  537. o.padding_top = parseInt((opt.carousel.padding_top||0),0),
  538. o.padding_bottom = parseInt((opt.carousel.padding_bottom||0),0);
  539. // POSITION OF ARROWS
  540. setNavElPositions(la,o.left);
  541. setNavElPositions(ra,o.right);
  542. if (o.position=="outer-left" || o.position=="outer-right") opt.outernav = true;
  543. };
  544. // PUT ELEMENTS VERTICAL / HORIZONTAL IN THE RIGHT POSITION
  545. var putVinPosition = function(el,o) {
  546. var elh = el.outerHeight(true),
  547. elw = el.outerWidth(true),
  548. a = o.v_align === "top" ? {top:"0px",y:Math.round(o.v_offset)+"px"} : o.v_align === "center" ? {top:"50%",y:Math.round(((0-elh/2)+o.v_offset))+"px"} : {top:"100%",y:Math.round((0-(elh+o.v_offset)))+"px"};
  549. if (!el.hasClass("outer-bottom")) punchgs.TweenLite.set(el,a);
  550. };
  551. var putHinPosition = function(el,o) {
  552. var elh = el.outerHeight(true),
  553. elw = el.outerWidth(true),
  554. a = o.h_align === "left" ? {left:"0px",x:Math.round(o.h_offset)+"px"} : o.h_align === "center" ? {left:"50%",x:Math.round(((0-elw/2)+o.h_offset))+"px"} : {left:"100%",x:Math.round((0-(elw+o.h_offset)))+"px"};
  555. punchgs.TweenLite.set(el,a);
  556. };
  557. // SET POSITION OF ELEMENTS
  558. var setNavElPositions = function(el,o) {
  559. var wrapper =
  560. el.closest('.tp-simpleresponsive').length>0 ?
  561. el.closest('.tp-simpleresponsive') :
  562. el.closest('.tp-revslider-mainul').length>0 ?
  563. el.closest('.tp-revslider-mainul') :
  564. el.closest('.rev_slider_wrapper').length>0 ?
  565. el.closest('.rev_slider_wrapper'):
  566. el.parent().find('.tp-revslider-mainul'),
  567. ww = wrapper.width(),
  568. wh = wrapper.height();
  569. putVinPosition(el,o);
  570. putHinPosition(el,o);
  571. if (o.position==="outer-left" && (o.sliderLayout=="fullwidth" || o.sliderLayout=="fullscreen"))
  572. punchgs.TweenLite.set(el,{left:(0-el.outerWidth())+"px",x:o.h_offset+"px"});
  573. else
  574. if (o.position==="outer-right" && (o.sliderLayout=="fullwidth" || o.sliderLayout=="fullscreen"))
  575. punchgs.TweenLite.set(el,{right:(0-el.outerWidth())+"px",x:o.h_offset+"px"});
  576. // MAX WIDTH AND HEIGHT BASED ON THE SOURROUNDING CONTAINER
  577. if (el.hasClass("tp-thumbs") || el.hasClass("tp-tabs")) {
  578. var wpad = el.data('wr_padding'),
  579. maxw = el.data('maxw'),
  580. maxh = el.data('maxh'),
  581. mask = el.hasClass("tp-thumbs") ? el.find('.tp-thumb-mask') : el.find('.tp-tab-mask'),
  582. cpt = parseInt((o.padding_top||0),0),
  583. cpb = parseInt((o.padding_bottom||0),0);
  584. // ARE THE CONTAINERS BIGGER THAN THE SLIDER WIDTH OR HEIGHT ?
  585. if (maxw>ww && o.position!=="outer-left" && o.position!=="outer-right") {
  586. punchgs.TweenLite.set(el,{left:"0px",x:0,maxWidth:(ww-2*wpad)+"px"});
  587. punchgs.TweenLite.set(mask,{maxWidth:(ww-2*wpad)+"px"});
  588. } else {
  589. punchgs.TweenLite.set(el,{maxWidth:(maxw)+"px"});
  590. punchgs.TweenLite.set(mask,{maxWidth:(maxw)+"px"});
  591. }
  592. if (maxh+2*wpad>wh && o.position!=="outer-bottom" && o.position!=="outer-top") {
  593. punchgs.TweenLite.set(el,{top:"0px",y:0,maxHeight:(cpt+cpb+(wh-2*wpad))+"px"});
  594. punchgs.TweenLite.set(mask,{maxHeight:(cpt+cpb+(wh-2*wpad))+"px"});
  595. } else {
  596. punchgs.TweenLite.set(el,{maxHeight:(maxh)+"px"});
  597. punchgs.TweenLite.set(mask,{maxHeight:maxh+"px"});
  598. }
  599. if (o.position!=="outer-left" && o.position!=="outer-right") {
  600. cpt = 0;
  601. cpb = 0;
  602. }
  603. // SPAN IS ENABLED
  604. if (o.span===true && o.direction==="vertical") {
  605. punchgs.TweenLite.set(el,{maxHeight:(cpt+cpb+(wh-2*wpad))+"px",height:(cpt+cpb+(wh-2*wpad))+"px",top:(0-cpt),y:0});
  606. putVinPosition(mask,o);
  607. } else
  608. if (o.span===true && o.direction==="horizontal") {
  609. punchgs.TweenLite.set(el,{maxWidth:"100%",width:(ww-2*wpad)+"px",left:0,x:0});
  610. putHinPosition(mask,o);
  611. }
  612. }
  613. };
  614. // ADD A BULLET
  615. var addBullet = function(container,o,li,opt) {
  616. // Check if Bullet exists already ?
  617. if (container.find('.tp-bullets').length===0) {
  618. o.style = o.style === undefined ? "" : o.style;
  619. container.append('<div class="tp-bullets '+o.style+' '+o.direction+'"></div>');
  620. }
  621. // Add Bullet Structure to the Bullet Container
  622. var bw = container.find('.tp-bullets'),
  623. linkto = li.data('index'),
  624. inst = o.tmp;
  625. jQuery.each(opt.thumbs[li.index()].params,function(i,obj) { inst = inst.replace(obj.from,obj.to);})
  626. bw.append('<div class="justaddedbullet tp-bullet">'+inst+'</div>');
  627. // SET BULLET SPACES AND POSITION
  628. var b = container.find('.justaddedbullet'),
  629. am = container.find('.tp-bullet').length,
  630. w = b.outerWidth()+parseInt((o.space===undefined? 0:o.space),0),
  631. h = b.outerHeight()+parseInt((o.space===undefined? 0:o.space),0);
  632. //bgimage = li.data('thumb') !==undefined ? li.data('thumb') : li.find('.defaultimg').data('lazyload') !==undefined && li.find('.defaultimg').data('lazyload') !== 'undefined' ? li.find('.defaultimg').data('lazyload') : li.find('.defaultimg').data('src');
  633. if (o.direction==="vertical") {
  634. b.css({top:((am-1)*h)+"px", left:"0px"});
  635. bw.css({height:(((am-1)*h) + b.outerHeight()),width:b.outerWidth()});
  636. }
  637. else {
  638. b.css({left:((am-1)*w)+"px", top:"0px"});
  639. bw.css({width:(((am-1)*w) + b.outerWidth()),height:b.outerHeight()});
  640. }
  641. b.find('.tp-bullet-image').css({backgroundImage:'url('+opt.thumbs[li.index()].src+')'});
  642. // SET LINK TO AND LISTEN TO CLICK
  643. b.data('liref',linkto);
  644. b.click(function() {
  645. opt.sc_indicator="bullet";
  646. container.revcallslidewithid(linkto);
  647. container.find('.tp-bullet').removeClass("selected");
  648. jQuery(this).addClass("selected");
  649. });
  650. // REMOVE HELP CLASS
  651. b.removeClass("justaddedbullet");
  652. // OUTTUER PADDING DEFAULTS
  653. o.padding_top = parseInt((opt.carousel.padding_top||0),0),
  654. o.padding_bottom = parseInt((opt.carousel.padding_bottom||0),0);
  655. if (o.position=="outer-left" || o.position=="outer-right") opt.outernav = true;
  656. // PUT ALL CONTAINER IN POSITION
  657. setNavElPositions(bw,o);
  658. };
  659. var cHex = function(hex,o){
  660. o = parseFloat(o);
  661. hex = hex.replace('#','');
  662. var r = parseInt(hex.substring(0,2), 16),
  663. g = parseInt(hex.substring(2,4), 16),
  664. b = parseInt(hex.substring(4,6), 16),
  665. result = 'rgba('+r+','+g+','+b+','+o+')';
  666. return result;
  667. };
  668. // ADD THUMBNAILS
  669. var addThumb = function(container,o,li,what,opt) {
  670. var thumbs = what==="tp-thumb" ? ".tp-thumbs" : ".tp-tabs",
  671. thumbmask = what==="tp-thumb" ? ".tp-thumb-mask" : ".tp-tab-mask",
  672. thumbsiw = what==="tp-thumb" ? ".tp-thumbs-inner-wrapper" : ".tp-tabs-inner-wrapper",
  673. thumb = what==="tp-thumb" ? ".tp-thumb" : ".tp-tab",
  674. timg = what ==="tp-thumb" ? ".tp-thumb-image" : ".tp-tab-image";
  675. o.visibleAmount = o.visibleAmount>opt.slideamount ? opt.slideamount : o.visibleAmount;
  676. o.sliderLayout = opt.sliderLayout;
  677. // Check if THUNBS/TABS exists already ?
  678. if (container.parent().find(thumbs).length===0) {
  679. o.style = o.style === undefined ? "" : o.style;
  680. var spanw = o.span===true ? "tp-span-wrapper" : "",
  681. addcontent = '<div class="'+what+'s '+spanw+" "+o.position+" "+o.style+'"><div class="'+what+'-mask"><div class="'+what+'s-inner-wrapper" style="position:relative;"></div></div></div>';
  682. if (o.position==="outer-top")
  683. container.parent().prepend(addcontent)
  684. else
  685. if (o.position==="outer-bottom")
  686. container.after(addcontent);
  687. else
  688. container.append(addcontent);
  689. // OUTTUER PADDING DEFAULTS
  690. o.padding_top = parseInt((opt.carousel.padding_top||0),0),
  691. o.padding_bottom = parseInt((opt.carousel.padding_bottom||0),0);
  692. if (o.position=="outer-left" || o.position=="outer-right") opt.outernav = true;
  693. }
  694. // Add Thumb/TAB Structure to the THUMB/TAB Container
  695. var linkto = li.data('index'),
  696. t = container.parent().find(thumbs),
  697. tm = t.find(thumbmask),
  698. tw = tm.find(thumbsiw),
  699. maxw = o.direction==="horizontal" ? (o.width * o.visibleAmount) + (o.space*(o.visibleAmount-1)) : o.width,
  700. maxh = o.direction==="horizontal" ? o.height : (o.height * o.visibleAmount) + (o.space*(o.visibleAmount-1)),
  701. inst = o.tmp;
  702. jQuery.each(opt.thumbs[li.index()].params,function(i,obj) {
  703. inst = inst.replace(obj.from,obj.to);
  704. })
  705. tw.append('<div data-liindex="'+li.index()+'" data-liref="'+linkto+'" class="justaddedthumb '+what+'" style="width:'+o.width+'px;height:'+o.height+'px;">'+inst+'</div>');
  706. // SET BULLET SPACES AND POSITION
  707. var b = t.find('.justaddedthumb'),
  708. am = t.find(thumb).length,
  709. w = b.outerWidth()+parseInt((o.space===undefined? 0:o.space),0),
  710. h = b.outerHeight()+parseInt((o.space===undefined? 0:o.space),0);
  711. // FILL CONTENT INTO THE TAB / THUMBNAIL
  712. b.find(timg).css({backgroundImage:"url("+opt.thumbs[li.index()].src+")"});
  713. if (o.direction==="vertical") {
  714. b.css({top:((am-1)*h)+"px", left:"0px"});
  715. tw.css({height:(((am-1)*h) + b.outerHeight()),width:b.outerWidth()});
  716. }
  717. else {
  718. b.css({left:((am-1)*w)+"px", top:"0px"});
  719. tw.css({width:(((am-1)*w) + b.outerWidth()),height:b.outerHeight()});
  720. }
  721. t.data('maxw',maxw);
  722. t.data('maxh',maxh);
  723. t.data('wr_padding',o.wrapper_padding);
  724. var position = o.position === "outer-top" || o.position==="outer-bottom" ? "relative" : "absolute",
  725. _margin = (o.position === "outer-top" || o.position==="outer-bottom") && (o.h_align==="center") ? "auto" : "0";
  726. tm.css({maxWidth:maxw+"px",maxHeight:maxh+"px",overflow:"hidden",position:"relative"});
  727. t.css({maxWidth:(maxw)+"px",margin:_margin, maxHeight:maxh+"px",overflow:"visible",position:position,background:cHex(o.wrapper_color,o.wrapper_opacity),padding:o.wrapper_padding+"px",boxSizing:"contet-box"});
  728. // SET LINK TO AND LISTEN TO CLICK
  729. b.click(function() {
  730. opt.sc_indicator="bullet";
  731. var dis = container.parent().find(thumbsiw).data('distance');
  732. dis = dis === undefined ? 0 : dis;
  733. if (Math.abs(dis)<10) {
  734. container.revcallslidewithid(linkto);
  735. container.parent().find(thumbs).removeClass("selected");
  736. jQuery(this).addClass("selected");
  737. }
  738. });
  739. // REMOVE HELP CLASS
  740. b.removeClass("justaddedthumb");
  741. // PUT ALL CONTAINER IN POSITION
  742. setNavElPositions(t,o);
  743. };
  744. var setONHeights = function(o) {
  745. var ot = o.c.parent().find('.outer-top'),
  746. ob = o.c.parent().find('.outer-bottom');
  747. o.top_outer = !ot.hasClass("tp-forcenotvisible") ? ot.outerHeight() || 0 : 0;
  748. o.bottom_outer = !ob.hasClass("tp-forcenotvisible") ? ob.outerHeight() || 0 : 0;
  749. };
  750. // HIDE NAVIGATION ON PURPOSE
  751. var biggerNav = function(el,a,b,c) {
  752. if (a>b || b>c)
  753. el.addClass("tp-forcenotvisible")
  754. else
  755. el.removeClass("tp-forcenotvisible");
  756. };
  757. })(jQuery);