Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.javascript Subject: Re: How to do a popup box Date: Fri, 26 Jun 2015 20:28:29 +0100 Organization: A noiseless patient Spider Lines: 74 Message-ID: <87r3oygtgi.fsf@bsb.me.uk> References: <41326d5d-0202-44e4-911b-6474f8f89bc8@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="21251"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Q1gtzikCjlG7AEzdsjhVaB+R+Kg4Gq0E=" Cancel-Lock: sha1:EWXZOC6ufFaCUtncreJYsS/CO3M= sha1:9KfawyRM+diR5QMySni9cI75StE= X-BSB-Auth: 1.81e7274e9d5b512c4374.20150626202829BST.87r3oygtgi.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:28184 Gregor Kofler writes: > Am 2015-06-26 um 07:54 schrieb bit-naughty@hotmail.com: >> Oh for God's sake - there's SEVEN replies, all filled with *this* >> bullshit - if you don't want to help me, DON'T, don't go on and on >> about it...?!!! This is NOT homework, but yes, it IS for a site I'm >> making, and I can only tell you what I *thought* of - I don't *know* >> what to code, if I knew, I wouldn't BE here....? >> >> The z-index for this "menu" has to be more than that of the page, >> right.....? But I can't figure out how to code the "onclick" >> stuff..... The menu has to be displayed where the mouse was clicked, >> how do I do that? > > Depends. Most people use libraries for that. In plain JS/DOM you would > calculate the position of the clicked element in your listener by > summing up the offsetTop/offsetLeft properties of the element and all > parent elements. Then position your menu absolutely at this > coordinate, set an appropriate zIndex (or define a suitable z-index in > your CSS). Voilą... Is there are reason to avoid using the position of the mouse click as contained in the event? My sketch of the method would be: Menu
-- Ben.