[jQuery] proper way

2009-12-11 Thread Jojje
My question is about syntax, or how to wite jquery code. Is the example below ok? Putting all your code between document.ready all your code with anonymous functions? $(document).ready(function() { $('a.link1').click(function() { //code }); $('a.link2').click(function() {

Re: [jQuery] proper way

2009-12-11 Thread John Arrowwood
Just put the calls to the functions that do the work inside of .ready(). Put everything else outside of it. As for anonymous functions, they are good for creating a context that avoids polluting your name space. When the function ends, everything defined within disappears into oblivion unless

[jQuery] Proper way to detect webkit-based browsers?

2009-09-04 Thread D A
Now that we're switching to feature detection rather than browser detection, how does/should one detect for a webkit browser? Is there a known feature that we can check for that would Identify Safari and Chrome? We're running into some (rather minor) layout issues with some jquery plug-in

[jQuery] Proper way of binding/unbinding event in plug-ins

2009-01-05 Thread Eridius
Is the following syntax the proper way to bind and unbind event in plugin so that you minimize the chance you will unbind and event that you did not set? $(selector).bind('event.custom_tag', function); so if you take the following: $('#binding_test').bind('click.part1', function() {