Good evening, tell me why the function works incorrectly, in the body I created a container for custom scrolling, scrolbars are connected to js below, by the condition of pevraya, the function should attach scrolls to a certain class if the width is over 666 pixels, otherwise destroy, the second function for another container kills scrolls if the width is less than 424 pixels and otherwise it adds scrolling, I don’t quite understand why the first function is currently working when the container is not created, but it is working on the container of the second function, those scroll -So fig atachitsya if the container width is greater than 666 pixels, although not subject to such a test if the first function to remove then works as it should.

` https://jsfiddle.net/4fqh2oy5/9/ ` Линк на фидл 

Link to plugin

  • $('.dash__content__tabs__scroll') - all elements with this class are selected here - Grundy
  • ))) there is only one (element), below is the second function there are other classes, and if I initialize it, it will destroy everything, although I apply destroy to a specific class - Anton Essential
  • for example, this is $ ('. dash__content__tabs__scroll'). mCustomScrollbar ("destroy") will destroy this class and other classes from another function $ ('. menu__scroll, .dialog__scroll') Something nonsense - Anton Essential
  • Why do you think so? Can you make an example that you can run and see? So far, everything looks fine. In the plugin code in the destroy function, the call goes only to the current selector - Grundy
  • @Grundy here is an example jsfiddle.net/gLvkz97r/33 - Anton Essential

0