I have written this jquery code:
$(document).ready(function(){
var info = $('.info').detach();
$('.des').click(function(){
score = score + 1;
played = played + 1;
$('.kreis').addClass("borderGreen");
$('.foto').hide();
$('.kreis').append(info);
});
$('.pro').click(function(){
played = played + 1;
$('.kreis').addClass("borderRed");
$('.foto').hide();
$('.kreis').append(info);
console.log('score:' + score);
console.log('played:' + played);
});
$('.frage').mouseenter(function(){
$(this).fadeTo(460, 0.7);
});
$('.frage').mouseleave(function(){
$(this).fadeTo(350, 0);
});
});
to achieve something like this!
then I wrote the following php code to loop through that "function"
<?php foreach ($objects as $object){ ?>
<div class="kreis">
<div class="info" >
<div class="infobox">
<p style="padding-bottom:15px;border-bottom:1px solid #545454;"><?php echo $object["name"]; ?></p> <bl/>
<p style="font-weight:200;"><?php echo $object["position"]; ?></p>
</div>
<div class="social">
<a href="<?php echo $object["twitter"]; ?>"><img src="img/twitter.png" style="width:45px;margin-left:35px;padding-right:12px;"></a>
<a><img src="img/dribbble.png" style="width:45px;"></a>
</div>
</div>
<div class="foto" style="background-image:url('<?php echo $object["img"]; ?>'); ">
<div class="frage">
<div class="des box"><p>AAAAA</p></div>
<div class="pro box" style="margin-top:6%;"><p>BBBBB</p></div>
</div>
</div>
</div> <?php } ?>
Now the problem is, that if you click the .des or .pro object, jquery hides the layer of every object. Is there a way I can achieve what I want to do with jquery or do I have to use javascript or some other language? What is the most elegant way to solve this?