diff --git a/scripts/ui.js b/scripts/ui.js
index 6644cea..0aabdbe 100644
--- a/scripts/ui.js
+++ b/scripts/ui.js
@@ -19,17 +19,25 @@
( function()
{
- var $trybox = null;
+ var $trybox = null,
+ $trybtn = null
+ ;
$( document ).ready( function()
{
appendTry();
+
+ if ( document.location.href.substr( -6 ) === '#tryit' )
+ {
+ console.log( 'ok' );
+ toggleTry();
+ }
} );
function appendTry()
{
- $( '
' )
+ $trybtn = $( '
' )
.attr( 'id', 'try' )
.text( 'Try It!' )
.addClass( 'btn large glow' )
@@ -41,20 +49,26 @@
} )
.click( function( event )
{
- var $try = getTry();
-
- $( this ).text(
- ( $try.is( ':visible' ) )
- ? 'Try It!'
- : 'Hide It'
- );
-
- $try.slideToggle();
+ toggleTry();
} )
.appendTo( '#header' );
}
+ function toggleTry()
+ {
+ var $try = getTry();
+
+ $trybtn.text(
+ ( $try.is( ':visible' ) )
+ ? 'Try It!'
+ : 'Hide It'
+ );
+
+ $try.slideToggle();
+ }
+
+
function getTry()
{
var $txt;