1
0
Fork 0

Can now show tryit area via hash

website
Mike Gerwitz 2011-04-04 22:37:13 -04:00
parent 3d879183c1
commit 3a98245628
1 changed files with 25 additions and 11 deletions

View File

@ -19,17 +19,25 @@
( function() ( function()
{ {
var $trybox = null; var $trybox = null,
$trybtn = null
;
$( document ).ready( function() $( document ).ready( function()
{ {
appendTry(); appendTry();
if ( document.location.href.substr( -6 ) === '#tryit' )
{
console.log( 'ok' );
toggleTry();
}
} ); } );
function appendTry() function appendTry()
{ {
$( '<div>' ) $trybtn = $( '<div>' )
.attr( 'id', 'try' ) .attr( 'id', 'try' )
.text( 'Try It!' ) .text( 'Try It!' )
.addClass( 'btn large glow' ) .addClass( 'btn large glow' )
@ -40,18 +48,24 @@
event.preventDefault(); event.preventDefault();
} ) } )
.click( function( event ) .click( function( event )
{
toggleTry();
} )
.appendTo( '#header' );
}
function toggleTry()
{ {
var $try = getTry(); var $try = getTry();
$( this ).text( $trybtn.text(
( $try.is( ':visible' ) ) ( $try.is( ':visible' ) )
? 'Try It!' ? 'Try It!'
: 'Hide It' : 'Hide It'
); );
$try.slideToggle(); $try.slideToggle();
} )
.appendTo( '#header' );
} }