Re: [jQuery] Interface 1.1
I like the new demo layout but it might be wise to put some initial content in the demo window, pointing people to the links below. Also, I got an error on the selectables demo. When I click serialise (XP and FF2) it gives me, Error: a.get(0) has no properties Source File: http://interface.eyecon.ro/interface/interface.js Line: 8 Great work as always, thank you! Miles On 1/15/07, Stefan Petre [EMAIL PROTECTED] wrote: Hi, Paul and I, with help from many jQuery developers, put together a new release of Interface. It has a number of new features, new plugins, speed improvements, nice demos, and improved documentation (there's still a lot to improve there). If you would like to learn more about the 1.1 release of Interface, check out our brand-new news section as well as the updated changelog!. http://interface.eyecon.ro ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Beginner question re: getting and setting element class name
I can pass 'this' but using (#+this.id) was the way to do it with the least code written. Inside the function I need to check the first 4 letters of the ID string of the calling element to determine how to proceed, as well as use the id as an element reference for the jQuery object. So it's either pass that or use 'this' and inside the function: checkid = $(id).attr(id).substring(0,4) and then use checkid in comparisons. But I thought creating the extra object inside the function to carry this was wasteful. Since passing the concated '#id' string works without further modification inside the function it seemed like the best way to go about it. I'm not a particularly skilled JS developer though, so perhaps the best practice is to keep shenanigans like that inside the function? If it's hackish perhaps I'll find it doesn't always work in the future. Cheers Miles On 1/14/07, Ⓙⓐⓚⓔ [EMAIL PROTECTED] wrote: a bit clunky! just pass in this! and let checkState do the dirty work... if it is actually needed! -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Flickering problem in Firefox
There's no white page thing happening for me. It's smooth on the way down, a bit jerky on the way up but I don't see the page turning white for a second. Using XP and FF 2.0 m On 1/14/07, speedabuser [EMAIL PROTECTED] wrote: It does to me in Firefox 2.0 / WinXP! Maybe flickering is the wrong expression, since it just blinks if you have a computer that's fast enough. It shows much more if you're on a slow computer. However, the whole site become white for a quick moment when click on the link Who is this?. Look again! dave.methvin wrote: My site flickers when slide-animation is activated. This only happens in Firefox (both Mac PC). Click Who is this on http://cv.gulligt.com/ to see what happens. It does not flicker for me. Windows XP, Firefox 2.0. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/Flickering-problem-in-Firefox-tf2972738.html#a8361081 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Beginner question re: getting and setting element class name
Thanks, and I already took your advice :) On 1/14/07, Ⓙⓐⓚⓔ [EMAIL PROTECTED] wrote: Just a bit clunky. To me clunky is a overly long calling sequence this or this.id is easy to pass. #+this.id is more clunky when you put the more clunky expressions inside a function you can re-used 'proven' code. Just the advice from an seasoned(salty) programmer! -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Beginner question re: getting and setting element class name
Hi, I'm just starting to use jQuery and, while I'm not much of a coder, I love the way it works. I was developing a project using the Prototype library, but after discovering jQuery I'm converting everything. I'm finding it straightforward but I have a request for a clarification on something. I have a function that branches depending on the class name of the element that was passed to it. Using Prototype: function checkState(id) { if ($(id).className == something) { etc but in jQuery it doesn't work. It does work if I use: if ($(id).attr(class) == something) { etc I'm just wondering, as a beginner, if that would be the most 'correct' way to do it. Also, if I want to toggle the class name of an element between say active and inactive what is the easiest way to do that? From the documentation I see that addClass won't replace the existing class so it looks like the best way is to use the attr(key,value) method and do something like: $(id).attr(class, active) It works, I'm just looking for 'best practise' advice. Thanks Miles ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Beginner question re: getting and setting element class name
Thanks! I didn't know that existed, I assume it returns boolean. That's great! Cheers On 1/14/07, Mike Alsup [EMAIL PROTECTED] wrote: function checkState(id) { if ($(id).className == something) { etc Use the is method: $(id).is(something); ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Beginner question re: getting and setting element class name
On 1/14/07, Karl Swedberg [EMAIL PROTECTED] wrote: Is id an ID? If so, you could use $('#id.something') and chain whatever methods you want onto it. The code that sets the event and function call is: $(#options).find(a).click(function(){checkState(#+this.id)}); If there's a better way to pass an element reference to a function I'd love to know, this works but it feels a bit clunky having to append the # like that. IYou could do something like this: $(id).removeClass('inactive').addClass('active'); and this: $(id).removeClass('active').addClass('inactive'); Your approach will strip the id of any other classes that it might have as well. So, if the element were div id=foo class=inactive pretty, you would be changing it to div id=foo class=active, and you would be losing the pretty. By using .removeClass() and .addClass() you can be a little more precise. Thanks, I thought about that, it is probably better practice than the way I'm doing it using the attr method. Cheers Miles ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/