Here is the code:
var smiles = $("#smilesChoose"); $("#smilesBtn").click(function () {smiles.toggle(duration = 600); }); .enter_send_mess{ float: left; width: 50px; height: 19px; margin-top: 2px; margin-left: -1px; border-top: 1px; box-shadow: 0px -2px 1px #9b9b9b; opacity: 1; } .enter_send_mess:hover{ cursor: pointer; opacity: 0.7; } #smilesChoose { display: none; position: absolute; right: 100px; top: 50px; background: #fff; padding: 10px; width: 200px; border: 1px solid #eee; -moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> <div class="wrap_send_mess"> <div class="enter_send_mess" id="smilesBtn">Нажми</div> <div id="smilesChoose">o:) oO 3:) <3 :* :-) 8| :/ ;) :'( >:( :( 8) :p :D</div> </div> I do not understand why everything works here, but I don’t. When you click on a button, a hidden block appears and on the second click it disappears. Only here on my page it only appears, but does not want to disappear. What could be the problem?
togglemethod? it can work either without parameters, or accept a boolean value (show / hide), and you write with some kind of fright in the parameterduration = 600. this expression, it will be executed, thedurationvariable will become equal to 600, the result of the expression will be a logicaltrue. therefore, your blocks will always be shown. - teran