dsrussell
11-15-2010, 07:59 PM
Hello,
I'm a complete noobie to JavaScript so my apologies in advance if I'm asking something totally stupid.
I'm trying to get a website up and running using WordPress. A particular plug-in for WP makes the site I'm building mobile-phone etc friendly - and I have a question regarding some JS that is part of the plug-in.
Before people think badly of me, the licensing terms of the plug-in allow users to modify the code, but the suppliers will not respond for requests for help in doing so. I'm therefore having to see whether I can figure out how to do this myself.
If I've understood correctly, the extract of code below will show/hide a search box when the user clicks on the search button on the menu page. However, I would like the search box to always be visible when the user visits the menu page (but not on any other pages).
With the extract provided, could anybody tell me please, how to change the code to keep the search box permanently visible? :confused:
With many thanks in advance
Darren
PS I've only selected what I think are the important lines of code - hope I've included enough ....
var touchJS = jQuery.noConflict();
/* Toggling the search bar from within the menu */
touchJS( 'a#tab-search' ).unbind( 'click' ).click( function() {
touchJS( '#search-bar' ).toggleClass( 'show-search' );
touchJS( this ).toggleClass( 'search-toggle-open' );
if ( touchJS( '#search-bar' ).hasClass( 'show-search' ) ) {
touchJS( 'input#search-input' ).focus();
} else{
touchJS( 'input#search-input' ).blur();
}
return false;
});
I'm a complete noobie to JavaScript so my apologies in advance if I'm asking something totally stupid.
I'm trying to get a website up and running using WordPress. A particular plug-in for WP makes the site I'm building mobile-phone etc friendly - and I have a question regarding some JS that is part of the plug-in.
Before people think badly of me, the licensing terms of the plug-in allow users to modify the code, but the suppliers will not respond for requests for help in doing so. I'm therefore having to see whether I can figure out how to do this myself.
If I've understood correctly, the extract of code below will show/hide a search box when the user clicks on the search button on the menu page. However, I would like the search box to always be visible when the user visits the menu page (but not on any other pages).
With the extract provided, could anybody tell me please, how to change the code to keep the search box permanently visible? :confused:
With many thanks in advance
Darren
PS I've only selected what I think are the important lines of code - hope I've included enough ....
var touchJS = jQuery.noConflict();
/* Toggling the search bar from within the menu */
touchJS( 'a#tab-search' ).unbind( 'click' ).click( function() {
touchJS( '#search-bar' ).toggleClass( 'show-search' );
touchJS( this ).toggleClass( 'search-toggle-open' );
if ( touchJS( '#search-bar' ).hasClass( 'show-search' ) ) {
touchJS( 'input#search-input' ).focus();
} else{
touchJS( 'input#search-input' ).blur();
}
return false;
});