var CTfxMan = { run : function(idx_tfx,idx_f,idx_t,b_reverse) { var tfx = { idx:{ "f":idx_f, "t":idx_t }, init:{}, kf:{}, b_reverse:b_reverse }; var rec = CSlideMan.getSlide(idx_tfx); for ( var key in rec ) { tfx[key] = rec[key]; } var tfx_func_run = tfx_handlers[rec["verb"]]; tfx_func_run.call(tfx); } }; var CSlideMan = { slides : [ { "img":"test-0.jpg", "bg-color":"yellow", "bg-size":"contain", "bg-pos":"center", "verb":"bounce", "coru":"u", "dir":"down", "ttime":"2", }, { "img":"test-1.jpg", "bg-color":"gold", "bg-size":"cover", "bg-pos":"left", "verb":"gate", "coru":"c", "dir":"hori", "ttime":"0.6", "easing":"ease" }, { "img":"test-2.jpg", "bg-color":"rgba(0,0,0,0.5)", "bg-size":"cover", "bg-pos":"center", "verb":"slice", "coru":"c", "dir":"down", "nos":10, "ttime":"1", "easing":"ease" }, { "img":"test-3.jpg", "bg-color":"rgba(255,200,200,0.5)", "bg-size":"cover", "bg-pos":"center", "verb":"scroll", "dir":"right", "ttime":"0.5", "easing":"ease" }, ], /* "verb":"zoom", "coru":"u", "ttime":".8", "easing":"ease-out" "verb":"kenburns", "dir":"br", "ttime":"4", "easing":"linear" "verb":"scroll", "dir":"right", "ttime":"0.5", "easing":"ease" "verb":"fade", "ttime":"4", "easing":"linear" "verb":"blind", "coru":"u", "dir":"up", "nos":13, "ttime":"1", "easing":"ease" "verb":"slice", "coru":"c", "dir":"down", "nos":10, "ttime":"1", "easing":"ease" "verb":"turn", "dir":"right", "ttime":".5", "easing":"ease" "verb":"uncover", "dir":"right", "ttime":"1", "easing":"linear" */ setup : function() { }, getSlide : function(idx) { return this.slides[idx]; }, getCount : function() { return this.slides.length; }, create : function(idx,base_class) { var cls = "slide-base" + ( base_class ? "-"+base_class:"" ); var rec = this.getSlide(idx); return $("
") .addClass(cls) .css({ "background-image":"url('img/"+rec["img"]+"')", "background-color":rec["bg-color"], "background-size":rec["bg-size"], "background-position":rec["bg-pos"], "background-repeat":"no-repeat" }); }, }; var sshow = { getSlideSize : function() { return { w:this.jqo_slide_w.width(), h:this.jqo_slide_w.height() }; }, show : function() { this.jqo_slide_w.html(CSlideMan.create(this.cidx)); }, goto : function(idx_t_inp) { if ( !this.max_slide ) { return; } var b_reverse = false; var idx_f = this.cidx; if ( idx_t_inp === true ) { idx_t = idx_f+1; if ( idx_t >= this.max_slide ) { idx_t = 0; } } else if ( idx_t_inp === false ) { b_reverse = true; idx_t = idx_f-1; if ( idx_t < 0 ) { idx_t = this.max_slide-1; } } else { idx_t = idx_t_inp % this.max_slide; if ( idx_t == this.cidx ) { return; } } this.jqo_slide_w.html(""); var idx_next = idx_t; if ( b_reverse ) { var idx_tfx = idx_f; var temp = idx_f; idx_f = idx_t; idx_t = temp; } else { var idx_tfx = idx_t; } CTfxMan.run(idx_tfx,idx_f,idx_t,b_reverse); this.cidx = idx_next; }, setup : function() { var _this = this; this.jqo_slide_w = $(".slide-work"); this.jqo_pagebtn = $(".ctar-pagebtn"); this.max_slide = CSlideMan.getCount(); for(var i=0; i") .attr("class","btn-page") .attr("data-idx",i) .appendTo(this.jqo_pagebtn) .click(function(){ _this.goto(parseInt($(this).attr("data-idx"))); }); } this.cidx = 0; this.show(); $(".btn-next").click(function(){ _this.goto(true); }); $(".btn-prev").click(function(){ _this.goto(false); }); } };