There are 4 boxes initially of equal sizes.
When user clicks on any box it enlarges to the big box with content to the height and width of parent div
and hide other siblings.
On enlarge div
there are content, close button and continue button to the next div
. Here is the code:
$(function(){
var $currentBox = false;;
var open = false;
var origHeight = $('.box').innerHeight() + 'px';
var origWidth = $('.box').innerWidth() + 'px';
$(".clsbtn").click(function(){
$(".box").animate({
"height": origHeight,
"width": origWidth
},800);
$(".box").show();
$(".box-container").show();
$(".box-content").hide();
$(".box").on("click");
});
$(".box").click(function() {
if (open) {
$currentBox = false;
$(this).animate({
"height": origHeight,
"width": origWidth
},800);
$(".box").show();
$(".box-container").show();
$(".box-content").hide();
open = false;
$(".box").bind("click");
} else {
$currentBox = $(this);
var width = $('.boxes').innerWidth() + 'px',
height = $('.boxes').innerHeight() + 'px';
$(this).animate({
"height": height,
"width": width
},800);
$(this).find(".box-container").hide();
$(this).find(".box-content").show();
$(".box").not(this).hide();
open = true;
$(".box").unbind("click");
}
});
});
});
Issues:
When box enlarges it disable the clicks on parent
div
(i.e. "box") and the close button working properly. But when on click of close button the rebind function is not working. So if div is close back to its original size then it click is not working to make it enlarge again.Secondly i want to make continue button to next enlarged open div. Any help would be appreciated.
Thanks