Skip to content

Commit

Permalink
fixing container showing position
Browse files Browse the repository at this point in the history
  • Loading branch information
ces-truongvu committed May 31, 2017
1 parent d27a09e commit 2de9818
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 3 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@
<script src="js/classie.js"></script>
<!--- uncompress-->

<!-- <script type="text/javascript" src="js/jquery.elastislide.js"></script>
<script type="text/javascript" src="js/jquery.elastislide.js"></script>
<script type="text/javascript" src="js/jquery.hoverdir.js"></script>
<script type="text/javascript" src="js/elastic_grid.js"></script>
-->

<!-- compress version-->
<!-- compress version
<script type="text/javascript" src="js/elastic_grid.min.js"></script>

-->
<script type="text/javascript">
$(function(){
$("#elastic_grid_demo").elastic_grid({
Expand Down
9 changes: 7 additions & 2 deletions js/elastic_grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,8 @@ $(function() {
}
});

$body.animate( { scrollTop : $this.offset().top }, settings.speed );

return false;
});

Expand Down Expand Up @@ -856,12 +858,15 @@ $(function() {
// case 1 : preview height + item height fits in window´s height
// case 2 : preview height + item height does not fit in window´s height and preview height is smaller than window´s height
// case 3 : preview height + item height does not fit in window´s height and preview height is bigger than window´s height

// console.log(this.$item.offset().top, this.$item[0].offsetTop, this.$item.data( 'offsetTop' ))

var position = this.$item[0].offsetTop,
previewOffsetT = this.$previewEl.offset().top - scrollExtra,
scrollVal = this.height + this.$item.data( 'height' ) + marginExpanded <= winsize.height ? position : this.height < winsize.height ? previewOffsetT - ( winsize.height - this.height ) : previewOffsetT;

// console.log(position, previewOffsetT, scrollVal)
$body.animate( { scrollTop : scrollVal }, settings.speed );
// $body.animate( { scrollTop : scrollVal }, settings.speed );
$body.animate( { scrollTop : this.$item.offset().top }, settings.speed );

},
setTransition : function() {
Expand Down
Loading

0 comments on commit 2de9818

Please sign in to comment.