Path: csiph.com!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Jukka K. Korpela" Newsgroups: comp.lang.javascript Subject: Re: Element visible Date: Thu, 10 Jul 2014 10:45:26 +0300 Organization: A noiseless patient Spider Lines: 28 Message-ID: References: <13026944.5APpuSVIFp@PointedEars.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Thu, 10 Jul 2014 07:45:26 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="ad9d9996ed56b0226e850b84acbddfdf"; logging-data="15800"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18uRmsfqjvLBl/V0op3O3ji" User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: X-Antivirus-Status: Clean X-Antivirus: avast! (VPS 140709-1, 10.07.2014), Outbound message Cancel-Lock: sha1:i65vlDs6iLX9pgxtI9yX0oy9Jjs= Xref: csiph.com comp.lang.javascript:25273 2014-07-10 10:15, Evertjan. wrote: > Do you have a javascript related Q? I have not had difficulties with understanding the question or with seeing it as being on-topic. The question was about ways to know if an element could be visible, and it seems obvious, in the context of this group, that it meant to ask how to test such a thing in JavaScript. Basically, how could you write a JavaScript function that takes an element node as argument and returns true or false depending on whether the element is visible or not. The main problem with the question is that it is too vague. What is “visible” in this context. You already made some good points about this. Apparently some of the conditions for being visible, in some sense, are things you cannot test in JavaScript, like the user being blind. But many things, like the position of the element, its dimensions, and CSS styles and HTML attributes that apply to it, can be tested, to some extent at least. Instead of theoretical discussions about such aspects and detailed treatment of how some specific things affecting visibility might be tested, maybe the OP should clarify what he is trying to accomplish. Some sample code, preferably with a link to an online demo, would greatly help in understanding what the practical problem is. -- Yucca, http://www.cs.tut.fi/~jkorpela/