Mark
Mark

Reputation: 111

Advanced Slider Customization

I am trying to achieve below image type of slider using Superslides and Bxslider.

ques.jpg

Slider Explanation:

What I have done using Superslides and Bxslider Using callback functions of bxslider to animate the car, but stuck.

Help: I need ideas how to achieve such result.What kind of slider I can use to acheieve something like this.

Reference link but with jQuery

Upvotes: 1

Views: 138

Answers (1)

Sharfaraz Bheda
Sharfaraz Bheda

Reputation: 457

(function($) {
        var elem = $.jInvertScroll(['.scroll'],        // an array containing the selector(s) for the elements you want to animate
            {
            height: 6000,                   // optional: define the height the user can scroll, otherwise the overall length will be taken as scrollable height
            onScroll: function(percent) {   //optional: callback function that will be called when the user scrolls down, useful for animating other things on the page
                console.log(percent);
            }
        });

        $(window).resize(function() {
          if ($(window).width() <= 768) {
            elem.destroy();
          }
          else {
            elem.reinitialize();
          }
        });
    }(jQuery));
 html,
body
{
  padding: 0;
  margin: 0;
  font-family: Arial, sans-serif;
}

/* hide horizontal scrollbars, since we use the vertical ones to scroll to the right */
body
{
  overflow-x: hidden;
  background: url('../images/bg.jpg') repeat top left;
}

h1
{
  font-size: 20px;
  font-weight: normal;
  color: #2e6e80;
}

/**
  * important: keep position fixed, you can however use top:0 instead of bottom:0
  * if you want to make it stick to the top of the browser
  */
.scroll
{
  position: fixed;
  bottom: 0;
  left: 0;
}

/**
  * z-index ordering of the different layers, do this for your layers,
  * also assign absolute width (to prevent issues if the script gets executed before the images get loaded)
  */
.horizon
{
  z-index: 1;
  width: 3000px;
}

.middle
{
  z-index: 500;
  width: 4000px;
}

.front
{
  z-index: 1000;
  width: 6000px;
}
<h1>jInvertScroll Example</h1>
    
    <div class="horizon scroll">
        <img src="https://raw.githubusercontent.com/pixxelfactory/jInvertScroll/master/examples/images/horizon.png" alt="" />
    </div>
    <div class="middle scroll">
        <img src="https://raw.githubusercontent.com/pixxelfactory/jInvertScroll/master/examples/images/middle.png" alt="" />
    </div>
    <div class="front scroll">
        <img src="https://raw.githubusercontent.com/pixxelfactory/jInvertScroll/master/examples/images/front.png" alt="" />
    </div>
<script src="http://www.pixxelfactory.net/jInvertScroll/js/jquery.min.js"></script>
<script src="http://www.pixxelfactory.net/jInvertScroll/js/jquery.jInvertScroll.js"></script>

Upvotes: 1

Related Questions