Browsers are changing, jQuery errors have been fixed, so there are two reasons why it is important to always use the latest version of jQuery (after testing, you cannot just point to the latest).
Your code adapted for jQuery 1.9 will be for a different type of event
$(document).on("event_type",".wrapper1", function(){ $(".wrapper2") .scrollLeft($(".wrapper1").scrollLeft()); });
The reason for using $(document) as the receiver, rather than $(".wrapper1") is that only elements that exist during the binding will receive and delegate events. on doesn't work like old live .
Except that this will not work for scroll events as they do not bubble.
Therefore, the most sensible solution I can offer would be to define a function:
$.fn.bindScrollHandler1 = function(){ $(this).on('scroll', function(){ $(".wrapper2").scrollLeft($(".wrapper1").scrollLeft()); }); }
and name it at the beginning:
$('.wrapper1').bindScrollHandler1();
and every time you create a new .wrapper1 element:
myNewElement.bindScrollHandler1();
Demonstration
Please note that your complete logic seems a bit inadequate as you are not pairing the scrollbars, but making them work the same.
source share