I was wonder if anyone can tell me why this isn’t working? It works just for once. I am trying to switch height of div
with foundation's switch object. Also it switches perfectly when I click to #new tag. But that wasn't the idea.
var open = 0;
$('#newtopicbutton').click(function() {
if (open === 0) {
$('#new').css({
'height': '440px',
'color': 'white',
'font-size': '44px'
});
open = 1;
} else {
if (open === 1) {
$('#new').css({
'height': '48px',
'color': 'white',
'font-size': '44px'
});
open = 0;
}
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="new" class="large-3 medium-3 small-3 columns" style="padding-top:10px;background:#2f2f2f;margin-top:20px;height:440px;color:white;font-weight:700;font-size:14px !important;">
<div id="newtopicbutton" class="switch small">
<input class="switch-input" style="background:red;" id="exampleSwitch" checked="true" type="checkbox" name="exampleSwitch">
<label class="switch-paddle" for="exampleSwitch">
<span class="show-for-sr float-right">NEW TOPICS</span>
</label>
</div>
</div>
It works just for once.