/* * Javascript Options * Copyrileft (c) 2015 metode.com | estudi1073 */ $(document).ready(function(){ var cridesslide = $('.crides-slide'); if (cridesslide.length) { cridesslide.owlCarousel({ pagination: true, loop: false, margin: 0, items: 1, center: true, lazyLoad:true, autoplay:true, autoplayTimeout:9000, autoplayHoverPause:true }); } // Serveis toggle $('.service-list a').click(function() { $('.service-list a').removeClass('current'); $(this).addClass('current'); $('.box').removeClass('current'); var $target = $(this).attr('href'); $($target).addClass('current'); return false; }); // Videos // Scrolled by user interaction $('#foo2').carouFredSel({ auto: false, prev : { button : "#prev2", key : "left" }, next : { button : "#next2", key : "right" }, pagination: "#pager2", direction: "right", mousewheel: true, swipe: { onMouse: true, onTouch: true } }); // Menu activitats toggle $('.activity a').click(function() { $('.activity a.current').removeClass('current'); $(this).toggleClass('current'); $('.box-activitat').removeClass('current'); var $target = $(this).attr('href'); $($target).toggleClass('current'); return false; }); // Menu activitats close $('.close').click(function() { $('.activity a').removeClass('current'); $('.box-activitat').removeClass('current'); return false; }); // Carousel options var carouselselector = $('.carousel'); if (carouselselector.length) { carouselselector.carousel({ interval: false }); // Carousel mobile swipe carouselselector.swiperight(function() { $(this).carousel('prev'); }); carouselselector.swipeleft(function() { $(this).carousel('next'); }); } // slide-virtual $('#slide-virtual').on('slide.bs.carousel',function(){ $('.blocky').fadeOut(300); }); $('#slide-virtual').on('slid.bs.carousel',function(){ $('.blocky').fadeIn(600).animate({marginLeft:"+=12%"},200).animate({marginLeft:"-=15%"},300).animate({marginLeft:"+=4%"},600); }); // Carousel videos var videoCarouselselector = $('#videoCarousel'); if (videoCarouselselector.length) { videoCarouselselector.carousel({ interval: 40000 }); } var countTo = $(document).width()/100; if (countTo > 10) { countTo = 3; } else { countTo = 0; } $('#videoCarousel.carousel .item').each(function(){ for (var i = 0; i < countTo; i++) { var next = $(this).next(); next.appendTo($(this)); } }); // Datapicker var cercadordesdeselector = $('.cercador #desde'); if (cercadordesdeselector.length) { cercadordesdeselector.datepicker({ format: 'dd-mm-yyyy', language: 'ca', todayHighlight: 'true', startDate: '-5y' }); } var cercadorfinsaselector = $('.cercador #finsa'); if (cercadorfinsaselector.length) { cercadorfinsaselector.datepicker({ format: 'dd-mm-yyyy', language: 'ca', todayHighlight: 'true', startDate: '-5y' }); } $(".myButtonFrom").click(function() { $(".cercador #desde").datepicker("show"); }); $(".myButtonTo").click(function() { $(".cercador #finsa").datepicker("show"); }); // Toggleclass agenda page icon $( ".icon-down" ).click(function() { $( this ).toggleClass( "icon-up" ); }); // addClass agenda page h3 a & a.icon $(".acte h3 a, .grau h3 a").hover( function () { $(this).parents( ".acte, .grau" ).find("a.icon").addClass("hover"); }, function () { $(this).parents( ".acte, .grau" ).find("a.icon").removeClass("hover"); } ); $("a.icon").hover( function () { $(this).parents( ".acte, .grau" ).find("h3 a").addClass("hover"); }, function () { $(this).parents( ".acte, .grau" ).find("h3 a").removeClass("hover"); } ); function doAnimations(elems) { var animEndEv = 'webkitAnimationEnd animationend'; elems.each(function () { var $this = $(this), $animationType = $this.data('animation'); $this.addClass($animationType).one(animEndEv, function () { $this.removeClass($animationType); }); }); } var $myCarousel = $('#carousel-example-generic'), $firstAnimatingElems = $myCarousel.find('.item:first').find('[data-animation ^= \'animated\']'); if ($myCarousel.length) $myCarousel.carousel(); doAnimations($firstAnimatingElems); if ($myCarousel.length) $myCarousel.carousel('pause'); $myCarousel.on('slide.bs.carousel', function (e) { var $animatingElems = $(e.relatedTarget).find('[data-animation ^= \'animated\']'); doAnimations($animatingElems); }); // bind a click event to the 'skip' link $("#sr-kw-only").click(function(event){ // strip the leading hash and declare // the content we're skipping to var skipTo="#"+this.href.split('#')[1]; // Setting 'tabindex' to -1 takes an element out of normal // tab flow but allows it to be focused via javascript $(skipTo).attr('tabindex', -1).on('blur focusout', function () { // when focus leaves this element, // remove the tabindex attribute $(this).removeAttr('tabindex'); }).focus(); // focus on the content container }); /* Es el c�digo javascript que controla el bot�n de visualizaci�n de m�s avisos */ $(".mes-info-js-1").click(function(e) { if (e.preventDefault) e.preventDefault(); $(".info_ampliada").show(); $(this).hide(); $(".menys-info-js-1").show().css('display', 'block'); }); $(".menys-info-js-1").click(function(e) { if (e.preventDefault) e.preventDefault(); $(".info_ampliada").hide(); $(this).hide(); $(".mes-info-js-1").show(); }); }); // end document.ready //jquery.tabs /* $(document).ready(function(){ $(".jquery_tabs").accessibleTabs({ clearfixClass:"ym-clearfix" }); }); */ //twitter $(document).ready(function() { var hideTweetMedia = function() { $(".tweets-content").find(".twitter-timeline").contents().find(".timeline-Tweet-media").css("display", "none"); $(".tweets-content").css("height", "100%"); $(".tweets-content").find(".twitter-timeline").contents().find(".timeline-TweetList").bind("DOMSubtreeModified propertychange", function() { hideTweetMedia(this); } ); } $(".tweets-content").on("DOMSubtreeModified propertychange","#twitter-widget-0", function() { hideTweetMedia(); }); }); //Facultat de biblioteques $(document).ready(function(){ // Menu guies tematiques toggle $('.estudis .item a').click(function() { $('.item a.current').removeClass('current'); $(this).toggleClass('current'); $('.submenu').removeClass('current'); var $target = $(this).attr('href'); $($target).toggleClass('current'); return false; }); $('.close').click(function() { //event.stopPropagation(); $(this).parent('.submenu.current').removeClass('current'); }); // Carousel universitats // http://www.owlcarousel.owlgraphic.com/docs/api-options.html /*$('div.carousel-biblioteca').owlCarousel({ //navigation: true, //navigationText: ["", ""], items: 4, loop: false, //lazyLoad : true, margin: 0 });*/ }); //Servei d'Ocupabilitat - Ofertes de pr�tiques i laborlas (Box) $(document).ready(function(){ // Serveis toggle $('.custom-list a').click(function() { $('.custom-list a').removeClass('current'); $(this).addClass('current'); $('.box').removeClass('current'); var $target = $(this).attr('href'); $($target).addClass('current'); return false; }); }); /* Es el código javascript que controla que no haya varios videos reproduciendose a la vez */ var videos = new Array(); function pausePlayers(video_activado) { //console.log("Video_activado " + video_activado + "/" + (videos.length-1)); for (var i = 0; i < videos.length; i++) { if(i != video_activado) { videos[i].pause(true); //console.log("Video pause " + i + "/" + (videos.length-1)); } } }; /* Start tables script Script that improves visualization of the tables in responsive */ var headertext = []; var headers = document.querySelectorAll("thead"); var tablebody = document.querySelectorAll("tbody"); for (var i = 0; i < headers.length; i++) { headertext[i]=[]; for (var j = 0, headrow; headrow = headers[i].rows[0].cells[j]; j++) { var current = headrow; headertext[i].push(current.textContent); } } for (var h = 0, tbody; tbody = tablebody[h]; h++) { for (var i = 0, row; row = tbody.rows[i]; i++) { for (var j = 0, col; col = row.cells[j]; j++) { col.setAttribute("data-th", headertext[h][j]); } } } /* End tables script */ //jQuery.noConflict(); $(document).ready(function($) { // Masonry /* $('.mosaic-grid').masonry({ // set itemSelector so .grid-sizer is not used in layout itemSelector: '.mosaic-grid-item', // use element for option columnWidth: '.mosaic-grid-sizer', percentPosition: true }); */ // Masonry /* // init Masonry var $grid = $('.mosaic-grid').imagesLoaded( function() { // init Masonry after all images have loaded $grid.masonry({ temSelector: '.mosaic-grid-item', // use element for option columnWidth: '.mosaic-grid-sizer', percentPosition: true }); }); */ /* var grid = document.querySelector('.mosaic-grid'); var msnry; imagesLoaded( grid, function() { // init Isotope after all images have loaded msnry = new Masonry( grid, { itemSelector: '.mosaic-grid-item', columnWidth: '.mosaic-grid-sizer', percentPosition: true }); }); */ /* // Parallax $('.parallax-window').parallax({ //imageSrc: '../img/parallax.jpg', speed: 0.9, }); */ });