void addEventListener(final String type, final EventListener eventListener) { DomGlobal.document.addEventListener(type, eventListener); }
public ScrollTop(BaseIcon<?> icon) { super(icon); init(this); circle(); setSize(ButtonSize.LARGE); setBackground(Color.THEME); style.add("top-scroller"); collapse(); addClickListener(evt -> ElementUtil.scrollTop()); document.addEventListener(EventType.scroll.getName(), evt -> { if (document.scrollingElement.scrollTop > showOffset) { ScrollTop.this.expand(); } else { ScrollTop.this.collapse(); } }); }
public ScrollTop(BaseIcon<?> icon) { super(icon); init(this); circle(); setSize(ButtonSize.LARGE); setBackground(Color.THEME); style.add("top-scroller"); collapse(); addClickListener(evt -> ElementUtil.scrollTop()); document.addEventListener(EventType.scroll.getName(), evt -> { if (document.scrollingElement.scrollTop > showOffset) { ScrollTop.this.expand(); } else { ScrollTop.this.collapse(); } }); }
public DropDownMenu(HTMLElement targetElement) { this.targetElement = targetElement; EventListener listener = evt -> closeAllMenus(); document.addEventListener("click", listener); document.addEventListener("touchend", evt -> { if (!touchMoved) { closeAllMenus(); document.addEventListener("touchmove", evt -> this.touchMoved = true);
public DropDownMenu(HTMLElement targetElement) { this.targetElement = targetElement; EventListener listener = evt -> closeAllMenus(); document.addEventListener("click", listener); document.addEventListener("touchend", evt -> { if (!touchMoved) { closeAllMenus(); document.addEventListener("touchmove", evt -> this.touchMoved = true);