Tagged: x
-
AuthorPosts
-
August 11, 2016 at 4:26 pm #1127744
Paul GParticipantGuys,
I’ve searched the forum but can’t find any solution for this, but apologies if there is one!
I’m trying to configure a card button to open the search overlay.
I’ve essentially got three cards on my home screen, two of which will link to other pages, but the last one needs to open the search function.Not sure how I do this, so would appreciate your assistance.
Kind Thanks,
Paul.August 11, 2016 at 10:32 pm #1128257
LelyModeratorHello Paul,
Please try adding this custom javascript on Appearance > Customize > Custom > Edit Global Javascript:
jQuery( function( $ ) { $('.search-trigger .x-face-button').on('touchstart click', function(e) { e.preventDefault(); $('.x-searchform-overlay').toggleClass('in'); $('.x-searchform-overlay').find('.search-query').focus(); }); });Then add search-trigger on your card element class field.
Hope this helps.
August 12, 2016 at 8:10 am #1128707
Paul GParticipantThanks so much – that worked like a charm!
Brilliant!Can I just ask why the following code (which I already have) didn’t work when I typed the x-search-btn class in the card class?
jQuery(document).ready(function($) {
var $trigger = $(‘.x-search-btn’);
var $formWrap = $(‘.x-searchform-overlay’);
var $input = $formWrap.find(‘.search-query’);
$trigger.click(function(e) {
e.preventDefault();
$formWrap.toggleClass(‘in’);
$input.focus();
});
});August 12, 2016 at 12:54 pm #1128988
Nabeel AModeratorHi again,
Glad we could help. You might not have selected the right class for the trigger button.
Have a nice day!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1127744 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
