File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 1414// </div>
1515// which shows you local search results before normal organic results.
1616//</p>
17+ //
18+ // You can also toggle the popover using the click action.
19+ // <div class="popover inline-block" data-controller="popover" data-action="click->popover#toggle" data-action="mouseover->popover#mouseOver mouseout->popover#mouseOut">
1720
1821import { Controller } from '@hotwired/stimulus'
1922
@@ -36,4 +39,12 @@ export default class extends Controller {
3639 mouseOut ( ) {
3740 this . contentTarget . classList . add ( 'hidden' )
3841 }
42+ // Toggle the popover on demand
43+ toggle ( ) {
44+ if ( this . contentTarget . classList . contains ( 'hidden' ) ) {
45+ this . contentTarget . classList . remove ( 'hidden' )
46+ } else {
47+ this . contentTarget . classList . add ( 'hidden' )
48+ }
49+ }
3950}
You can’t perform that action at this time.
0 commit comments