question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"click outside" to hide popper

See original GitHub issue

Hi guys, today I’m using this awesome library(solved my problem the show popover correctly inside of a calendar[fullcalendar]).

I needed this feature, but I solved using only Angular,

  1. you need create a directive( clickOutside):

import { Directive, ElementRef, Output, EventEmitter, HostListener } from ‘@angular/core’;

@Directive({ selector: ‘[clickOutside]’ }) export class ClickOutsideDirective { constructor (private _elementRef: ElementRef) {}

@Output() public clickOutside = new EventEmitter<MouseEvent>();

@HostListener(‘document:click’, [‘$event’, ‘$event.target’]) public onClick(event: MouseEvent, targetElement: HTMLElement): void { if (!targetElement) { return; }

const clickedInside = this._elementRef.nativeElement.contains(targetElement);
if (!clickedInside) {
  this.clickOutside.emit(event);
}

} }

so in the template, I did this: <popper-content #popMedicineContent (clickOutside)="popMedicineContent.hide()"> .... </popper-content>

Regards,

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
MrFrankelcommented, Dec 15, 2017

Just released version 1.6.0. you can now set: popperTimeoutAfterShow, which will always hide the popper-content after the specific time after its shown. popperTimeout, which will hide the popper at a delay when a hide event is triggered. popperCloseOnClickOutside, default to true, in case you dont want the popper to close on a click outside

Let me know if this suites your use case.

0reactions
johnny4youngcommented, Dec 15, 2017

I would like it!!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Popper.js: How to close popup when clicking outside
You can achieve this, by removing event delegation and checking the target on event click by using the .is(), (compare e.target if it...
Read more >
Add "click outside" option to hide tooltip · Issue #300 - GitHub
Suggestion: I've made a plugin for Tether (back in the day) for tooltips and I pass an option (Boolean) for tooltips (only ones...
Read more >
Hide | Popper
Hide. The hide modifier lets you hide the popper if it appears to be detached from its reference element, or attached to nothing...
Read more >
jQuery : Popper.js: How to close popup when clicking outside
jQuery : Popper.js: How to close popup when clicking outside [ Beautify Your Computer : https://www.hows.tech/p/recommended.html ] jQuery ...
Read more >
popper.js hide when outside boundary - CodeSandbox
CodeSandbox is an online editor tailored for web applications.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found