Title: Non-Window scroll alternative code suggestion
Last modified: September 1, 2016

---

# Non-Window scroll alternative code suggestion

 *  Resolved [jstand](https://wordpress.org/support/users/jstand/)
 * (@jstand)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/non-window-scroll-alternative-code-suggestion/)
 * Hello,
 * I’m using a custom theme that doesn’t scroll the window but instead a custom 
   div inside of the window. The fix is simple. In the plugin, in assets/js/yith.
   infinitescroll.js lines 115-116, change the following two lines:
 *     ```
       $( window ).on( 'yith_infs_start', function(){
                   var w       = $(this),
       ```
   
 * for the following:
 *     ```
       $( window ).on( 'yith_infs_start', function(event){
                   var w       = $(event.target),
       ```
   
 * As long as it is the window scrolling, this code will make no difference. If 
   there is a div inside instead, the plugin will continue to work.
 * Let me know if that makes sense, and whether you will integrate the suggested
   fix.
 * Obviously, you’ll have to minify it again in the same folder.
 * Thanks,
 * [https://wordpress.org/plugins/yith-infinite-scrolling/](https://wordpress.org/plugins/yith-infinite-scrolling/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [YITHEMES](https://wordpress.org/support/users/yithemes/)
 * (@yithemes)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/non-window-scroll-alternative-code-suggestion/#post-7563215)
 * Hi,
    thanks for this suggestion. I’ll pass this to the plugin developers that
   integrate it on next update.
 * Regards.
 *  Thread Starter [jstand](https://wordpress.org/support/users/jstand/)
 * (@jstand)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/non-window-scroll-alternative-code-suggestion/#post-7563222)
 * Thank you, that is great news!
 * For those who find this thread later (once the plugin is updated), I forgot to
   mention that I have to add this code to my theme:
 *     ```
       $('#scrolling-div').on('scroll touchstart', function() {
           $('#scrolling-div').trigger('yith_infs_start');
         });
       ```
   
 * Where “scrolling-div” is the ID of the div that scrolls.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Non-Window scroll alternative code suggestion’ is closed to new replies.

 * ![](https://ps.w.org/yith-infinite-scrolling/assets/icon.svg?rev=3303151)
 * [YITH Infinite Scrolling](https://wordpress.org/plugins/yith-infinite-scrolling/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/yith-infinite-scrolling/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/yith-infinite-scrolling/)
 * [Active Topics](https://wordpress.org/support/plugin/yith-infinite-scrolling/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/yith-infinite-scrolling/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/yith-infinite-scrolling/reviews/)

## Tags

 * [element](https://wordpress.org/support/topic-tag/element/)
 * [scroll](https://wordpress.org/support/topic-tag/scroll/)
 * [window](https://wordpress.org/support/topic-tag/window/)

 * 2 replies
 * 2 participants
 * Last reply from: [jstand](https://wordpress.org/support/users/jstand/)
 * Last activity: [9 years, 10 months ago](https://wordpress.org/support/topic/non-window-scroll-alternative-code-suggestion/#post-7563222)
 * Status: resolved