var FKF = {}; FKF.slider = function(){ this.items = []; this.active = 0; var self = this; this.init = function(block,num) { this.block = block; this.num = num; this.$back = $(".back",this.block); this.$forward = $(".forward",this.block); this.$content = $(".content",this.block); this.$window = $(".window",this.block); this.didScroll = false; this.lastcssrule = ''; $(window).resize(function(){self.didScroll = true }) setInterval(function() { if ( self.didScroll ) { self.didScroll = false; self.refindItems(); } }, 250); this.active = 0; this.refindItems(); this.$back.click(function(){self.back()}); this.$forward.click(function(){self.forward()}); this.$window.scroll(function(){self.onscroll()}); var ua = navigator.userAgent; if (ua.match(/phone|iphone|itouch|ipod|symbian|android|htc_|htc-|palmos|blackberry|opera mini|mobi|windows ce|nokia|fennec|hiptop|kindle|mot |mot-|webos\/|samsung|sonyericsson|^sie-|nintendo|mobile/i)) { this.$window.css('overflow','scroll'); } if( ua.indexOf("Android") >= 0 ) { var androidversion = parseFloat(ua.slice(ua.indexOf("Android")+8)); if (androidversion < 4) { this.$back.show(); this.$forward.show(); } } this.afterInit(); } this.calculateWidths = function() { var posx = 0; for(var i=0;i= this.scrollMaxLeft-this.$window.width()) this.preLoad(); } this.calculatePos = function(active) { return this.items[active].posx; } this.scroll = function(add) { var scrollpos = this.$window.scrollLeft(); if (Math.abs(this.calculatePos(this.active)-this.$window.scrollLeft())>2) { for (var i=0;iscrollpos) { this.active = (add>0) ? i : i-1; break; } } } else { this.active+=add; } if (!this.items[this.active]) return; this.afterScroll() this.$window.animate({ // kepek mozgatasa scrollLeft: this.calculatePos(this.active) }, 200); } this.preLoad = function() {} // felul definialhato this.forward = function() { if (this.active0) this.scroll(-1); } this.afterScroll = function() {} this.afterInit = function() {} return this; }; /* GALÉRIA */ function aScrollLeft(aObj) { new_frame_no = ((frame_no/1)-1); new_left = ((frame_left/1) + move_by); new_left_attr = new_left+"px"; if(new_frame_no > 0) { $('#gallery_tns').css({left: new_left_attr}); frame_left = new_left; frame_no = new_frame_no; } $(aObj).trigger('blur'); } function aScrollRight(aObj) { new_frame_no = ((frame_no/1)+1); new_left = ((frame_left/1) - move_by); new_left_attr = new_left+"px"; if(new_frame_no < max_clicks) { $('#gallery_tns').css({left: new_left_attr}); frame_left = new_left; frame_no = new_frame_no; } $(aObj).trigger('blur'); } function galeriaSwitchTo(pic, lbId, aObj, title) { $('a.selected').removeClass('selected'); $(aObj).addClass('selected').trigger('blur'); var altText = $('img', aObj).attr('alt'); var w = $('img', aObj).width(); var h = $('img', aObj).height(); var max = 650; $('#gallery_pic .imageContainer img').hide(); if (w && h) { if (w > h) { $('#gallery_pic .imageContainer img').css({'width' : max+'px', 'height':'auto'}); } else { $('#gallery_pic .imageContainer img').css({'height' : max+'px', 'width':'auto'}); } } var gal = $(aObj).parents('#gallery:first')[0]; $('#gallery_pic .imageContainer img:first',gal).attr("src", pic); $('#gallery_pic .imageContainer img:first',gal).load(function() { $(this).show(); }); if (altText) { $('#gallery_pic .imageContainer img:first',gal).attr('alt', title).attr('title', title); $('#gallery_text:first',gal).text(altText); $('.imageTitle').html(altText); } bigPic = pic; lightboxId = lbId; } function initGalleryScroller() { var timer = null; $('#gallery_pic img, #gallery_button1_large, #gallery_button2_large').hover(function() { $('#gallery_button1_large, #gallery_button2_large').show(); if (timer) { clearTimeout(timer); timer = null; } }, function() { if (! timer) { timer = setTimeout(function() { $('#gallery_button1_large, #gallery_button2_large').hide(); }, 50); } }); $('#gallery_pic img').click(function(e) { if (e.pageX < $(this).offset().left + $(this).width()/2) { $('#gallery_tns_container a.selected').prev().click(); } else { $('#gallery_tns_container a.selected').next().click(); } }); var altText = $('#gallery_pic img').attr('alt'); $('#gallery_text').text(altText); }