﻿(function ($) {
    $.fn.SideRolling = function () {
        var thisoffset = parseInt($(this).css("top").replace("px", ""));
        var bodyTopoffset = $(this).offset().top;
        var thisObj = $(this);
        var movecomplete = true;
        var scrollFunc = function () {
            var rollloc = 0;
            if (document.documentElement.scrollTop + document.body.scrollTop >= bodyTopoffset) {
                rollloc = document.documentElement.scrollTop + document.body.scrollTop - bodyTopoffset + thisoffset;
            }
            else {
                rollloc = thisoffset;
            }
            $(thisObj).css("top", rollloc);
        };
        $(window).scroll(function () {
            scrollFunc();
        });
        $(document).scroll(function () {
            scrollFunc();
        });
    }
})(jQuery);
