1. #1
    Sencha User
    Join Date
    Jul 2009
    Location
    Austin, TX
    Posts
    47
    Vote Rating
    0
    slsmithtx is on a distinguished road

      0  

    Default Finding out if an element is hidden by scrolling

    Finding out if an element is hidden by scrolling


    Is there a way to determine that an element is below or above the display of a scrolled container, in other words out of sight?

  2. #2
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default


    Hi!

    i have a container with scrolling in it.
    now i am finding is my element (under container) is hide or not (Due to scrolling)

    Code:
    function elementStateInScrolling(yourElem){
         var containerTop = yourContainer.getScroll( ).top()
           , containerBottom = containerTop + yourContainer.getHeight()
           , elemTop = yourElem.getEl().getY()
           , elemBottom = elemTop + yourElem.getHeight();
    
         return ((elemBottom <= containerBottom) && (elemTop >= containerTop));
    }
    for more info, refer to this:-
    http://stackoverflow.com/questions/4...fter-scrolling
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  3. #3
    Sencha User
    Join Date
    Jul 2009
    Location
    Austin, TX
    Posts
    47
    Vote Rating
    0
    slsmithtx is on a distinguished road

      0  

    Default


    Thanks for the help! I had to make a slight adjustment to your code to get it to work in my situation:

    Code:
    elementStateInScrolling: function (el,ctr){
            var containerTop, containerBottom, elemTop, elemBottom;
            containerTop = ctr.getY();
            containerBottom = containerTop + ctr.getHeight();
            elemTop = el.getY();
            elemBottom = elemTop + el.getHeight();
            return ((elemBottom <= containerBottom) && (elemTop >= containerTop));
    }
    I'm passing in the container object and using getY to get it's top position instead of top.

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi