Team:UCLA/Template/Javascript
From 2014.igem.org
(Difference between revisions)
Samichaels (Talk | contribs) |
Samichaels (Talk | contribs) |
||
Line 143: | Line 143: | ||
$('html,body').animate({scrollTop:dest}, 700,'swing'); | $('html,body').animate({scrollTop:dest}, 700,'swing'); | ||
}); | }); | ||
+ | |||
+ | <!--SLIDING SIDE MENU--> | ||
+ | var menuLeft = document.getElementById( 'cbp-spmenu-s1' ), | ||
+ | menuRight = document.getElementById( 'cbp-spmenu-s2' ), | ||
+ | menuTop = document.getElementById( 'cbp-spmenu-s3' ), | ||
+ | menuBottom = document.getElementById( 'cbp-spmenu-s4' ), | ||
+ | showLeft = document.getElementById( 'showLeft' ), | ||
+ | showRight = document.getElementById( 'showRight' ), | ||
+ | showTop = document.getElementById( 'showTop' ), | ||
+ | showBottom = document.getElementById( 'showBottom' ), | ||
+ | showLeftPush = document.getElementById( 'showLeftPush' ), | ||
+ | showRightPush = document.getElementById( 'showRightPush' ), | ||
+ | body = document.body; | ||
+ | |||
+ | showLeft.onclick = function() { | ||
+ | classie.toggle( this, 'active' ); | ||
+ | classie.toggle( menuLeft, 'cbp-spmenu-open' ); | ||
+ | disableOther( 'showLeft' ); | ||
+ | }; | ||
+ | showRight.onclick = function() { | ||
+ | classie.toggle( this, 'active' ); | ||
+ | classie.toggle( menuRight, 'cbp-spmenu-open' ); | ||
+ | disableOther( 'showRight' ); | ||
+ | }; | ||
+ | showTop.onclick = function() { | ||
+ | classie.toggle( this, 'active' ); | ||
+ | classie.toggle( menuTop, 'cbp-spmenu-open' ); | ||
+ | disableOther( 'showTop' ); | ||
+ | }; | ||
+ | showBottom.onclick = function() { | ||
+ | classie.toggle( this, 'active' ); | ||
+ | classie.toggle( menuBottom, 'cbp-spmenu-open' ); | ||
+ | disableOther( 'showBottom' ); | ||
+ | }; | ||
+ | showLeftPush.onclick = function() { | ||
+ | classie.toggle( this, 'active' ); | ||
+ | classie.toggle( body, 'cbp-spmenu-push-toright' ); | ||
+ | classie.toggle( menuLeft, 'cbp-spmenu-open' ); | ||
+ | disableOther( 'showLeftPush' ); | ||
+ | }; | ||
+ | showRightPush.onclick = function() { | ||
+ | classie.toggle( this, 'active' ); | ||
+ | classie.toggle( body, 'cbp-spmenu-push-toleft' ); | ||
+ | classie.toggle( menuRight, 'cbp-spmenu-open' ); | ||
+ | disableOther( 'showRightPush' ); | ||
+ | }; | ||
+ | |||
+ | function disableOther( button ) { | ||
+ | if( button !== 'showLeft' ) { | ||
+ | classie.toggle( showLeft, 'disabled' ); | ||
+ | } | ||
+ | if( button !== 'showRight' ) { | ||
+ | classie.toggle( showRight, 'disabled' ); | ||
+ | } | ||
+ | if( button !== 'showTop' ) { | ||
+ | classie.toggle( showTop, 'disabled' ); | ||
+ | } | ||
+ | if( button !== 'showBottom' ) { | ||
+ | classie.toggle( showBottom, 'disabled' ); | ||
+ | } | ||
+ | if( button !== 'showLeftPush' ) { | ||
+ | classie.toggle( showLeftPush, 'disabled' ); | ||
+ | } | ||
+ | if( button !== 'showRightPush' ) { | ||
+ | classie.toggle( showRightPush, 'disabled' ); | ||
+ | } | ||
+ | } | ||
</script> | </script> | ||
</html> | </html> |
Revision as of 21:16, 6 August 2014