Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. $('.jcarousel').on('jcarousel:create jcarousel:reload', function() {
  2. var element = $(this),
  3. width = element.innerWidth();
  4. alert(width);
  5.  
  6. // This shows 1 item at a time.
  7. // Divide `width` to the number of items you want to display,
  8. // eg. `width = width / 3` to display 3 items at a time.
  9. element.jcarousel('items').css('width', width + 'px');
  10. }).jcarousel({
  11. });
  12.  
  13. $('.jcarousel-control-prev').jcarouselControl({
  14. target: '-=1'
  15. });
  16.  
  17. $('.jcarousel-control-next').jcarouselControl({
  18. target: '+=1'
  19. });
  20.  
  21. /** Carousel **/
  22.  
  23. .jcarousel {
  24. position: relative;
  25. overflow: hidden;
  26. width: 100%;
  27. }
  28.  
  29. .jcarousel ul {
  30. width: 20000em;
  31. position: relative;
  32. list-style: none;
  33. margin: 0;
  34. padding: 0;
  35. }
  36.  
  37. .jcarousel li {
  38. width: 800px;
  39. float: left;
  40. border: 1px solid #fff;
  41. -moz-box-sizing: border-box;
  42. -webkit-box-sizing: border-box;
  43. box-sizing: border-box;
  44. }
  45.  
  46. .jcarousel img {
  47. display: block;
  48. max-width: 100%;
  49. height: auto !important;
  50. }
  51.  
  52. <div class="jcarousel" data-jcarousel="true">
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement