{"action":"closed","issue":{"url":"https://api.github.com/repos/kenwheeler/slick/issues/1966","repository_url":"https://api.github.com/repos/kenwheeler/slick","labels_url":"https://api.github.com/repos/kenwheeler/slick/issues/1966/labels{/name}","comments_url":"https://api.github.com/repos/kenwheeler/slick/issues/1966/comments","events_url":"https://api.github.com/repos/kenwheeler/slick/issues/1966/events","html_url":"https://github.com/kenwheeler/slick/issues/1966","id":121971199,"number":1966,"title":"Add class if \"slidesToShow\" is more/less than slide count","user":{"login":"lsterling03","id":6092348,"avatar_url":"https://avatars.githubusercontent.com/u/6092348?v=3","gravatar_id":"","url":"https://api.github.com/users/lsterling03","html_url":"https://github.com/lsterling03","followers_url":"https://api.github.com/users/lsterling03/followers","following_url":"https://api.github.com/users/lsterling03/following{/other_user}","gists_url":"https://api.github.com/users/lsterling03/gists{/gist_id}","starred_url":"https://api.github.com/users/lsterling03/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsterling03/subscriptions","organizations_url":"https://api.github.com/users/lsterling03/orgs","repos_url":"https://api.github.com/users/lsterling03/repos","events_url":"https://api.github.com/users/lsterling03/events{/privacy}","received_events_url":"https://api.github.com/users/lsterling03/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/kenwheeler/slick/labels/Feature%20Proposal","name":"Feature Proposal","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-14T04:07:04Z","updated_at":"2016-02-07T17:45:54Z","closed_at":"2016-02-07T17:45:54Z","body":"I think it would be helpful to add a class to the .slick-slider div to indicate when the slide functionality is activated -- as dictated by the number of slides versus the slidesToShow number.\r\n\r\nFor example, if I've set the carousel to show 3 slides at a time, but I only have 2 slides, then I want to style the overall carousel differently than when it's got more than 3 slides and thus showing the prev/next buttons. Unfortunately, there is no class change on the main carousel div to indicate any difference between the two states.\r\n\r\nI tried adding a class on the \"init\" event by determining if the prev/next buttons exist, but that didn't work because the prev/next buttons are created after init, I guess. So I got it to work by editing slick.js here (see where I added the class 'foo' below). \r\n\r\nWould you consider adding something like this in a future update? Or tell me if there's a better way for me to get this class on the .slick-slider div? Thank you!\r\n\r\n    if( _.slideCount > _.options.slidesToShow ) {\r\n\t\t\t\t\r\n\t          $('.slick-slider').addClass('foo');\r\n\r\n                _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex');\r\n                _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex');\r\n\r\n                /* other code removed for brevity */\r\n                }\r\n\r\n            } else {\r\n\t\t\t\t\r\n\t\t      $('.slick-slider').removeClass('foo');\r\n\r\n                _.$prevArrow.add( _.$nextArrow )\r\n\r\n                    .addClass('slick-hidden')\r\n                    .attr({\r\n                        'aria-disabled': 'true',\r\n                        'tabindex': '-1'\r\n                    });\r\n\r\n            }"}}