DOM Iterate using for loop

Sample for-loop iteration with classic JavaScript.

var items = document.getElementsByClassName("MyClassName");
for (var i in items) {
    items[i].style="display:block;";
    items[i].className="";
}

 

Snippets

Check if element is visible in the viewport

If you notice that your website is a little bit boring then maybe a little animation might help to make certain elements do a little fading or animation as it comes visible in the viewport.

Read more

Snippets

Detect your mouse scroll direction

To determine the mouse scroll event like scroll-up or scroll-down, we need a little bit of JavaScript to accomplish the task.

Read more

Snippets Mouse event scroll mouse up mouse down

Centering a vector image in the web page

By using CSS we can center the image horizontally and vertically in our web page

Read more

Snippets CSS HTML Center