diff --git a/js/bjqs-1.3.js b/js/bjqs-1.3.js index f06e7b2..58117b6 100755 --- a/js/bjqs-1.3.js +++ b/js/bjqs-1.3.js @@ -710,6 +710,15 @@ } }; + + var goto = function(position){ + state.animating = false; + if(settings.animtype === "slide") + position = position + 1; + go(false,position); + } + + $.fn.bjqs.goto = goto; // lets get the party started :) init(); diff --git a/js/bjqs-1.3.min.js b/js/bjqs-1.3.min.js index 80d7618..8b6bbd8 100644 --- a/js/bjqs-1.3.min.js +++ b/js/bjqs-1.3.min.js @@ -11,4 +11,4 @@ * License: GNU General Public License, version 3 (GPL-3.0) * http://www.opensource.org/licenses/gpl-3.0.html * - */(function(e){"use strict";e.fn.bjqs=function(t){var n={width:700,height:300,animtype:"fade",animduration:450,animspeed:4e3,automatic:!0,showcontrols:!0,centercontrols:!0,nexttext:"Next",prevtext:"Prev",showmarkers:!0,centermarkers:!0,keyboardnav:!0,hoverpause:!0,usecaptions:!0,randomstart:!1,responsive:!1},r=e.extend({},n,t),i=this,s=i.find("ul.bjqs"),o=s.children("li"),u=null,a=null,f=null,l=null,c=null,h=null,p=null,d=null,v={slidecount:o.length,animating:!1,paused:!1,currentslide:1,nextslide:0,currentindex:0,nextindex:0,interval:null},m={width:null,height:null,ratio:null},g={fwd:"forward",prev:"previous"},y=function(){o.addClass("bjqs-slide");r.responsive?b():E();if(v.slidecount>1){r.randomstart&&L();r.showcontrols&&x();r.showmarkers&&T();r.keyboardnav&&N();r.hoverpause&&r.automatic&&C();r.animtype==="slide"&&S()}r.usecaptions&&k();if(r.animtype==="slide"&&!r.randomstart){v.currentindex=1;v.currentslide=2}s.show();o.eq(v.currentindex).show();r.automatic&&(v.interval=setInterval(function(){O(g.fwd,!1)},r.animspeed))},b=function(){m.width=i.outerWidth();m.ratio=m.width/r.width,m.height=r.height*m.ratio;if(r.animtype==="fade"){o.css({height:r.height,width:"100%"});o.children("img").css({height:r.height,width:"100%"});s.css({height:r.height,width:"100%"});i.css({height:r.height,"max-width":r.width,position:"relative"});if(m.width');if(r.responsive&&m.width');a=e('
  • '+r.nexttext+"
  • ");f=e('
  • '+r.prevtext+"
  • ");u.on("click","a",function(t){t.preventDefault();var n=e(this).attr("data-direction");if(!v.animating){n===g.fwd&&O(g.fwd,!1);n===g.prev&&O(g.prev,!1)}});f.appendTo(u);a.appendTo(u);u.appendTo(i);if(r.centercontrols){u.addClass("v-centered");var t=(i.height()-a.children("a").outerHeight())/2,n=t/r.height*100,s=n+"%";a.find("a").css("top",s);f.find("a").css("top",s)}},T=function(){l=e('
      ');e.each(o,function(t,n){var i=t+1,s=t+1;r.animtype==="slide"&&(s=t+2);var o=e('
    1. '+i+"
    2. ");i===v.currentslide&&o.addClass("active-marker");o.on("click","a",function(e){e.preventDefault();!v.animating&&v.currentslide!==s&&O(!1,s)});o.appendTo(l)});l.appendTo(i);c=l.find("li");if(r.centermarkers){l.addClass("h-centered");var t=(r.width-l.width())/2;l.css("left",t)}},N=function(){e(document).keyup(function(e){if(!v.paused){clearInterval(v.interval);v.paused=!0}if(!v.animating)if(e.keyCode===39){e.preventDefault();O(g.fwd,!1)}else if(e.keyCode===37){e.preventDefault();O(g.prev,!1)}if(v.paused&&r.automatic){v.interval=setInterval(function(){O(g.fwd)},r.animspeed);v.paused=!1}})},C=function(){i.hover(function(){if(!v.paused){clearInterval(v.interval);v.paused=!0}},function(){if(v.paused){v.interval=setInterval(function(){O(g.fwd,!1)},r.animspeed);v.paused=!1}})},k=function(){e.each(o,function(t,n){var r=e(n).children("img:first-child").attr("title");r||(r=e(n).children("a").find("img:first-child").attr("title"));if(r){r=e('

      '+r+"

      ");r.appendTo(e(n))}})},L=function(){var e=Math.floor(Math.random()*v.slidecount)+1;v.currentslide=e;v.currentindex=e-1},A=function(e){if(e===g.fwd)if(o.eq(v.currentindex).next().length){v.nextindex=v.currentindex+1;v.nextslide=v.currentslide+1}else{v.nextindex=0;v.nextslide=1}else if(o.eq(v.currentindex).prev().length){v.nextindex=v.currentindex-1;v.nextslide=v.currentslide-1}else{v.nextindex=v.slidecount-1;v.nextslide=v.slidecount}},O=function(e,t){if(!v.animating){v.animating=!0;if(t){v.nextslide=t;v.nextindex=t-1}else A(e);if(r.animtype==="fade"){if(r.showmarkers){c.removeClass("active-marker");c.eq(v.nextindex).addClass("active-marker")}o.eq(v.currentindex).fadeOut(r.animduration);o.eq(v.nextindex).fadeIn(r.animduration,function(){v.animating=!1;v.currentslide=v.nextslide;v.currentindex=v.nextindex})}if(r.animtype==="slide"){if(r.showmarkers){var n=v.nextindex-1;n===v.slidecount-2?n=0:n===-1&&(n=v.slidecount-3);c.removeClass("active-marker");c.eq(n).addClass("active-marker")}r.responsive&&m.width1){if(r.randomstart){L()}if(r.showcontrols){x()}if(r.showmarkers){T()}if(r.keyboardnav){N()}if(r.hoverpause&&r.automatic){C()}if(r.animtype==="slide"){S()}}else{r.automatic=false}if(r.usecaptions){k()}if(r.animtype==="slide"&&!r.randomstart){v.currentindex=1;v.currentslide=2}s.show();o.eq(v.currentindex).show();if(r.automatic){v.interval=setInterval(function(){O(g.fwd,false)},r.animspeed)}};var b=function(){m.width=i.outerWidth();m.ratio=m.width/r.width,m.height=r.height*m.ratio;if(r.animtype==="fade"){o.css({height:r.height,width:"100%"});o.children("img").css({height:r.height,width:"100%"});s.css({height:r.height,width:"100%"});i.css({height:r.height,"max-width":r.width,position:"relative"});if(m.width');if(r.responsive&&m.width');a=e('
    3. '+r.nexttext+"
    4. ");f=e('
    5. '+r.prevtext+"
    6. ");u.on("click","a",function(t){t.preventDefault();var n=e(this).attr("data-direction");if(!v.animating){if(n===g.fwd){O(g.fwd,false)}if(n===g.prev){O(g.prev,false)}}});f.appendTo(u);a.appendTo(u);u.appendTo(i);if(r.centercontrols){u.addClass("v-centered");var t=(i.height()-a.children("a").outerHeight())/2,n=t/r.height*100,s=n+"%";a.find("a").css("top",s);f.find("a").css("top",s)}};var T=function(){l=e('
        ');e.each(o,function(t,n){var i=t+1,s=t+1;if(r.animtype==="slide"){s=t+2}var o=e('
      1. '+i+"
      2. ");if(i===v.currentslide){o.addClass("active-marker")}o.on("click","a",function(e){e.preventDefault();if(!v.animating&&v.currentslide!==s){O(false,s)}});o.appendTo(l)});l.appendTo(i);c=l.find("li");if(r.centermarkers){l.addClass("h-centered");var t=(r.width-l.width())/2;l.css("left",t)}};var N=function(){e(document).keyup(function(e){if(!v.paused){clearInterval(v.interval);v.paused=true}if(!v.animating){if(e.keyCode===39){e.preventDefault();O(g.fwd,false)}else if(e.keyCode===37){e.preventDefault();O(g.prev,false)}}if(v.paused&&r.automatic){v.interval=setInterval(function(){O(g.fwd)},r.animspeed);v.paused=false}})};var C=function(){i.hover(function(){if(!v.paused){clearInterval(v.interval);v.paused=true}},function(){if(v.paused){v.interval=setInterval(function(){O(g.fwd,false)},r.animspeed);v.paused=false}})};var k=function(){e.each(o,function(t,n){var r=e(n).children("img:first-child").attr("title");if(!r){r=e(n).children("a").find("img:first-child").attr("title")}if(r){r=e('

        '+r+"

        ");r.appendTo(e(n))}})};var L=function(){var e=Math.floor(Math.random()*v.slidecount)+1;v.currentslide=e;v.currentindex=e-1};var A=function(e){if(e===g.fwd){if(o.eq(v.currentindex).next().length){v.nextindex=v.currentindex+1;v.nextslide=v.currentslide+1}else{v.nextindex=0;v.nextslide=1}}else{if(o.eq(v.currentindex).prev().length){v.nextindex=v.currentindex-1;v.nextslide=v.currentslide-1}else{v.nextindex=v.slidecount-1;v.nextslide=v.slidecount}}};var O=function(e,t){if(!v.animating){v.animating=true;if(t){v.nextslide=t;v.nextindex=t-1}else{A(e)}if(r.animtype==="fade"){if(r.showmarkers){c.removeClass("active-marker");c.eq(v.nextindex).addClass("active-marker")}o.eq(v.currentindex).fadeOut(r.animduration);o.eq(v.nextindex).fadeIn(r.animduration,function(){v.animating=false;v.currentslide=v.nextslide;v.currentindex=v.nextindex})}if(r.animtype==="slide"){if(r.showmarkers){var n=v.nextindex-1;if(n===v.slidecount-2){n=0}else if(n===-1){n=v.slidecount-3}c.removeClass("active-marker");c.eq(n).addClass("active-marker")}if(r.responsive&&m.width