javascript - Login slider with jQuery issues -
i want make login slider jquery. have div @ top of page plus image. want plus image changed minus image , div slide down. here code there problem.
<script src="_js/jquery-1.7.2.min.js"></script> <script> $(document).ready(function() { $("form").hide(); $(".open").click(function() { $("form").slidedown("slow"); $(".open").addclass("close"); $(".close").removeclass("open"); $(".close").click(function() { $("form").slideup("slow"); $(".close").addclass("open"); $(".open").removeclass("close"); }); }); }); </script>
it works once if want slide down second theme doesn't work anymore.. can please?
tnx!
try different following:
$('.open').click(function () { $('form').slidetoggle('slow', function () { $('.open').toggleclass('form-is-open'); }); });
jquery offers toggle functions supply desired behaviour. way don't need 2 click handlers or keep track of classes yourself. above code adds class ('form-is-open') button, when form shown , removes it, when hidden.
Comments
Post a Comment