Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A question about showing more items in a carousel? #30

Open
zhouhao27 opened this issue Oct 13, 2015 · 0 comments
Open

A question about showing more items in a carousel? #30

zhouhao27 opened this issue Oct 13, 2015 · 0 comments

Comments

@zhouhao27
Copy link

This is the best jquery carousel I've ever seen online. I'm going to extend your example 2 to show more items.

Code in index.html:

<script>
$(function() {
  $.responsiveHub({
    layouts: {
      480:  "phone",
      481:  "small-tablet",
      731:  "tablet",
      1199: "small-web",
      1200:  "web"
    },
    defaultLayout: "web"
  });
});
</script>

In css:

.view-port, .track .inner {
   /*original value: width: 946px;*/
   width: 1180px;
}

In example2_and_3.js:

   onChange: function(track, options, event) {
    track.options.mode = "horizontal";
    track.options.autoHeight = false;
    track.options.perPage = 5;

    if (event.layout === "small-web") {
      alert('small-web');
      track.options.perPage = 4;
      if (track.container.hasClass("huge")) {
        track.options.autoHeight = true;
      }          
    } else if (event.layout === "small-tablet") {
      track.options.perPage = 3;
      if (track.container.hasClass("huge")) {
        track.options.autoHeight = true;
      }
    } else if (event.layout === "phone") {
      track.options.perPage = 3;
      track.options.mode = "vertical";
      track.options.autoHeight = true;
    }

    track.restart({keepCurrentPage: true});
  }

Here is the result when browser width is greater than 1200. It looks great:

2015-10-14 12 52 41

But when I resize the browser width to less than 1200, it shows part of the items which is not what I expected:

2015-10-14 12 52 57

Can you advise what I did wrong? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant