Skip to content

Instantly share code, notes, and snippets.

@and1truong
Created October 3, 2012 00:28
Show Gist options
  • Select an option

  • Save and1truong/3824203 to your computer and use it in GitHub Desktop.

Select an option

Save and1truong/3824203 to your computer and use it in GitHub Desktop.
SSO - Search Form
Edit the view, change exposed filter label to change the text.
Drupal.behaviors.ssSearch = function(context) {
var $form = $('#header-region form');
var $text = $form.find('.form-text');
$form.find('.form-text')
.focus(function(){ $form.find('label').hide(); })
.blur(function(){
var val = $(this).val();
if ($.trim(val) === '') {
$form.find('label').show();
}
});
var val = $text.val();
if (val !== '') {
$form.find('label').hide();
}
}
/* Searchbox on header */
#header-region .views-exposed-form .views-widget-filter-keys { position: relative; }
#header-region .views-exposed-form .views-widget-filter-keys label { position: absolute; top: 5px; left: 5px; font-weight: normal; font-style: italic; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment