Created
February 1, 2016 15:54
-
-
Save seb/fdc1a1463174a9f6946f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#css | |
.info,#people{display:block;width:100%} | |
.person{display:inline-block;width:30%} | |
<dic id="people"> | |
<div class="person" data-name="John Lennon" data-content="Lorem Ipsum..."><img src="photo.jpg" /></div> | |
<div class="person" data-name="Paul McCartney" data-content="Lorem Ipsum..."><img src="photo.jpg" /></div> | |
<div class="info"></ | |
</div> | |
# Dans le JS : | |
$(document).on 'click', ".person" , (e) -> | |
$(".info").removeClass("visible") | |
name = $(this).data(name) | |
content = $(this).data(content) | |
$(".person").nth-child(num_of_item_per_lines).append("<div class='info'>" + name "</div>") | |
$(".info").addClass("visible") | |
$.ready -> | |
num_of_item_per_lines = parseInt($("#people").width()/$(".person).fisrt().width()) # 3 ou 5 ou 2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment