Export 0.1.57
[platform/framework/web/web-ui-fw.git] / src / widgets / common / js / jquery.mobile.tizen.scrollview.js
index b3cc125..dbd7749 100644 (file)
 
                        this._view_offset = this._$view.offset().top - this._$clip.offset().top;
                        this._view_height = this._getViewHeight();
-                       this._clip_height = this._$clip.height();
 
                        this._sx = 0;
                        this._sy = 0;
                        }
 
                        if ( vt ) {
-                               c = this._clip_height;
-                               v = this._view_height;
+                               c = this._$clip.height();
+                               v = this._getViewHeight();
 
                                vt.start( this._sy, speedY,
                                        duration, (v > c) ? -(v - c) : 0, 0 );
                                keepGoing = !vt.done();
 
                                if ( vt.getRemained() > this.options.overshootDuration ) {
-                                       scroll_height = this._view_height - this._clip_height;
+                                       scroll_height = this._getViewHeight() - this._$clip.height();
 
                                        if ( vt.isMin() ) {
                                                this._outerScroll( y - vt.getRemained() / 3, scroll_height );
                        }
 
                        if ( dirLock !== "x" && this._vTracker ) {
-                               scroll_height = this._view_height - this._clip_height;
+                               scroll_height = this._getViewHeight() - $c.height();
 
                                if ( y > 0 ) {
                                        this._sy = 0;
 
                                if ( sm === "translate" ) {
                                        this._setElementTransform( $sbt, "0px",
-                                               -y / this._view_height * $sbt.parent().height() + "px",
+                                               -y / this._getViewHeight() * $sbt.parent().height() + "px",
                                                duration );
                                } else {
-                                       $sbt.css( "top", -y / this._view_height * 100 + "%" );
+                                       $sbt.css( "top", -y / this._getViewHeight() * 100 + "%" );
                                }
                        }
 
 
                        if ( this._is_inputbox ) {
                                target.one( "resize.scrollview", function () {
-                                       if ( ey > self._clip_height ) {
-                                               self.scrollTo( -ex, self._sy - ey + self._clip_height,
+                                       if ( ey > $c.height() ) {
+                                               self.scrollTo( -ex, self._sy - ey + $c.height(),
                                                        self.options.snapbackDuration );
                                        }
                                });
                        }
 
                        if ( dirLock !== "x" && this._vTracker ) {
-                               if ( Math.abs( this._startY - ey ) < mt ) {
+                               if ( Math.abs( this._startY - ey ) < mt && dirLock !== "xy" ) {
                                        return;
                                }
 
 
                        $v.bind( this._dragEvt, this._dragCB );
 
-                       if ( $c.jqmData("scroll") !== "y" ) {
-                               return;
-                       }
-
                        $c.bind( "updatelayout", function ( e ) {
                                var sy,
                                        vh,
-                                       clip_h = $c.height(),
                                        view_h = self._getViewHeight();
 
-                               if ( !clip_h || !view_h ) {
+                               if ( !$c.height() || !view_h ) {
                                        self.scrollTo( 0, 0, 0 );
                                        return;
                                }
 
-                               sy = clip_h - view_h;
+                               sy = $c.height() - view_h;
                                vh = view_h - self._view_height;
 
                                self._view_height = view_h;
-                               self._clip_height = clip_h;
 
-                               if ( vh == 0 || vh > clip_h / 2 ) {
+                               if ( vh == 0 || vh > $c.height() / 2 ) {
                                        return;
                                }
 
 
                        $( window ).bind( "resize", function ( e ) {
                                var focused,
-                                       clip_h = $c.height(),
                                        view_h = self._getViewHeight();
 
                                if ( $(".ui-page-active").get(0) !== $c.closest(".ui-page").get(0) ) {
                                        return;
                                }
 
-                               if ( !clip_h || !view_h ) {
+                               if ( !$c.height() || !view_h ) {
                                        return;
                                }
 
 
                                /* calibration - after triggered throttledresize */
                                setTimeout( function () {
-                                       self._view_height = self._getViewHeight();
-                                       self._clip_height = $c.height();
-
-                                       if ( self._sy < self._clip_height - self._veiw_height ) {
+                                       if ( self._sy < $c.height() - self._getViewHeight() ) {
                                                self.scrollTo( 0, self._sy,
                                                        self.options.snapbackDuration );
                                        }
                                }, 260 );
 
                                self._view_height = view_h;
-                               self._clip_height = clip_h;
                        });
 
                        $c.closest(".ui-page")
                                .one( "pageshow", function ( e ) {
                                        self._view_offset = self._$view.offset().top - self._$clip.offset().top;
+                                       self._view_height = self._getViewHeight();
                                })
                                .bind( "pageshow", function ( e ) {
                                        /* should be called after pagelayout */
                                        setTimeout( function () {
-                                               self._view_height = self._getViewHeight();
-                                               self._clip_height = self._$clip.height();
-
                                                self._set_scrollbar_size();
                                                self._setScrollPosition( self._sx, self._sy );
                                                self._showScrollBars( 2000 );
                        }
 
                        if ( this._vTracker ) {
-                               ch = this._clip_height;
-                               vh = this._view_height;
+                               ch = $c.height();
+                               vh = this._getViewHeight();
                                this._maxY = ch - vh;
 
                                if ( this._maxY > 0 ) {
                                $( this ).scrolllistview();
                        } else {
                                var st = $( this ).jqmData("scroll"),
-                                       dir = st && ( st.search(/^[xy]/) !== -1 ) ? st.charAt(0) : null,
+                                       dir = st && ( st.search(/^[xy]/) !== -1 ) ? st : null,
                                        opts;
 
                                if ( st === "none" ) {