Giter Site home page Giter Site logo

slidr's Introduction

slidr.js

A simple, lightweight javascript library for adding slide transitions to your page. No dependencies required.

Tested on Chrome 26.0, Firefox 20.0, Safari 5.1.7, IE 10, Opera 16.0. Limited support for IE8/9.

Check out the demo here.

Features

  • Add as many Slidr's as you want - even place them within each other.
  • Dynamic resizing - adapts to the size of its content, unless you don't want it to.
  • Keyboard navigation - move your cursor on top of a Slidr, and hit the arrow keys!
  • Touch navigation (mobile) - change slides by swiping left, right, up or down!

Instructions

Include either slidr.js or slidr.min.js somewhere at the bottom of your html page, after the body content.

<script type="text/javascript" src="/path/to/slidr.min.js"></script>

HTML

slidr.js works on any inline, inline-block or block elements with an id defined. Valid slides include any first-level children elements with the data-slidr attribute set to some unique value within the parent scope. For example:

<ul id="slidr-ul" style="display: inline">
  <li data-slidr="one">apple</li>
  <li data-slidr="two">banana</li>
  <li data-slidr="three">coconut</li>
</ul>

<div id="slidr-img" style="display: inline-block">
  <img data-slidr="one" src="/static/images/apple.png"/>
  <img data-slidr="two" src="/static/images/banana.png"/>
  <img data-slidr="three" src="/static/images/coconut.png"/>
</div>

<div id="slidr-div" style="display: block">
  <div data-slidr="one">apple</div>
  <div data-slidr="two">banana</div>
  <div data-slidr="three">coconut</div>
</div>

are all valid html markup for creating three different Slidr's within the same page. (inline elements are transformed into inline-blocks in order to apply transitions).

Javascript

A global slidr object is available for calling. The most minimal way of creating a slidr is this:

slidr.create('slidr-id').start();

create() accepts an optional settings parameter as its second argument. A call with all the settings toggled looks like so:

slidr.create('slidr-id', {
  after: function(e) { console.log('in: ' + e.in.slidr); },
  before: function(e) { console.log('out: ' + e.out.slidr); },
  breadcrumbs: true,
  controls: 'corner',
  direction: 'vertical',
  fade: false,
  keyboard: true,
  overflow: true,
  theme: '#222',
  timing: { 'cube': '0.5s ease-in' },
  touch: true,
  transition: 'cube'
}).start();

Settings

Full details on available settings listed below:

Parameter Type Default Description
after function no-op Callback function after a slide transition finishes.
before function no-op Callback function before a slide transition begins.
breadcrumbs bool false Show or hide breadcrumbs on start(). true or false.
controls string border Show or hide control arrows on start(). border, corner or none.
direction string horizontal The default direction for new slides. horizontal or h, vertical or v.
fade bool true Whether slide transitions should fade in/out. true or false.
keyboard bool false Whether to enable keyboard navigation upon mouseover. true or false.
overflow bool false Whether to overflow transitions at slidr borders. true or false.
pause bool false Whether to pause on mouseover when running in auto(). true or false.
theme string #fff Sets color theme for breadcrumbs/controls. #hexcode or rgba(value).
timing object {} Custom animation timings to apply. {'transition': 'timing'}.
touch bool false Whether to enable touch navigation for mobile devices. true or false.
transition string linear The default transition to apply. cube, linear, fade, or none.

The before and after callback functions return the following metadata:

{
  id: "slidr-id",
  in: {
    el: #<HTMLElement>,
    slidr: "data-slidr-in",
    trans: "transition-in",
    dir: "direction-in"
  },
  out: {
    el: #<HTMLElement>,
    slidr: "data-slidr-out",
    trans: "transition-out",
    dir: "direction-out"
  }
}

Global API

The global slidr namespace provides the following function calls:

/**
 * Current version.
 * @return {string} major.minor.patch.
 */
 function version() {};

/**
 * Available transitions.
 * @return {Array} of transitions.
 */
 function transitions() {};

/**
 * Creates and returns a Slidr.
 * Calling create on the same element twice returns the already instantiated Slidr.
 * @param {string} id The element id to turn into a Slidr.
 * @param {Object=} opt_settings Settings to apply.
 */
 function create(id, opt_settings) {};

Slidr API

For javascript control, you can save a reference to the Slidr object as follows:

// Initialize a Slidr. 
// Display breadcrumbs, overflow transitions, use cube transition.
var s = slidr.create('slidr-api-demo', {
  breadcrumbs: true,
  overflow: true
});

// Add horizontal slides with default linear transition.
// The extra "one" allows the slidr to circle back and loop infinitely.
s.add('h', ['one', 'two', 'three', 'one']);

// Add vertical slides using a cube transition.
s.add('v', ['five', 'four', 'three', 'five'], 'cube');

// Now start.
s.start();

Slidr functions are fully chainable (where it makes sense to do so). The following is equivalent:

var s = slidr.create('slidr-api-demo', {
  breadcrumbs: true,
  overflow: true
}).add('h', ['one', 'two', 'three', 'one'])
  .add('v', ['five', 'four', 'three', 'five'], 'cube')
  .start();

The full list of available functions in a Slidr object is listed below:

/**
 * Start the Slidr!
 * Automatically finds slides to create if nothing was added prior to calling start().
 * @param {string} opt_start `data-slidr` id to start on.
 * @return {this}
 */
 function start(opt_start) {};

/**
 * Check whether we can slide.
 * @param {string} next a direction ('up', 'down', 'left', 'right') or a `data-slidr` id.
 * @return {boolean}
 */
 function canSlide(next) {};

/**
 * Slide!
 * @param {string} next a direction ('up', 'down', 'left', 'right') or a `data-slidr` id.
 * @return {this}
 */
 function slide(next) {};

/**
 * Adds a set of slides.
 * @param {string} direction `horizontal || h` or `vertical || v`.
 * @param {Array} ids A list of `data-slidr` id's to add to Slidr. Slides must be direct children of the Slidr.
 * @param {string=} opt_transition The transition to apply between the slides, or uses the default.
 * @param {boolean=} opt_overwrite Whether to overwrite existing slide mappings/transitions if conflicts occur.
 * @return {this}
 */
 function add(direction, ids, opt_transition, opt_overwrite) {};

/**
 * Automatically advance to the next slide after a certain timeout. Calls start() if not already called.
 * @param {int=} opt_msec The number of millis between each slide transition. Defaults to 5000 (5 seconds).
 * @param {string=} opt_direction 'up', 'down', 'left', or 'right'. Defaults to 'right'.
 * @param {string=} opt_start The `data-slidr` id to start at (only works if auto is called to start the Slidr).
 * @return {this}
 */
 function auto(opt_msec, opt_direction, opt_start) {};

/**
 * Stop auto transition if it's turned on.
 * @return {this}
 */
 function stop() {};

/**
 * Set custom animation timings.
 * @param {string|Object} transition Either a transition name (i.e. 'cube'), or a {'transition': 'timing'} object.
 * @param {string=} opt_timing The new animation timing (i.e "0.5s ease-in"). Not required if transition is an object.
 * @return {this}
 */
 function timing(transition, opt_timing) {};

/**
 * Toggle breadcrumbs.
 * @return {this}
 */
 function breadcrumbs() {};

/**
 * Toggle controls.
 * @param {string=} opt_scheme Toggle on/off if not present, else change layout. 'border', `corner` or `none`.
 * @return {this}
 */
 function controls(opt_scheme) {};

CSS

Temporary scrollbar during transitions

On some browsers, Slidr's that transition beyond the viewport might force an unwanted temporary scrollbar to appear (although this won't affect the page, the flickering can still be annoying). To fix this, add the following CSS:

body {
  overflow: hidden;
}

Dynamic resize

Slidr follows a fairly straightforward heuristic for figuring out what it's width or height should be. If the width and height is explicitly set, Slidr will not resize. Otherwise, it will always adapt to the size of its content. You can also set just one and it'll dynamic resize the other.

If min-width and min-height is defined, Slidr will only resize if the content exceeds those bounds.

Dynamically resizing (no width/height set):

<div id="slidr-inline-dynamic" style="display: inline">
  <div data-slidr="one">good</div>
  <div data-slidr="two">gorgeous</div>
  <div data-slidr="three">unbelievable</div>
</div>

Static sizing (width and height set):

<div id="slidr-inline-static" style="display: inline; width: 155px; height: 30px">
  <div data-slidr="one">good</div>
  <div data-slidr="two">gorgeous</div>
  <div data-slidr="three">unbelievable</div>
</div>

Slidr controllers

Slidr controllers are marked up like so:

<aside id="{slidr-id}-control">
  <div class="slidr-control up"></div>
  <div class="slidr-control down"></div>
  <div class="slidr-control left"></div>
  <div class="slidr-control right"></div>
</aside>

You can customize the look of Slidr controls through CSS selectors like below:

// Customizing a specific controller arrow.
aside[id="{slidr-id}-control"] .slidr-control.right {
  width: 50px !important;
  height: 50px !important;
  top: 50% !important;
  margin-top: -25px !important;
  right: -25px !important;
  border-radius: 25px;
  background: url('/static/images/arrow_right.png') 14px 13px no-repeat black;
  opacity: 0.4;
}

aside[id="{slidr-id}-control"] .slidr-control.right:hover {
  opacity: 1;
}

Note: controller arrows make use of the :after pseudo element. To hide the default triangular arrow, use the following CSS:

// Hide a single arrow within a single controller.
aside[id="{slidr-id}-control"] .slidr-control.right:after {
  border-color: transparent !important;
}

// Hide all arrows within a single controller.
aside[id="{slidr-id}-control"] .slidr-control:after {
  border-color: transparent !important;
}

// Hide all Slidr arrows.
aside[id*="-control"] .slidr-control:after {
  border-color: transparent !important;   
}

Slidr breadcrumbs

Slidr breadcrumbs have a similar HTML markup. Each ul denotes an entire row, while each li denotes an individual breadcrumb:

<aside id="{slidr-id}-breadcrumbs">
  <ul class="slidr-breadcrumbs">
    <li></li>
    <li class="normal"></li>
    <li class="normal active"></li>
  </ul>
  ...
</aside>

Thus you can configure them like so:

// Customize the position, size, border color and background color.
aside[id="{slidr-id}-breadcrumbs"] {
  right: 50% !important;
  margin-right: -41px !important;
}

aside[id="{slidr-id}-breadcrumbs"] .slidr-breadcrumbs li {
  width: 15px !important;
  height: 15px !important;
  margin: 3px !important;
}

aside[id="{slidr-id}-breadcrumbs"] .slidr-breadcrumbs li.normal {
  border-color: white !important;
}

aside[id="{slidr-id}-breadcrumbs"] .slidr-breadcrumbs li.active {
  background-color: black !important;
}

In the worst case, feel free to create your own controllers and access via the Slidr API instead!

For further questions or issues, visit here.

License

This software is free to use under the MIT license.

slidr's People

Contributors

bchanx avatar dandaka avatar funkyrusher avatar jason-cooke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slidr's Issues

Auto Transition

I really like the slider! I'm just having trouble getting the auto slide feature to work

slidr.create('slidr-img', {
after: function(e) { console.log('in: ' + e.in.slidr); },
before: function(e) { console.log('out: ' + e.out.slidr); },
breadcrumbs: true,
controls: 'none',
direction: 'horizontal',
fade: true,
keyboard: false,
overflow: false,
theme: '#222',
timing: { 'fade': '.3s ease-in' },
touch: false,
transition: 'fade'
}).start();
});

slidr.auto(2, left, data-slidr);
slide(right);

Move to the next slide method

Hi,

Great library to have, i was wondering if I have to implement scroll/swipe then I'd need a method something like the existing method 'slide' which will also take 'next' as an argument along with 'left, right, up, down'.

Thanks

IE8 expected identifier error

Hi there,

IE8 seems to through the above error when trying to reference e.in in the 'after', seems it doesn't like 'in'. Any thoughts?

Example

Hi! Lovely plugin! I'm just wondering if it's possible to show an example or a comprehensive tutorial on how to implement those 3 slides in the same page in your documentation page (apple-banana-coconut). I can't seem to make it work. Thank you :)

turn off slider in portrait mode?

I am trying to turn off the slider and remove all its css when orientation is 0 (portrait) or when:
window.addEventListener("resize", function() {
if ( (document.documentElement.offsetWidth < document.documentElement.offsetHeight) || (window.matchMedia("screen and (orientation: portrait)").matches) ) {

// turn off slider and reset original css

} else {
  slidr.create('panels-container', {
    controls: 'none',
    fade: true,
    overflow: true,
    keyboard: true,
    touch: true
  }).start();

}

Is there a way to do this? I have tried to .removeAttr('style data-style') but I need to return to original css before slider was attached.

here is my hack solution which uses a reload (not-good):

window.onload = function() {
var smLoad = window.sessionStorage.getItem('smLoad'),
bgLoad = window.sessionStorage.getItem('bgLoad'),

  smallLoad = function() {
    if (smLoad && smLoad === 'false' || !smLoad) {
      console.log('small');
      location.reload();
    }
  },

  bigLoad = function() {
    if (bgLoad && bgLoad === 'false' || !bgLoad) {
      console.log('big')
      location.reload();
    }
  };

if ( (document.documentElement.offsetWidth < document.documentElement.offsetHeight) || (window.matchMedia("screen and (orientation: portrait)").matches) ) {
console.log('portrait');
slidr.create('panels-container').stop();
window.sessionStorage.setItem('smLoad', 'true');
window.sessionStorage.setItem('bgLoad', 'false');
} else if ( (document.documentElement.offsetWidth > document.documentElement.offsetHeight) || (window.matchMedia("screen and (orientation: landscape)").matches) ) {
console.log('landscape');
slidr.create('panels-container', {
controls: 'none',
fade: true,
overflow: true,
keyboard: true,
touch: true
}).start();
window.sessionStorage.setItem('bgLoad', 'true');
window.sessionStorage.setItem('smLoad', 'false');
}

window.addEventListener("resize", function() {
if ( (document.documentElement.offsetWidth < document.documentElement.offsetHeight) || (window.matchMedia("screen and (orientation: portrait)").matches) ) {
smallLoad();
} else if ( (document.documentElement.offsetWidth > document.documentElement.offsetHeight) || (window.matchMedia("screen and (orientation: landscape)").matches) ) {
bigLoad();
}
}, false);

window.addEventListener("orientationchange", function() {
var orientation = (window.orientation != undefined);
console.log('orientationChange ' + orientation);
if (orientation === 0) {
smallLoad();
}
if (orientation === -90 || orientation === 90) {
bigLoad();
}
}, false);

}

endless loop

Hello,
is it possible to make an endless loop?
after the last picture it should start from the beginning.
i didn't find anything for this topic

THANKS for help and thank for the amazing plugin

greets steri

IE11 and Breadcrumbs

Hi,

I am currently testng your (wonderful) slider for one of my site, but I have a compatibility problem with (guess who) Internet Explorer 11.

The Slider is working perfectly fine, but for a reason i can't define, the Slidr breadcrumbs (the "dots") are not clickable on my version of IE11. The dots will change perfectly as the slides moves but it's impossible to click on it.

I did some research into my code to find this glitch, but after a few hours on it, I coudn't fine anything wrong or misplaced. So I decided to try your online version of the slider on, the one you can find here : http://www.bchanx.com/slidr#docs. But same problem...

I tried to look into it but I still have no idea where the problem is, but I guess you might have a better chance than me !

Thanks in advance for the help and great job, you're slidr rocks !

For info : I'am using IE 11.0.4 with Win 7 64 bits.

pause on hover is not working

Hi,
I've tried to set the pause on hover feature.

All I have done is to set "pause: true" like this:
var latestNewsSlidr = slidr.create('slidr-ul', {
99 breadcrumbs: false,
100 controls: 'none',
101 direction: 'horizontal',
102 fade: true,
103 overflow: true,
104 timing: { 'cube': '0.5s ease-in' },
105 transition: 'linear',
106 pause: true,
107 touch: true
108 }).add('h', ['one', 'two', 'three', 'one']).auto();

It doesn't seem to work. I've also put a console log in the source code, and every time i hover the slidr it log "paused", but it continues to slide.

// Automatically transition between slides.
1170 auto: function(, msec, direction) {
1171 if (
.started && slides.isdir(direction)) {
1172 actions.stop(_);
1173 .auto.msec = msec;
1174 .auto.direction = direction;
1175 .auto.id = setInterval(function() {
1176 if (!(
.settings['pause'] && nav.mouse.isOver(
.id))) slides.slide(
, direction);
1177 console.log("paused");
1178 }, msec);
1179 }
1180 },

I have done also another try:

latestNewsSlidr {

background: red;
}

When I hover it began red, but it continues to slide.

Any idea why?

Controls position

Hey!
I was wondering if there's any possibility of placing the controls at the upper corner of the slider.
Thank you

Continues sliding?

Nice script, but is there a way to let the slidr keep on sliding? Now it stops after all slides went by. I have the a auto(3000) already.

Dynamic resizing question

Dear Brian

a question in regards resizing. I am playing with a slider here: http://hipsta.samuellarcher.net/

I set the height of the slider container to a set height of 200px. As far as I understand the slider should resize the images based on the set size but it doesnt seem to do so.
The images are set to max-width: 100% so they are by nature scalable however even if I do not set a static size the slider does not scale. It seems that width and height values are applied via the JS and they do not change when resizing the browser window.

Am I doing something wrong here or is there an issue?

Thanks
Sam

no keyboard naviagation

Keyboard navigation - move your cursor on top of a Slidr, and hit the arrow keys!

Does not seem to work on Win7, FF24, Chrome Beta, IE10.

Other than that, seems like an awesome library!

Delay

Hi there,

Is there a way to have a delay in-between the slides changing? i.e. first slide shows > user clicks breadcrumb > delay > change slide function runs.

Reason being that we have some animation that runs on individual components within each slide and we want to run some more animation on those components before we run the animation for next slide.

I have tried using timing: { 'none': '5s ease-in' } to control this, however by passing 'none' it means the 5s delay doesn't happen.

I hope that makes sense.

[Slidr] Error adding [horizontal] slides for [testimonials-slider].

Hi! I can't make my slider infinitely. Console shows me warning message "[Slidr] Error adding [horizontal] slides for [testimonials-slider]". What does it mean?

slidr.create('testimonials', {
    breadcrumbs: true,
    overflow: true
}).add('horizontal', ['one', 'two', 'three', 'one']).start();

   <div class="testimonials">
      <div class="testimonials__content" id="testimonials-slider">
         <div class="testimonial" data-slidr="one">

         </div>
         <div class="testimonial" data-slidr="two">

         </div>
         <div class="testimonial" data-slidr="tree">

         </div>
      </div>
   </div>

Error className of null

Hey !
I turn around in my seat for an hour... I have a weird problem i can't understand.

My main goal is to use the slider with masonry to add a custom gallery view popin.
On my localhost, I instanciate the plug-in and it works.
I'm putting my code on production and my my chrome crash on this error :

Uncaught TypeError: Cannot read property 'className' of null (slidr.js:69)
classname slidr.js:69
controls.update slidr.js:680
actions.start slidr.js:1140
api.start slidr.js:1268
(anonymous function)

I was thinking about a code conflict with my others js scripts but same scripts work well on localhost. I'm using Chrome and I do not know what to do...

I have no idea about this problem i'm trying to resolve...
Thanks !

Cannot read property 'x' of undefined

Hey there,

I just ran into an issue with dynamically added slides. I load some content via ajax and then add a new slide set like this:

slidrInstance.add('v', [pageNumber]);

In the next line I try to go to the new slide but just get this Error Message (Cannot read property 'x' of undefined)

slidrInstance.slide(pageNumber);

As far as I can tell from the markup, the slide seems to be added propperly. Even canSlide returns true. Any idea what's wrong here?

Change Slide with a Navbar

I would like to change the content of the whole page with a navbar on the top.

Is there a slidr.goTo( "someSlide" ) function that I can call when an element in the navbar is clicked?

Error when slidr isn't around

[Slidr] Could not find element with id [slidr-xx]. xx.min_3.js:47
Uncaught TypeError: Cannot call method 'add' of undefined 

Is there a way to fix this without jQuery?

Fallback for older browsers

Hi Brian

I know you developed this for cutting edge browsers however I was wondering if you could recommend a fallback situation for IE8 for example. Not saying some crazy effects but just a simple manual slide ability.

Is there something you would recommend?

Thanks

Autoplay

Is it possible to set an option to autoplay the slides?

Support for IE 8/9?

Any plans to support IE 8/9? The script gives an Object Not found at Line 11. Is there a quick fix for it?

Auto slide

Hi Brian

not a bug - just a question if you could provide a code snippet which shows a demo for slider on auto so that it slides to the next slides with some delay between slides.

I know there is the 'auto' function but can't make it work.

Thanks Brian

Start by onload

Hi,
thanks for the great script! Is it possible to use it for a automatic slide effect when the page is loaded? I'd like to let the content roll in (just one time, so no autorepeated slideshow) when someone enters the page but I'm not sure how to call the slidr function with onload()...
Would be great if you could give me a hint how to do this (if it can be done with the slidr script).
Thanks,
Peter

auto function

Hi, well I'm not so experienced on js so I didn't get how to implement the auto function. Actually I did it but only goes forward and I wanted it to go backward when it reaches the last "data-slidr". Could you give me some tip pls?

Here follows the script:

$(document).ready(function() { slidr.create('slidr-div', { breadcrumbs: true, controls: 'none', direction: 'h', fade: true, overflow: true, theme: '#fff', timing: { 'fade': '1s ease-in' }, transition: 'linear' }).auto(3000, 'right'); });

Thanks in advance.

pauseOnMouseHover Effect

Hi.
I was wondering if a pauseOnHover (true/false) config parameter setting could be implemented and added to the mix.

Let me know if you ever get around to it.

External CSS

Hey, Brian. Great project!

I just want to ask why not use external css styles with classes? I think it could be more flexible for styling.

jquery.bxSlider - good example. I use it often in my projects and edit it css directly.

ui-router and slidr

I have implemented a very simple slidr in my website. However when I load the page where the slidr is with ui-router (similar to ajax), the slidr brake up. Any idea?

IE not transitioning

Was able to get the transitions to work in Chrome, FF, and Sarafi; nevertheless the transitions are not being applied in IE.

After doing some research, it appears the animation styles are not being applied in IE.

Any thoughts?

Thanks in advance

Window resizing support

How to support the slidr when you resize the window?
$( window ).resize(function() {}); Like this in jQuery

Cannot call method of 'start' undefined.

I have this markup on the page, and both the slidr library and object call comes in just at the end of the body. The implementation works flawlessly on Chrome on OS X even though the console spits this message:

Uncaught TypeError: Cannot call method 'start' of undefined 

However, Chrome on Windows doesn't render slidr at all, instead leaving a 0 height object.

The Body

<div id="featured" class="center">
    <div data-slidr="one">
        <h2><a href="http://pearshapedexeter.com/post/77702772634/skaters-manhattan-review">Skaters - 'Manhattan' Review</a></h2>
        <img src="http://i.imgur.com/Q6ad10V.jpg" alt="Manhattan - Skaters">
        <p><b>Pip Williams</b> reviews the new release from up and coming group Skaters.</p>
    </div>
    <div data-slidr="two">
        <h2><a href="http://pearshapedexeter.com/post/77701630818/post-four-monday-24th-february-2014-hello-fond">The Listening Post - #4</a></h2>
        <img src="http://i.imgur.com/RG6yUlv.jpg" alt="The Listening Post">
        <p><b>James Hitchings-Hales</b> flags the best in new music for your perusal.</p>
    </div>
    <div data-slidr="three">
        <h2><a href="http://pearshapedexeter.com/post/77700202322/thumpers-headline-kink-nights-at-the-cavern">Thumpers Headline KINK</a></h2>
        <img src="http://i.imgur.com/gmIGaaR.jpg" alt="Thumpers at Cavern">
        <p><b>Jack Reid</b> gives his take on the appearance of the formidable Thumpers at Cavern.</p>
    </div>
</div>

The Call

// Slider
        slidr.create('featured', {
          breadcrumbs: true,
          controls: 'border',
          keyboard: true,
          theme: '#498c34',
          touch: true,
          transition: 'cube'
        }).start();

Replace not add?

Is there an easy way to replace the added slides with a new set?
Essentially in function add() where:

@param {boolean=} opt_overwrite Whether to overwrite existing slide mappings/transitions if conflicts occur.

Rather than "Overwrites where conflicts occur" - I'd like something that "Overwrites all mappings".

E.G.
HTML

<div id="js-slidr">
    <div data-slidr="one" style="background-color: green)"></div>
    <div data-slidr="two" style="background-color: yellow"></div>
    <div data-slidr="three" style="background-color: grey"></div>
    <div data-slidr="four" style="background-color: red"></div>
    <div data-slidr="five" style="background-color: pink"></div>
    <div data-slidr="six" style="background-color: blue"></div>
</div>
<a href="#" id="js-replace">Replace</a>

JS

var s = slidr.create('js-slidr')
.add('h', ['one', 'two', 'three', 'one'])
.start();

$('#js-replace').click(function(){     
    // replace 123 with 456
    s.add('h', ['four', 'five', 'six', 'four']);
});

Next Prev in auto mode

Hi! When the slider is running in auto mode and I move to the next slide or previous timer is not reset and the next transition is faster than it need. What can i do for fix it? And another question: pause does not working on hover. Any idea why?

Setting Up

Hey there! Can you please give more detailed instructions on how to set it up? I have included the html markup, also I have called the function on document ready and added the link to the script at the end of the body. What more do next in order for it to work? Thanks!

href for images

I am trying to wrap img sliders with href, but it is not working.
Here is the html

 <div id="slidr" style="display: inline">
            <span data-slidr="one"><a href="/documents/membership/newmemberhandbook.pdf"  target="_blank"><img  src="/images/sp_sliders/NewMember1.jpg"></a></span>
            <a data-slidr="two" href="/cig/home/#national-convention"><img  src="/images/sp_sliders/2015con.jpg"></a>
            <img data-slidr="three" src="/images/sp_sliders/leadership.jpg">
            <img data-slidr="four" src="/images/sp_sliders/PIZZABOX.jpg">
        </div>

Here is the javascript

<script>
    var s = slidr.create('slidr', {
        'controls': 'border',
        fade: false,
        keyboard: true,
        overflow: true,
        pause: false,
        theme: '#222',
        timing: { 'cube': '0.5s ease-in' },
        touch: true,
        transition: 'cube'
    });
    s.add('h', ['one', 'two', 'three', 'four', 'one']);
    s.auto();
</script>

Any suggestions. I love how simple this slider is to use

jQuery version

Hello,

Thanks for this plugin which looks very great, I'm testing it for a project.

However, could we hope a jQuery version ?
It would lighten the script (extend method, etc...), and many projects already use jQuery, so I think it would be nice to have the 2 versions.
A jQuery version would let also to bind events, trigger custom events on transitions, etc...

I can help to this if necessary.

Thanks

Swipe functionality

Hey, this looks great! Just wondering if you're planning on adding swipe functionality for mobile devices? Keep up the good work ๐Ÿ˜„

Responsive

Hi, it breaks very hard on responsive websites..

Responsive ?

Is it even possible to make it responsive compatible? It always scales to 1920 version.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.