Question: I've wrote a script to change a few CSS properties of a div. I've tried 2 methods I found on google but neither of them work. I've thoroughly read the examples and I don't know why this won't work.

When there is less content in the `#rightsection` then there are images in the `#leftsection`, the `#rightsection` attaches to the bottom of the `#contentpage`. But if there is too much content in the `#rightsection`, the content overflows. So I want to change to `position:absolute` to `position:static` when there's a scroll detected upon overflow.

I'm not really that good with JQuery so I'm hoping anybody of you would know the answer. If anybody does know, I'd appreciate it.

```
(function($) {
    $.fn.hasScrollBar = function() {
        return this.get(0).scrollHeight > this.height();
    }

    //Method 1
    if($("#rightsection").hasScrollBar()){
        $('.rightsection1').css({
            "position":"static",
            "margin":"-75px 0 0 150px"
        });
    }

    //Method 2
    if($("#rightsection").hasScrollBar()){
        $('#rightsection').addClass("rightsection1");
        $('#rightsection').removeClass("rightsection2");
    }
})(jQuery);

```

[JSFiddle](http://jsfiddle.net/2e1hcweq/4/)

**Solution**

I changed `(function($)` by `$(document).ready(function()` and now it works flawlessly.

Answer: 
I have found the solution: the problem was that the sub name was the same as the module name. I didn't know it had to be different, but I hope someone will find this useful!
Thanks for all the answers guys!
I came across another issue while running a simple test attempting to run an Access VBA function in an empty database (except for the VBA code) from an Excel procedure. Without any other objects (tables/forms/etc), the Access VBA function was unable to be found. Once I put in a nominal table, the call to the Access VBA function from Excel VBA was successful. Not a usual situation to have an empty database but as I said I was just running a trial to see if the method worked.