var $j = jQuery.noConflict(); $j(document).ready(function () { $j("#slider").easySlider({ auto: true, continuous: true }); }); $j(document).ready(function(){ $j('#menu a') .css( {backgroundPosition: "0 0"} ) .mouseover(function(){ $j(this).stop().animate({backgroundPosition:"(-150px 0)"}, {duration:900}) }) .mouseout(function(){ $j(this).stop().animate({backgroundPosition:"(-300px 0)"}, {duration:400, complete:function(){ $j(this).css({backgroundPosition: "0 0"}) }}) }) }); //$j(document).ready(function(){ //$j("a[rel='galeria']").colorbox(); //$j(".zadajpytanie").colorbox({width:"500px", height:"400px", iframe:true}); //$j(".informujmnie").colorbox({width:"500px", height:"250px", iframe:true}); //$j(".wydrukujpdf").colorbox({width:"500px", height:"500px", iframe:true}); //$j(".polecznajomemu").colorbox({width:"500px", height:"290px", iframe:true}); //$j(".kosztydostawy").colorbox({width:"500px", height:"500px", iframe:true}); //}); $j(document).ready(function(){ //slides $j('#slides').slides({ effect: 'slide', preload: true, preloadImage: '/storage/img/loading.gif', randomize: true, play: 5000, pause: 2500, hoverPause: false }); $j('#slides_three').slides({ generateNextPrev: true, play: 5500, randomize: true }); // initialize scrollable $j(".scrollable").scrollable({ next: '.nextPage', prev: '.prevPage' }); $j(".scrollable2").scrollable({ next: '.nextPage2', prev: '.prevPage2' }); }); $j(document).ready(function() { $j.featureList( $j("#tabs li a"), $j("#output li"), { start_item : 1 } ); }); $j(function() { //remove js-disabled class $j("#viewer").removeClass("js-disabled"); //create new container for images $j("
").attr("id", "container").css({ position:"absolute"}).width($j(".opaska").length * 282).height(73).appendTo("div#viewer"); //add images to container $j(".opaska").each(function() { $j(this).appendTo("div#container"); }); //work out duration of anim based on number of images (1 second for each image) var duration = $j(".opaska").length * 6000; //store speed for later (distance / time) var speed = (parseInt($j("div#container").width()) + parseInt($j("div#viewer").width())) / duration; //set direction var direction = "rtl"; //set initial position and class based on direction (direction == "rtl") ? $j("div#container").css("left", $j("div#viewer").width()).addClass("rtl") : $j("div#container").css("left", 0 - $j("div#container").width()).addClass("ltr") ; //animator function var animator = function(el, time, dir) { //which direction to scroll if(dir == "rtl") { //add direction class el.removeClass("ltr").addClass("rtl"); //animate the el el.animate({ left:"-" + el.width() + "px" }, time, "linear", function() { //reset container position $j(this).css({ left:$j("div#imageScroller").width(), right:"" }); //restart animation animator($j(this), duration, "rtl"); //hide controls if visible ($j("div#controls").length > 0) ? $j("div#controls").slideUp("slow").remove() : null ; }); } else { //add direction class el.removeClass("rtl").addClass("ltr"); //animate the el el.animate({ left:$j("div#viewer").width() + "px" }, time, "linear", function() { //reset container position $j(this).css({ left:0 - $j("div#container").width() }); //restart animation animator($j(this), duration, "ltr"); //hide controls if visible ($j("div#controls").length > 0) ? $j("div#controls").slideUp("slow").remove() : null ; }); } } //start anim animator($j("div#container"), duration, direction); //pause on mouseover $j("a.opaska").live("mouseover", function() { //stop anim $j("div#container").stop(true); //show controls ($j("div#controls").length == 0) ? $j("
").attr("id", "controls").appendTo("div#outerContainer").css({ opacity:0.7 }).slideDown("slow") : null ; ($j("a#rtl").length == 0) ? $j("").attr({ id:"rtl", href:"#", title:"rtl" }).appendTo("#controls") : null ; ($j("a#ltr").length == 0) ? $j("").attr({ id:"ltr", href:"#", title:"ltr" }).appendTo("#controls") : null ; //variable to hold trigger element var title = $j(this).attr("title"); //add p if doesn't exist, update it if it does ($j("p#title").length == 0) ? $j("

").attr("id", "title").text(title).appendTo("div#controls") : $j("p#title").text(title) ; }); //restart on mouseout $j("a.opaska").live("mouseout", function(e) { //hide controls if not hovering on them (e.relatedTarget == null) ? null : (e.relatedTarget.id != "controls") ? $j("div#controls").slideUp("slow").remove() : null ; //work out total travel distance var totalDistance = parseInt($j("div#container").width()) + parseInt($j("div#viewer").width()); //work out distance left to travel var distanceLeft = ($j("div#container").hasClass("ltr")) ? totalDistance - (parseInt($j("div#container").css("left")) + parseInt($j("div#container").width())) : totalDistance - (parseInt($j("div#viewer").width()) - (parseInt($j("div#container").css("left")))) ; //new duration is distance left / speed) var newDuration = distanceLeft / speed; //restart anim animator($j("div#container"), newDuration, $j("div#container").attr("class")); }); //handler for ltr button $j("#ltr").live("click", function() { //stop anim $j("div#container").stop(true); //swap class names $j("div#container").removeClass("rtl").addClass("ltr"); //work out total travel distance var totalDistance = parseInt($j("div#container").width()) + parseInt($j("div#viewer").width()); //work out remaining distance var distanceLeft = totalDistance - (parseInt($j("div#container").css("left")) + parseInt($j("div#container").width())); //new duration is distance left / speed) var newDuration = distanceLeft / speed; //restart anim animator($j("div#container"), newDuration, "ltr"); }); //handler for rtl button $j("#rtl").live("click", function() { //stop anim $j("div#container").stop(true); //swap class names $j("div#container").removeClass("ltr").addClass("rtl"); //work out total travel distance var totalDistance = parseInt($j("div#container").width()) + parseInt($j("div#viewer").width()); //work out remaining distance var distanceLeft = totalDistance - (parseInt($j("div#viewer").width()) - (parseInt($j("div#container").css("left")))); //new duration is distance left / speed) var newDuration = distanceLeft / speed; //restart anim animator($j("div#container"), newDuration, "rtl"); }); }); function initMenu() { $j('#menu2 ul').hide(); $j('#menu2 #otworz').show(); $j('#menu2 li a').click( function() { var checkElement = $j(this).next(); if((checkElement.is('ul')) && (checkElement.is(':visible'))) { return false; } if((checkElement.is('ul')) && (!checkElement.is(':visible'))) { $j('#menu2 ul:visible').slideUp('normal'); checkElement.slideDown('normal'); return false; } } ); } $j(document).ready(function() {initMenu();}); // $j(document).ready(function() { // // Expand Panel // $j("#open").click(function(){ // $j("div#panel").slideDown("slow"); // }); // // Collapse Panel // $j("#close").click(function(){ // $j("div#panel").slideUp("slow"); // }); // // Switch buttons from "Log In | Register" to "Close Panel" on click // $j("#toggle a").click(function () { // $j("#toggle a").toggle(); // }); // }); //slider-test $j(document).ready(function(){ $j("#content-slider").slider({ animate: true, change: handleSliderChange, slide: handleSliderSlide }); }); function handleSliderChange(e, ui) { var maxScroll = $j("#content-scroll").attr("scrollWidth") - $j("#content-scroll").width(); $j("#content-scroll").animate({scrollLeft: ui.value * (maxScroll / 100) }, 1000); } function handleSliderSlide(e, ui) { var maxScroll = $j("#content-scroll").attr("scrollWidth") - $j("#content-scroll").width(); $j("#content-scroll").attr({scrollLeft: ui.value * (maxScroll / 100) }); }