Simplified the JQuery logic and made it more robust.

This commit is contained in:
Scott Wallace 2014-05-15 17:16:03 +01:00
parent c7bdfb72c4
commit 118f68eef7

View file

@ -113,18 +113,16 @@
<script type="text/javascript"> <script type="text/javascript">
function openMenu() { function openMenu() {
$(function(){ $(function(){
if ( $("#rightmenu").attr("data-open") != "true" ) { if ( $("#rightmenu").css("display") == "none" ) {
$("#rightmenu").css("display", "inline"); $("#rightmenu").css("display", "inline");
$("#rightmenu").animate({left: "-=" + $("#rightmenu").css("width")}, 1000); $("#rightmenu").animate({left: "-=" + $("#rightmenu").css("width")}, 1000);
$("#rightmenu").attr("data-open", "true");
} }
}); });
} }
function closeMenu() { function closeMenu() {
$(function(){ $(function(){
if ( $("#rightmenu").attr("data-open") != "false" ) { if ( $("#rightmenu").css("display") != "none" ) {
$("#rightmenu").attr("data-open", "false");
$("#rightmenu").animate({left: "+=" + $("#rightmenu").css("width")}, 1000, function(){ $("#rightmenu").animate({left: "+=" + $("#rightmenu").css("width")}, 1000, function(){
$("#rightmenu").css("display", "none"); $("#rightmenu").css("display", "none");
}); });