Giter Site home page Giter Site logo

sachinchoolur / lightslider Goto Github PK

View Code? Open in Web Editor NEW
2.0K 91.0 1.5K 1.91 MB

JQuery lightSlider is a lightweight responsive Content slider with carousel thumbnails navigation

Home Page: http://sachinchoolur.github.io/lightslider/

License: MIT License

JavaScript 85.18% HTML 1.85% CSS 12.97%

lightslider's Introduction

license travis bower npm

jQuery lightSlider

Demo

JQuery lightSlider demo

Description

JQuery lightSlider is a lightweight responsive Content slider with carousel thumbnails navigation

Main Features

  • Fully responsive - will adapt to any device.
  • Separate settings per breakpoint.
  • Gallery mode to create an image slideshow with thumbnails
  • Supports swipe and mouseDrag
  • Add or remove slides dynamically.
  • Small file size, fully themed, simple to implement.
  • CSS transitions with jQuery fallback.
  • Full callback API and public methods.
  • Auto play and infinite loop to create a content carousel.
  • Keyboard, arrows and dots navigation.
  • Chrome, Safari, Firefox, Opera, IE7+, IOS, Android, windows phone.
  • Slide and Fade Effects.
  • Auto width, Vertical Slide, Adaptiveheight, Rtl support...
  • Multiple instances on one page.
  • Slide anything (youtube, vimeo , google map ...)

How to use lightSlider?

Bower

You can Install lightslider using the Bower package manager.

$ bower install lightslider

npm

You can also find lightslider on npm.

$ npm install lightslider

The code

add the Following code to the <head> of your document.

<link type="text/css" rel="stylesheet" href="css/lightslider.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="js/lightslider.js"></script>
    // Do not include both lightslider.js and lightslider.min.js

HTML Structure

<ul id="light-slider">
    <li>
        <h3>First Slide</h3>
        <p>Lorem ipsum Cupidatat quis pariatur anim.</p>
    </li>
    <li>
        <h3>Second Slide</h3>
        <p>Lorem ipsum Excepteur amet adipisicing fugiat velit nisi.</p>
    </li>
    ...
</ul>

Call lightSlider!

<script type="text/javascript">
    $(document).ready(function() {
        $("#light-slider").lightSlider();
    });
</script>

Play with settings

<script type="text/javascript">
    $(document).ready(function() {
        $("#light-slider").lightSlider({
            item: 3,
            autoWidth: false,
            slideMove: 1, // slidemove will be 1 if loop is true
            slideMargin: 10,

            addClass: '',
            mode: "slide",
            useCSS: true,
            cssEasing: 'ease', //'cubic-bezier(0.25, 0, 0.25, 1)',//
            easing: 'linear', //'for jquery animation',////

            speed: 400, //ms'
            auto: false,
            pauseOnHover: false,
            loop: false,
            slideEndAnimation: true,
            pause: 2000,

            keyPress: false,
            controls: true,
            prevHtml: '',
            nextHtml: '',

            rtl:false,
            adaptiveHeight:false,

            vertical:false,
            verticalHeight:500,
            vThumbWidth:100,

            thumbItem:10,
            pager: true,
            gallery: false,
            galleryMargin: 5,
            thumbMargin: 5,
            currentPagerPosition: 'middle',

            enableTouch:true,
            enableDrag:true,
            freeMove:true,
            swipeThreshold: 40,

            responsive : [],

            onBeforeStart: function (el) {},
            onSliderLoad: function (el) {},
            onBeforeSlide: function (el) {},
            onAfterSlide: function (el) {},
            onBeforeNextSlide: function (el) {},
            onBeforePrevSlide: function (el) {}
        });
    });
</script>

Public methods

<script type="text/javascript">
    $(document).ready(function() {
        var slider = $("#light-slider").lightSlider();
        slider.goToSlide(3);
        slider.goToPrevSlide();
        slider.goToNextSlide();
        slider.getCurrentSlideCount();
        slider.refresh();
        slider.play();
        slider.pause();
        slider.destroy();
    });
</script>

Report an Issue

If you think you might have found a bug or if you have a feature suggestion please use github issue tracker. Also please try to add a jsfiddle that demonstrates your problem

If you need any help with implementing lightslider in your project or if have you any personal support requests i requset you to please use stackoverflow instead of github issue tracker

If you like lightSlider support me by staring this repository or tweet about this project. @sachinchoolur

MIT © Sachin

lightslider's People

Contributors

bitdeli-chef avatar dsrec77 avatar elboletaire avatar geyser avatar lancedikson avatar msurguy avatar ryleysill93 avatar sachinchoolur avatar tak2siva avatar tammo0 avatar zolotokrylin 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  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

lightslider's Issues

Load images with Ajax?

I'm trying to use lightslider loading images with Ajax and JQuery.
Can I do this?
Send a ajax peticion to a php script and load the response (Array of ) in the div to add the images to the slider?
Thanks.

Varied Height

Is it possible? Or do all elements have to have the same exact height so there isn't issues?

Varied Width

Is there an option to for the images to have varied width and a set height?

jquery lightSlider vertically centered images

Hi
I am using your wonderfull jquery lightSlider
i am not an expert in coding so i need a help in vertically centering the pictures as the size of the pictures is different. I am talking about the pictures in the list imageGallery

    • Thank you very much

Lightslider not working as advertised...

Hi,

No matter what I do, I can't get the slider gallery working like it shows in the examples on the website. I get a frustrating bullet point & the images aren't responsive the same way they are on the website. First I thought that css styles may have been conflicting between the existing stylesheets of the site I was trying to integrate in to but now I have repeated everything on a jsfiddle & the same thing persists.
I'd appreciate any help because if I can get it working as advertised... it'd be perfect for my needs.

http://jsfiddle.net/f7L7hwkq/

Thanks

Initialize two sliders with different modes

Hi,

first of all: GREAT Slider!!! Thanks a lot.

I just noticed one bug:
I tried to initialize two sliders on the same page with two different sliding modes.
First slider:

jQuery('.category-slider').lightSlider({
                    minSlide:1,
                    maxSlide:3,
                    slideMove:1,
                    slideMargin:5,
                    mode: 'slide'
                });

Second slider:

jQuery(document).ready(function() {
        jQuery('.lightSlider').lightSlider({
            minSlide:1,
            maxSlide:1,
            mode:'fade'
        });
    });

Unfortunately the first slider was rendered in fade mode as well, so that only one item was visible.

Cheers, Sebastian

Thumbnails without carousel

Is it possible to display thumbnail navigation without having a carousel attached to it? That's the only thing I need before I start using this thing religiously ;)

Thanks!

Donation

I wish to donate, but I didn't see any donation link. Did I miss it?

carousel funktion

Hey,

first of all, great work with the slider, for me it's the best. But i have one question, as i'm only a beginner at javascript. In this case i use the slider for a gallery where logos from certain companys are looping, when they are finished, it scrolls back and starts from the beginning. Is it possible that insted of scroling to the first slide, the first slide slides in, like it would be the next? Like a carousel.

Here are the setting i use. I hope someone can help me out with this.

        minSlide: 1,
        maxSlide: 6,
        proportion:'',
        mode: "slide",
        useCSS: true,
        speed: 1500, //ms'
        easing: '', //'ex cubic-bezier(0.25, 0, 0.25, 1)',//
        auto: true,
        pause: 3000,
        loop: true,
        controls: false,
        prevHtml: '',
        nextHtml: '',
        keyPress: true,
        pager: false,
        gallery: false,

Best greetings from Germany.

Nico

fade mode error

Hi,
Thanks for great script.
When I am trying to use fadeIn, fadeOut event on page body and slider mode: 'fade' sometimes picture doesn`t load in full height. Am I doing something wrong ? Code for body fade :

$("body").css("display", "none");

$("body").fadeIn(1500);

$("a.transition").click(function(event){
    event.preventDefault();
    linkLocation = this.href;
    $("body").fadeOut(500, redirectPage);       
});

function redirectPage() {
    window.location = linkLocation;
}

issue

onSliderLoad should be renamed onSliderReady and an new onSliderLoad should be made

I think this has been addressed with the fix for #50 but with the way the code was written prior to that the library continues to resize elements and do things after that method is called.

The convention I believe is

ready = all elements are loaded into the page but other things aren't necessarily finished yet
load = we are trying to guarantee our function/library/whatnot has completed doing all the stuff we wanted to do.

float slides render bad until the slider is initialized

as you know your plugin uses float method to keep the slides alinged, and when the slider is initialized, you are able to give width to the parent container via javascript.

BUT... until the slider is loaded, the slides are stacked one below the other, as like normal elements, blocking space, and once the slider is init-ed, they suddenly go up and form a slider stacking one beside each other.
This wouldn't be noticed if its a single slider on page, but if thee's other content (big page) along with the slider, or consider a slow connection, the slider wouldn't be loaded the moment you enter the page. hence, the awkward rendering or movement, whatever you call, appears.

solutions:

  1. for sliders I prefer to use absolute, so your slider looks as is before and after slider is loaded because of CSS, blocking same position before and after.
  2. giving fixed height to the slider and overflowing none, is a way - but we talk responsive here, so isn't a good idea.

What do you think?

Fade effect issue on IE9

Me again :-), I have placed fewer gallery images and used the fade effect and test it on IE9, the gallery pager moves far away to the right and disappears.

Go to next / prev slider

Hi,
Thanks for amazing script, i really appreciate it.
I've been implementing a dynamic slider, all the < li > items will be created by PHP.
I put the next and prev slider button into the main < ul > based on your public method example on the website, the buttons works fine in the first slider, but those are not working after the first click. I believe there should be a fix for that. My knowledge in jQuery is so limited.

PS: when i put them back from the < ul > those are working fine.

Could you please help me out with?
Thanks,

Having issue getting slider to work when slider is in a table

When in table slider ignores maxSlide and displays all
Here is the code:

<script src="../../js/jquery-1.11.0.js"></script>
<script src="js/jquery.lightSlider.js"></script>
<script type="text/javascript">

$(document).ready(function() {
$('#lightSlider').lightSlider({
minSlide:1,
maxSlide:4,
slideMargin:10,
slideWidth:100
});
});

</script>
  • First Slide

    Lorem ipsum Cupidatat quis pariatur anim.

  • Second Slide

    Lorem ipsum Excepteur amet adipisicing fugiat velit nisi.

  • Third Slide

    Lorem ipsum Excepteur amet adipisicing fugiat velit nisi.

  • Forth Slide

    Lorem ipsum Excepteur amet adipisicing fugiat velit nisi.

  • Fifth Slide

    Lorem ipsum Excepteur amet adipisicing fugiat velit nisi.

  • Sixth Slide

    Lorem ipsum Excepteur amet adipisicing fugiat velit nisi.

el object properties not accessible inside 'onSliderLoad' callback functions

Hi Sachin,

I was trying your carousel, and i had faced a issue in 'onSliderLoad' callback.
As in Documention : onSliderLoad: function (el) {}
contains el object which hold the multiple properties, like play() , pause() ,getCurrentSlideCount().
But am not able to invoke any property.
Could you help me with this??

[Q] Supply different options

Hey,

Great slider, nice and neat.

Got one question: How would you go about supplying different slider options and re-drawing it on certain breakpoints on window resize?

[BUG] mode: 'fade' calculation of image hight is wrong on smaller screens

In line 222 ('padding-bottom': ($children.height() * 100) / elSize + '%') and 228 calculation is wrong on smaller screens because $children.height() does not get the correct height of the resized image.
You will see it if you initialize lightslider at $(window).load(function().
Initializing at $(document).ready works most of the time in Firefox and Chrome although the $children.height() get the wrong value but not in IE11

addClass-removeClass

How to add a class of active slide (more div what is in it), and delete this class if the slide is not active?
Should be used сallbacks functions only how to get to the active slide can not understand?

Slider mode 'fade' not working

I see in the code you've provided provision for 'fade' mode for the slider, but unfortunately it's not working for me (and maybe for everyone).
Maybe some bug in the last update. Kindly check and update

autoplay with pagination

Hi, can slider continue play automatically with navigation, after click on pagination and navigation? I couldn't find this option. Thanks!

responsive images...

Trying this out tonight as it seems like a perfect fit for what I need. Having an issue with responsive images though. The active image shows perfectly fine and is responsive as expected, however, this is only true when using the 'slide' mode... fade causes issues. I've fiddled with it a bit, but can't seem to come up with a fix although I see the relative and absolute positioning is the problem.

This also causes issues with the gallery positioning and currentPagerPosition because I do not have a value to set for slideWidth.

Perhaps a response update? I would also like to request a wrapper for the active slide as well. For instance, I want to have a border and padding around my active image in this example. I can sort of do this by applying styles to csSlideWrapper, however, it is not a perfect result as the image is not contained within the wrapper per se. On sliding it will run over the border and padding styles.

This example uses normal bootstrap 3 css...

<div class="row">
    <div class="col-md-12">
        <ul id="lightSlider" class="gallery list-unstyled cS-hidden clearfix">
            <li data-thumb="/user-data/2/screenshots/demo21.jpg">
                <img class="img-responsive" src="/user-data/2/screenshots/demo21.jpg" />
            </li>
            <li data-thumb="/user-data/2/screenshots/demo22.jpg">
                <img class="img-responsive" src="/user-data/2/screenshots/demo22.jpg" />
            </li>
            <li data-thumb="/user-data/2/screenshots/demo23.jpg">
                <img class="img-responsive" src="/user-data/2/screenshots/demo23.jpg" />
            </li>
            <li data-thumb="/user-data/2/screenshots/demo24.jpg">
                <img class="img-responsive" src="/user-data/2/screenshots/demo24.jpg" />
            </li>
            <li data-thumb="/user-data/2/screenshots/demo25.jpg">
                <img class="img-responsive" src="/user-data/2/screenshots/demo25.jpg" />
            </li>
            <li data-thumb="/user-data/2/screenshots/demo26.jpg">
                <img class="img-responsive" src="/user-data/2/screenshots/demo26.jpg" />
            </li>
        </ul>               
    </div>
</div>

transform fails in Safari, breaks slider

In the move function, this line failed for me in Safari:

ob.css('transform', 'translate3d(-' + v + 'px, 0px, 0px)');

I had to do a test for webkit browsers and use this instead when found:

ob.css('-webkit-transform', 'translate3d(-' + v + 'px, 0px, 0px)');

Loader

I am trying to add some sort of loader gif for the slider so all the images can load before open. Is ther functionality for this?

Slider skips two slides on Touch devices

Have you noticed that when .csPrev or .csNext are clicked on touch devices (iPhone and iPad tested), the slider moves two slides over?

Any idea on how to fix that? Customizing the slideMove won't do, since it can't go below 1.

Only show full thumbnails where container width is smaller than required when setting thumbnail width

Is it possible to have the thumbnails cut off at end points as opposed to showing half a thumbnail if the container bounds are smaller than the given thumbnails?

I forgot to add, that this is when setting a thumbnail width specifically within the options.

At the moment if I have a container of 400px, and 4 thumbnails set to 100px each with a margin of 10px, I essentially get 3 and a half thumbnails in view.

It would be better if it only showed 3, possibly offering the option to centralise them or float to the left.

Gap on right side of slider/LI on initial load

Hello,

First off...this is a GREAT plugin. Thanks for posting. I've been looking for a simple image/content type slider, and this seems to be what I've been in search of. I have a quick question re: some spacing I'm noticing when setting up.

I basically am trying to setup a simple 100% width slider, showing 1 image/slide at a time. I'm able to do that, but for whatever reason, there is a gap to the right of the slides when page is "first loaded". But... once page/slider is resized, the gap goes away/looks great. I tried adding CSS for the UL/LI to make sure all padding/margin is gone, but I'm not able fix.

Here's an example, with a basic slider, and color BG for each LI to show what I'm referencing:

http://jsfiddle.net/VanHammersley/c5ypLps5/19/

Any help would be appreciated!

Image Zooming

Hi

Great slider one of the best I've used! However are there any plans to add in image zoom functionality or whether it's possible to integrate with any other image zoom scripts out there? Something like jQuery Zoom.

Thanks

currentPagerPosition option is not working

I'm trying this configuration for slider on demo page

gallery:true,
item:1,
vertical:true,
verticalHeight:295,
vThumbWidth:50,
thumbItem:3,
pager:true,
thumbMargin:4,
slideMargin:0,
currentPagerPosition:'left'

but thumbs not move to left side of vertical slider.. Maybe I do something wrong or I don't understand this option right?

lightslider RTL

first of all thank you for your amazing work!
I was wondering that is it possible for you to fix lightslider for RLT version?
because it has lots of problem in RTL websites
thank you

Mistake in the JS

Dear Developer,

I've found a mistake in the JS at line 37:
onBefroreSlide: function () {},
Misspelling...
That's why this event not work, especially when I try to use
onBeforeSlide: function () {}, :))

Also the documentation here (http://sachinchoolur.github.io/lightslider/settings.html) is not up to date, the events name has been changed in the code...

Happy coding, I'm big fan of your plugin and had used it in 2 websites already.

Vertical slide turn to horizontal in fade mode

I'm using lightSlider lasted version. Vertical slide is working great but when I set mode to 'fade' the slide turn to horizontal. When it turned to horizontal one thumbnail is missing.

Fade function

Perhaps not really an issue but more of a request...

The fade function right now fades in a slide while the previous one is directly hidden, resulting in a bit of a 'shocky' effect. I guess it would be better if the next slide is fading in on top of the other slide. Afterwards the previous slide can be hidden.

Is this possible right now?

Thanks!

Trouble sizing width when slider is inside a table.

When I add the code for lightslider inside a table, the slider seems to work as intended, however its width is calculated as the width of the sum of the widths of unordered list panels so that they are all visible at the same time. They slide left to their exact position, but they are all visible.

image

I have tried using your demo code in the table with the same results. Could it be that I have a setting incorrect causing it to not hide the section to the right of the first unordered list panel?
Thanks!

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.