Don't put

$(window).load()

inside

$(document).ready()



On Feb 3, 4:12 pm, eagleon <antonypei...@gmail.com> wrote:
> Hi Guys,
>
> I was trying to fire an $.css() during the onload event. For some
> reason, it does not work. It works fine if I attach it to another
> event such as a resize event, but not onload.
>
> This is what I have done:
>
> Code:
> [code]
> function myFunc() {
>
>       $("#example").css({'width' : 10px;});
>
> }
>
> $(document).ready(function() {
>
>       $(window).load(function() {
>
>             myFunc();
>
>       });
>
> });
>
> [/code]
>
> I need this element to be sized immediately after loading. This works
> if the event was anything else, but dosen't work with 'load' at all.
>
> Please help!
>
> Thanks

Reply via email to