다른 DIV의 클릭/언 클릭으로 DIV의 여백을 변경하려고합니다. css onclick/unclick 변경
지금이 바로 유무 :$(document).ready(function(){
$(".model_drop_pane").hide();
$(".show-hide").click(function() {
if ($("#body_machine_novideo").css('margin-top', '50px')) {
$("#body_machine_novideo").css('margin-top', '300px');
$(".model_drop_pane").slideToggle();
} else {
$("#body_machine_novideo").css('margin-top', '50px');
$(".model_drop_pane").slideToggle();
}
});
});
아이디어는 다음 .show 숨기기 DIV의 클릭시에, #body_machine_novideo
DIV는 50에서 300 픽셀로 margin-top
의 변화, 또한 .model_drop_pane
DIV가 전환됩니다. 이 부분은 작동합니다.
문제는 다음 .show 숨기기 DIV를 두 번 ("unclicking")를 클릭시에, .model_drop_pane
DIV는의 #body_machine_novideo
DIV의 그러나 여백 값이 50 픽셀, 그리고 유물로 다시 재설정되지 않습니다해야한다로 전환 300px.
A working demo of the problem can be found here. 로고 바로 아래의 Equipment : Chemical Mixing Stand 링크를 클릭하십시오.