React-Scroll_Pagination.
Starting point for creating JSFiddles with React. This uses React with Addons. The fork one is based on the original one.
by Nick Wang
HTML
<script src="https://fb.me/react-with-addons-15.0.1.js"></script>
<script src="https://fb.me/react-dom-15.0.1.js"></script>
<script src="//cdn.bootcss.com/jquery/2.2.1/jquery.min.js"></script>
<script src="//cdn.bootcss.com/babel-core/5.8.24/browser.js"></script>
<script src="https://facebook.github.io/react/js/jsfiddle-integration-babel.js"></script>
<div id="container">
</div>
JavaScript 1.7
// ################## React-Scroll-Pagination. Begin.#########
const ReactScrollPagination = React.createClass({
isolate: {
onePageHeight: null,
timeoutFunc: null,
excludeHeight: null,
defaultShowTime: 2000
},
pageDivStle: {
position: 'fixed',
bottom: '15px',
left: 0,
right: 0,
textAlign: 'center'
},
pageContentStyle: {
display: 'inline-block',
background: 'rgba(6, 6, 6, 0.54)',
borderRadius: '5px',
padding: '3px 15px',
minWidth: '80px',
color: '#fff',
textAlign: 'center',
margin: '0 auto',
opacity: 1,
WebkitTransition: 'opacity 0.8s',
MozTransition: 'opacity 0.8s',
OTransition: 'opacity 0.8s',
transition: 'opacity 0.8s'
},
getInitialState: function () {
return {
currentPage: 1,
totalPages: null,
showPageStatus: false
}
},
showPageDiv: function () {
if (this.isolate.timeoutFunc) {
clearTimeout(this.isolate.timeoutFunc)
}
this.setState({showPageStatus: true})
let showTime = this.props.paginationShowTime ? parseInt(this.props.paginationShowTime)
: this.isolate.defaultShowTime
this.isolate.timeoutFunc = setTimeout(() => {
this.setState({showPageStatus: false})
}, showTime)
},
getExcludeHeight: function () {
if (this.isolate.excludeHeight !== null) {
return this.isolate.excludeHeight
}
// 获取需要减去的高度
let excludeHeight = 0
if (this.props.excludeHeight) {
let propsExcludeHeight = parseInt(this.props.excludeHeight)
if (isNaN(propsExcludeHeight)) {
console.error('WARN: Failed to convert the props excludeHeight "' + this.props.excludeHeight +
'" to Number, please verify. Will take "0" by default.')
} else {
excludeHeight = propsExcludeHeight
}
} else if (this.props.excludeElement && typeof this.props.excludeElement === 'string') {
let excludeEle = jQuery(this.props.excludeElement)
if (excludeEle.size() ===...