Skip to content

enchhuang/viewpager.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

viewpager.js

Basic usage

...
var  w = view_pager_elem.getBoundingClientRect().width;

var vp = new ViewPager(view_pager_elem, {
  pages: item_container.children.length,
  onPageScroll : function (scrollInfo) {
    offset = -scrollInfo.totalOffset;
    item_container.style['-webkit-transform'] = 'translate3d(' + (-scrollInfo.totalOffset * w) + 'px, 0px, 0px)';
  },

  onPageChange : function (page) {
    console.log('page', page);
  }
});

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%