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' )
@ -41,20 +49,26 @@
} ) } )
.click( function( event ) .click( function( event )
{ {
var $try = getTry(); toggleTry();
$( this ).text(
( $try.is( ':visible' ) )
? 'Try It!'
: 'Hide It'
);
$try.slideToggle();
} ) } )
.appendTo( '#header' ); .appendTo( '#header' );
} }
function toggleTry()
{
var $try = getTry();
$trybtn.text(
( $try.is( ':visible' ) )
? 'Try It!'
: 'Hide It'
);
$try.slideToggle();
}
function getTry() function getTry()
{ {
var $txt; var $txt;