1. #1
    Sencha User
    Join Date
    Jul 2009
    Location
    Austin, TX
    Posts
    44
    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,332
    Vote Rating
    83
    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
    44
    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

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar