<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Slideshow JS</title>
</head>
<body>
<!-- Parte total do slideshow-->
<div id="tudo">
<!-- Coluna 1 - Nome das Notícias -->
<div id="coluna_um">
<ul>
<li>
<a href="" onmouseover='' id="noticia1" class="fotos" data-slide="foto1">
<h3>Teste de Título 1</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In eget augue purus, at interdum turpis.</p>
</a>
</li>
<li>
<a href="" onmouseover="" id="noticia2" class="fotos" data-slide="foto2">
<h3>Teste de Título 2</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In eget augue purus, at interdum turpis.</p>
</a>
</li>
<li>
<a href="" onmouseover="" id="noticia3" class="fotos" data-slide="foto3">
<h3>Teste de Título 3</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In eget augue purus, at interdum turpis.</p>
</a>
</li>
<li>
<a href="" onmouseover="" id="noticia4" class="fotos" data-slide="foto4">
<h3>Teste de Título 4</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In eget augue purus, at interdum turpis.</p>
</a>
</li>
</ul>
</div>
<!-- Coluna 2 - Foto das Notícias -->
<div id="coluna_dois">
<ul>
<a href="#" id="foto1">
<li>
<div class="info">Lorem Ipsun sit amet</div>
</li>
</a>
<a...
function initialize(){
var nodeList = document.querySelectorAll(".fotos"),
i = k = nodeList.length, j;
while (i--){ // Add the black magic in mouseover for every fucking .fotos
nodeList[i].addEventListener("mouseover", function() {
j=k;
//Iterate over the slides to hide them, couse the mothafocka NodeList dont accept style =\
// i'm only doing this again cause i'm a sociopath
while (j--){ // Lets hide that shit
document.getElementById(nodeList[j].getAttribute('data-slide')).style.display = "none";
}
// And show like a Britney shows her pussy
document.getElementById(this.getAttribute('data-slide')).style.display = "block";
});
}
}// FINISH HIM
window.addEventListener("DOMContentLoaded", initialize, true); //u mo bu kai fei di tal
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.