Strock Real Estate Javascript

 avatar
user_3758723130
javascript
a year ago
1.8 kB
1
Indexable
<script>
/*Animate elements on scroll*/
function addWowClassToHeadings() {
    /*Get the elements to which the classes are to be added*/
    let titles = document.querySelectorAll("h3.custom-pretitle, h1, h2, h2.lp-h2, h1.lp-h1, h2.title, h2.serif, h3.custom-pretitle, h4, h4.lp-h4, a");
    
    titles.forEach(title => {
    /*Classes to add*/  
    title.classList.add("wow", "animated", "fadeInDown");
    });
}

document.addEventListener("DOMContentLoaded", () => {
    /*Init the library to animate on scroll*/
    new WOW().init();
    /*Call the function*/
    addWowClassToHeadings();
});


//Start - set up text to print, each item in array is new line - Typerwriter in Opening Video H1 - Jaena A.
var aText = new Array(
"Rose Wood"
);
var iSpeed = 100; // time delay of print out
var iIndex = 0; // start printing array at this posision
var iArrLength = aText[0].length; // the length of the text array
var iScrollAt = 20; // start scrolling up at this many lines
 
var iTextPos = 0; // initialise text position
var sContents = ''; // initialise contents variable
var iRow; // initialise current row
 
function typewriter()
{
 sContents =  ' ';
 iRow = Math.max(0, iIndex-iScrollAt);
 var destination = document.getElementById("typedtext");
 
 while ( iRow < iIndex ) {
  sContents += aText[iRow++] + '<br />';
 }
 destination.innerHTML = sContents + aText[iIndex].substring(0, iTextPos) + "_";
 if ( iTextPos++ == iArrLength ) {
  iTextPos = 0;
  iIndex++;
  if ( iIndex != aText.length ) {
   iArrLength = aText[iIndex].length;
   setTimeout("typewriter()", 400);
  }
 } else {
  setTimeout("typewriter()", iSpeed);
 }
}

typewriter();

//End - set up text to print, each item in array is new line - Typerwriter in Opening Video H1 - Jaena A.


</script>

Leave a Comment