Thursday, 5 September 2013

Make toggle function work only for the box that is clicked open and not all boxes?

Make toggle function work only for the box that is clicked open and not
all boxes?

Code:
<script type="text/javascript">
$(document).ready(function () {
$('.sync_box').on('click', function (e) {
e.preventDefault();
var $btn = $(this);
$btn.toggleClass('opened');
var heights = $btn.hasClass('opened') ? 300 : 100;
$(this).stop().animate({ height: heights }, 800);
//$(".sync_store_info_input_holder").toggle();
});
});
</script>
Using the above code i am able to accomplish what i need but i have a
slight problem with the following line:
$(".sync_store_info_input_holder").toggle();
I need that to show only when the .box opens and not when it closes. I
also need it so show only for the box that the user opens. I have 18 boxes
so the only box the user opens thats when the toggle function should work.

No comments:

Post a Comment