<main></main>

.simple-slider__slider-outer {
  display:block;
  position:relative;
  overflow:hidden;
  width:200px;
  height:200px;  
}

.simple-slider__slider-inner {
  display:block;
  position:absolute;
  transition: all 0.5s;
}

.simple-slider__slider-item {
  display:inline-block;
  width:200px;
  height:200px;  
  vertical-align:top;
}
var ContentSlider = React.createClass({
  getInitialState: function() {
    return { activeItem: 0 }
  },
  setActiveItem: function(index) {
    this.setState({activeItem: index});
  },
  render: function() {
    var childrenCount = React.Children.count(this.props.children);
    var newChildren = React.Children.map(this.props.children, function(child) {
      return React.cloneElement(child, { className: "simple-slider__slider-item"});
    });
    var innerStyle = {
      width: (childrenCount * 200) + "px",
      left: (this.state.activeItem * 200 * -1) + "px"
    };

    return <div>
      <div className="simple-slider__slider-outer" >
        <div className="simple-slider__slider-inner" style={innerStyle} >
          {newChildren}
        </div>
      </div>
        <div className="pager">
            {_.map(this.props.children, function(item,index) {
             return <button onClick={this.setActiveItem.bind(this,index)}>{index}</button>
            }, this)}
        </div>        
      </div>
  }
});

var App = React.createClass({
  render: function() {
    return <ContentSlider>
          <img src="https://pbs.twimg.com/media/CBgCOOQW8AA3OCq.png" />
          <img src="https://pbs.twimg.com/media/CINXyYQWwAA_hlT.jpg" />
          <img src="https://updatesfromthefield.files.wordpress.com/2010/12/lolcat2.jpg" />
          <p>Just remember that death is not the end</p>
      </ContentSlider>
  }
});

React.render(<App />, document.querySelector('main'));
View Compiled
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/react-with-addons.js
  2. https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js