Difference between revisions of "Template:Navarra BG/js/funciones"

Line 35: Line 35:
 
$(document).ready(function() {
 
$(document).ready(function() {
 
$('.discover').click(function() {
 
$('.discover').click(function() {
$('#intro').toogleClass('hidden');  
+
$('#intro').toggleClass('hidden');  
$('#maindesc').toogleClass('visible');  
+
$('#maindesc').toggleClass('visible');  
 
});
 
});
 
});
 
});

Revision as of 13:51, 26 September 2018

function myFunction() {

   var element = document.getElementById("intro");
   if (element.classList) { 
       element.classList.toggle("hidden");
   } else {
       var classes = element.className.split(" ");
       var i = classes.indexOf("hidden");
       if (i >= 0) 
           classes.splice(i, 1);
       else 
           classes.push("hidden");
           element.className = classes.join(" "); 
   }

}

function appear() {

   var element = document.getElementById("maindesc");
   if (element.classList) { 
       element.classList.toggle("visible");
   } else {
       var classes = element.className.split(" ");
       var i = classes.indexOf("visible");
       if (i >= 0) 
           classes.splice(i, 1);
       else 
           classes.push("visible");
           element.className = classes.join(" "); 
   }

}

$(document).ready(function() { $('.discover').click(function() { $('#intro').toggleClass('hidden'); $('#maindesc').toggleClass('visible'); }); });

$(window).scroll(function() {

  var hT = $('#scroll-to').offset().top,

hH = $('#scroll-to').outerHeight(), wH = $(window).height(), wS = $(this).scrollTop();

  if (wS > (hT+hH-wH) && (hT > wS) && (wS+wH > hT+hH)){

$('h1').addClass('view')

  } else {

$('h1').removeClass('view')

  }

});