Created
May 11, 2017 10:50
-
-
Save MarcelWeidum/0c61b571f3c7d74b71c45701441062f0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
$('.single-content').hide(); | |
$(document).ready(function() { | |
var slide_time = 500; | |
$(".blocks-container .block").click(function() { | |
console.log($(this).index()); | |
var slide_status = $(this).parent().children().last().attr("slide-status"); | |
if(slide_status == "closed") { | |
$(this).parent().children().last().find($("p.omschrijving")).html($(this).children().last().text()); | |
$(this).parent().children().last().find($("img.single-image")).attr("src", $(this).children().first().children().first().attr("src")); | |
$(this).parent().children().last().slideDown(slide_time,"linear"); | |
$(this).parent().animate({'height':'1016px'}, slide_time); | |
$(this).parent().children().last().attr("slide-status", "open"); | |
$(this).parent().children().last().attr("slide-nr", $(this).index()); | |
} else { | |
if($(this).parent().children().last().attr("slide-nr") == $(this).index()) { | |
$(this).parent().children().last().slideUp(slide_time,"linear"); | |
$(this).parent().animate({'height':'450px'}, slide_time); | |
$(this).parent().children().last().attr("slide-status", "closed"); | |
$(this).parent().children().last().attr("slide-nr", $(this).index()); | |
} else { | |
$(this).parent().children().last().slideUp(slide_time,"linear"); | |
$(this).parent().animate({'height':'450px'}, slide_time); | |
$this = $(this); | |
setTimeout(function() { | |
$this.parent().children().last().find($("p.omschrijving")).html($this.children().last().text()); | |
$this.parent().children().last().find($("img.single-image")).attr("src", $this.children().first().children().first().attr("src")); | |
$this.parent().children().last().slideDown(slide_time,"linear"); | |
$this.parent().animate({'height':'1016px'}, slide_time); | |
$this.parent().children().last().attr("slide-status", "open"); | |
$this.parent().children().last().attr("slide-nr", $this.index()); | |
}, slide_time); | |
} | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment