Giter VIP home page Giter VIP logo

caroucssel's Introduction

Hey! ๐Ÿ‘จโ€๐Ÿ’ป

caroucssel's People

Contributors

dependabot[bot] avatar ravi-kolla avatar schorfes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

ravi-kolla

caroucssel's Issues

Calculation of selected pages doesn't work properly

This library fails to recognize the elements inside of .scroller right when .scroller is a css grid.
The padding on the right side doesnt work aswell. I think it might be related to the grid-gap.

Here is an example: https://www.moccu.com/about/ (pagination is broken on tablet and padding on the right side is broken on some screensizes aswell)

Missing documentation for `scrollbarsMaskClassName`

The documentation for the option scrollbarsMaskClassName is missing. This should also add a "trouble shooting" section to the docs that explains the appearance of scrollbars depending on OS and OS setting (Example Mac OS X) and why the element that uses scrollbarsMaskClassName is needed.

Ignore elements inside .scroller

I came across a situation where I needed an overlay within the .scroller container. This irritated the pagination, as it was counted as "content".

It would be useful to have the possiblity to define a selector that ignores items inside the .scroller container.

Pagination with only one page inside

Currently the list of pages inside the pagination contains exactly the amount of entries. If there is only one page available, the list contains one entry. This might look strange on websites that uses for example dots for the pagination.

We should add an option to not render pagination if only one page is available.

ScrollHook Type should use Index Type

The first parameter for the scroll hook contains an index property. This one is currently typed as number[] but should use the more specific type Index.

Handle if template functions doesn't return element(s).

If a template function for buttons or paginations doesn't return an element this should be handled correctly and should not throw an error during rendering:

Example:
Initialize the carousel and test for the items length in the template function of the pagination:

const instance = new Carousel(target, {
  paginationTemplate: ({ items }) => {
    if (items.length <= 0) {
      return '';
    }

    return `<div class="pagination">...</div>`;
  },
});

Results in the following error when items.length = 0.

caroucssel.esm.js:375 Uncaught (in promise) TypeError: Cannot read property 'querySelectorAll' of null
    at Carousel._addPagination (caroucssel.esm.js:375)
    at new Carousel (caroucssel.esm.js:175)
    at Carousel.render (Carousel.js:56)

Plugin mechanism

Add a "plugin" mechanism for a better tree shake ability. Create a core bundle and allow to add features. The basic features that can be added should be "buttons" and "pagination". This should reduce the core size drastically and the user can decide which feature to use using tree shaking. Examples:

import {Carousel, Buttons, Pagination} from 'caroucssel';

const carousel = new Carousel(el, {
  features: [
    new Buttons({ /* button options here */ }),
    new Pagination({ /* pagination options here */ }),
  ]
});

or based on requested features for example:

import {Carousel} from 'caroucssel';

const execute = async (withButtons, withPagination) => {
  const [Buttons, Pagination] = await Promise.all([
    withButtons && import('caroucssel/buttons'),
    withPagination && import('caroucssel/pagination'),
  ]);

  const carousel = new Carousel(el, {
    features: [
      Buttons && new Buttons({ /* button options here */ }),
      Pagination && new Pagination({ /* pagination options here */ }),
    ]
  });
};

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.