Here is the code:
jQuery(function($) {
$('a.panel').click(function() {
console.log($($(this).attr('href')));
var $target = $($(this).attr('href'));
$target.show().css({
left: -($target.width())
}).animate({
left: 0
}, 500);
});
});
#right {
position: relative;
float: left;
margin: 0 5px 0 0;
border: 1px solid black;
width: 200px;
height: 200px;
overflow: hidden;
}
div.panel {
position: absolute;
height: 100%;
width: 100%;
display: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><ahref="#target1" class="panel">Target 1</a><br/>
<div id="right">
<div class="panel" id="target1" style="background:blue">
<script>
var tmp = new Array("1","2","3","4");
var myvar;
var i = 0;
var timer = setInterval(function() {
if(tmp.length) {
var p= tmp.shift();
console.log(p);
document.getElementById("right").innerHTML = p;
} else {
clearInterval(timer);
}
}, 5000);
</script>
</div>
</div>
My goal is whenever a number appears the background changes color ...
So far I have only found functions that separate it.
I already tried to change click
but with no result.