7

The Question:

I'm loading elements via ajax. Some of them are only visible if you scroll down the page. Is there any way I can know if an element is now in the visible part of the page?

EDIT: freakytard solution was right, but I modified it a bit to also check if element is wholly visible

function isScrolledIntoView(elem) {
var docViewTop = $(window).scrollTop();
var docViewBottom = docViewTop + $(window).height();

var elemTop = $(elem).offset().top;
var elemBottom = elemTop + $(elem).height();

return ((elemBottom >= docViewTop) && (elemTop <= docViewBottom)
  && (elemBottom <= docViewBottom) &&  (elemTop >= docViewTop) );

}

Original freakytard solution:

This should do the trick:

function isScrolledIntoView(elem)
{
    var docViewTop = $(window).scrollTop();
    var docViewBottom = docViewTop + $(window).height();
    var elemTop = $(elem).offset().top;
    var elemBottom = elemTop + $(elem).height();
    return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
}

The flagged answer:

An answer to your update:

 return ((elemBottom >= docViewTop) && (elemTop <= docViewBottom)
     && (elemBottom <= docViewBottom) &&  (elemTop >= docViewTop) );

is the same as the shorter:

 return ( (elemBottom <= docViewBottom) &&  (elemTop >= docViewTop) );

It claims it is an answer. I flagged it as "not an answer", which is rejected.

I usually go through the answers when I happen to visit a famous old post, and flag the unwanted stuff posted as an answer. But the issue is, the post being famous, every 2-3 year old responses might have few upvotes. Probably because of that reason, reviewers tend to reject it, they might be even thinking it's an audit seeing the upvotes (My guess).

I tried flagging it again hoping to find other reviewers but the system doesn't allow that.

Is that an answer? Shouldn't it be a comment to the question? Or am i totally wrong?

12
  • 2
    Why is that answer not an answer? It looks like an answer to me.
    – Servy
    Sep 22, 2014 at 17:06
  • 9
    It simply states the OP's modification is same as the original answer. It is just criticising the OP's modification, the answer is already there. doesn't answer the original question at all...
    – T J
    Sep 22, 2014 at 17:07
  • 5
    Your flag was disputed by the review queue - the community felt it was an answer and disagreed with your flag. Possibly if you left a comment stating what reason you felt it wasn't an answer the decision may have been different.
    – Taryn
    Sep 22, 2014 at 17:09
  • @bluefeet did you mean, below the answer..?
    – T J
    Sep 22, 2014 at 17:10
  • 3
    It's answering a follow up question that was edited into the original question, without answering the original question. That doesn't make it NAA.
    – Servy
    Sep 22, 2014 at 17:10
  • 5
    @TJ If you added a comment under that answer on why it shouldn't be an answer the reviewers might have taken that into consideration. At this point, it looks to be an answer which is probably why they disagreed with your flag.
    – Taryn
    Sep 22, 2014 at 17:11
  • @Servy I don't see any follow up question... The post just criticizes the OP's modification saying that it is still the same as the accepted answer... it doesn't answer the question or any follow up question. i thought that should be done in comments...
    – T J
    Sep 22, 2014 at 17:37
  • 1
    It may not be an answer, but it does look like one - particularly when reviewing flags as the question isn't shown there.
    – Joe
    Sep 23, 2014 at 3:11
  • 1
    For the love of obfuscation, please stop inventing 3 letter abbreviations!
    – Lundin
    Sep 23, 2014 at 6:37
  • @Lundin What? You don't like TLAs? ;) Sep 23, 2014 at 6:48
  • @RetoKoradi TLA;DR
    – Lundin
    Sep 23, 2014 at 6:56
  • BTW: An edit war is going on for the question..
    – Bolu
    Sep 23, 2014 at 16:35

1 Answer 1

16

Your flag wasn't declined, it was disputed.

That means that a moderator didn't claim you were wrong; members of the community did.

It has been declined before; but that was back in 2011; and you weren't the flagger then.

Without a flag that tells us:

  • Why it's not an answer
  • What we should do with it
  • If it's not an answer, where should it go? under another post? The question? No where?

We can't really do much about it. It makes my spidey sense tingle, but not enough to be able to determine where it should go. The onus for that is on the flagger.

Our default rule is to keep content around unless there's a clear and convincing case for why it should be deleted. That wasn't provided here, according to the community.

1
  • 2
    I Added a comment below it. Hope the original poster take necessary action or somebody flags it again and the reviewers see my comment... :)
    – T J
    Sep 22, 2014 at 17:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .