[jQuery] mousedown event doesn't happen until mouseup on iPhone
Is anyone else trying to use jQuery on the iPhone? I'm doing a game using PhoneGap for iPhone and iPod Touch (with the hope of moving on to other phones). Everything was going swimmingly until I tried a mousedown event. Works correctly in PC and Mac versions of Safari, but no event occurs until the user pulls a finger up when using the iPhone's Safari. Current solution is to move from jQuery's mousedown to XUI library's touchstart event. Another concern with jQuery is that it's large compared to XUI. Much of that is due to jQuery's smoothing out of IE's quirks. Any thoughts of a tuned version of jQuery for mobile, or specifically for iPhone?
[jQuery] Query from an already-found node
I am a mostly-jQuery, sometimes Dojo user. I just came off a Dojo contract and one thing I ended up using a lot was Dojo's ability to do a query starting at a given node (subtree) of the DOM. Now I'm on a jQuery project and I find that I don't know how to do that in jQuery. Suppose I have done a query, gotten back, say, 8 nodes. After some processing I know that I want to do another query off a certain one of those nodes. In Dojo, I supply another argument which makes Dojo Query from that node instead of the whole document. Is there a way in jQuery? Suppose I've done this: nodes=$(.monkeys) and I want to do a $ (.howler) off of just nodes[3] (or $(.monkeys)[3]). Seems simple, but the solution eludes me.
[jQuery] Re: Query from an already-found node
Nevermind. Sat down with jQuery in Action and found two solutions. .find() and adding a parameter to $(). Funny I never did that before in jQuery. On Nov 9, 9:22 am, timothytoe [EMAIL PROTECTED] wrote: I am a mostly-jQuery, sometimes Dojo user. I just came off a Dojo contract and one thing I ended up using a lot was Dojo's ability to do a query starting at a given node (subtree) of the DOM. Now I'm on a jQuery project and I find that I don't know how to do that in jQuery. Suppose I have done a query, gotten back, say, 8 nodes. After some processing I know that I want to do another query off a certain one of those nodes. In Dojo, I supply another argument which makes Dojo Query from that node instead of the whole document. Is there a way in jQuery? Suppose I've done this: nodes=$(.monkeys) and I want to do a $ (.howler) off of just nodes[3] (or $(.monkeys)[3]). Seems simple, but the solution eludes me.
[jQuery] Re: Somebody know javascript function?
There was an earlier discussion: http://groups.google.com/group/jquery-en/browse_thread/thread/4480f62e57bd7e82?tvc=2q=detect+whether+images On Sep 7, 12:58 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: hi all, i need to know, how can i indicate with javascript if the client browser are enable ito display images. sohow can i to check that? which functions are need for that? the client has to be informed, if his browser has to be adjusted at first, to be the images able to display. pls help and thanks a lot. best wishes, sarmad
[jQuery] Re: Using AJAX for computation (JS too slow)
I went the other way, from computations on the server to computations on the client. Here's why: if you have a large number of players, your server costs will become a real problem. But the number of clients available to do calculations expands with the number of players, and client CPU time costs you nothing. What you need to do is break the task down into maybe 100 iterations and call it 100 times, something like the code here, which shows a prime number routine coded conventionally and then coded in setTimeout() pieces. http://dreaminginjavascript.wordpress.com/2008/08/02/functions_are_weird/ Add a progress bar and you're good. On Sep 5, 5:14 pm, jbhat [EMAIL PROTECTED] wrote: So I am porting a variation of the board game Hex from java to javascript, as I am putting it on the web. One of the functions I need to write for the computer AI to get his next move is to fill in the rest of the board (a filled hex is red or blue, an unfilled is white) 300,000 times, randomly, and check the winner of the game, and then make some quick calculations, and returns the position of the best move. This worked fine in Java, but it seems to be hanging up in JS. I have decreased the number of repetitions to 100,000, and then down to 1000, and i still have to stop the script when I test it in firefox. I was wondering if I could pass the data to an AJAX call, do the computations in PHP, and then return the correct move. I am having 2 problems however: 1) I don't think you can pass an array to AJAX, and I have an array of hex colors for the board that must be passed in. 2) The function making the AJAX call must return the move (and the correct bid, as this is a bidding game), but the function ends before the AJAX call completes. Any suggestions about how to best do this would be appreciated. You can see the code break by going tohttp://apps.facebook.com/biddinghex Then going to play computer, and entering a bid, hit bid - the script will crash. Thank you, Jay
[jQuery] Re: jQuery under Konqueror
That linked page does say, jQuery generally works with Konqueror and Firefox 1.0.x,... But in my experience, it's always a disaster. Maybe it did mostly work with an older jQuery. I think it should be changed to say that jQuery DOES NOT generally work in Konqueror. On Sep 4, 5:23 am, MorningZ [EMAIL PROTECTED] wrote: Konquerer isn't officially supported/compatible http://docs.jquery.com/Browser_Compatibility
[jQuery] Re: jQuery test suite on new Google Chrome browser
Is there really a lot of code that relies on it? If there is, wouldn't Chrome break on many more pages? I don't recall seeing any code that assumes an order. --tt On Sep 4, 1:32 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote: Yes, but every other implementation does that, so a lot of code implicitly relies on this. You don't really expect programmers to read language specs, do you? Jörn On Thu, Sep 4, 2008 at 9:53 PM, Matt Kruse [EMAIL PROTECTED] wrote: On Sep 4, 2:00 pm, Feng [EMAIL PROTECTED] wrote: The second one is a bug in V8 (or Chrome). It returns reversed enumeration order of keys if the object is a literal. This is not a bug in V8. The order of keys is never guaranteed to be in the order they are inserted or specified in a literal. Matt Kruse
[jQuery] Re: How to apply jQuery to an item which doesn't exist when the page is loaded.
Yeah, this doesn't make sense. Either the HTML is served (exists) or it's created on the fly in some way later on by JavaScript. On Sep 5, 8:01 am, S P Arif Sahari Wibowo [EMAIL PROTECTED] wrote: On Fri, 5 Sep 2008, lukas wrote: My PHP code creates a button which doesn't exist when my page is loaded. Hence, the according jQuery command doesn't work. Not sure what you meant. For server-side scripting - such as PHP - loading a page is the only way for the script to create HTML objects - including buttons. So what you said does not make any sense. Are you talking about XMLHttpRequest / AJAX request? Maybe you should point to an example page + source. -- (stephan paul) Arif Sahari Wibowo _ _ _ _ / // // / _/ / / / _/ http://www.arifsaha.com/
[jQuery] Re: jQuery test suite on new Google Chrome browser
I don't think many read language specs, but I've heard over and over (in books and online) that you can't rely on the order that you get when you use in to set through keys. I thought that was fairly well known. Nothing in the syntax hints that you'd get them in a certain order. However, obviously if one implementation stands alone, it's in the interest of that vendor to homogenize. And if everyone is going to end up with the same de facto behavior, then that behavior should be put into the standard, at least as an addendum. --tt On Sep 4, 1:32 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote: Yes, but every other implementation does that, so a lot of code implicitly relies on this. You don't really expect programmers to read language specs, do you? Jörn On Thu, Sep 4, 2008 at 9:53 PM, Matt Kruse [EMAIL PROTECTED] wrote: On Sep 4, 2:00 pm, Feng [EMAIL PROTECTED] wrote: The second one is a bug in V8 (or Chrome). It returns reversed enumeration order of keys if the object is a literal. This is not a bug in V8. The order of keys is never guaranteed to be in the order they are inserted or specified in a literal. Matt Kruse
[jQuery] Re: jQuery test suite on new Google Chrome browser
OK. I think I see. By the way, I just did some light debugging in Chrome with Firebug Lite. You can poke around in the DOM, which is nice. If anyone wants to try it, the best way to do it is with the latest Firebug Lite (the one that actually FEELS like Firebug, based off the old Pi debugger). Run it as a bookmarklet. javascript:var %20firebug=document.createElement('script');firebug.setAttribute('src','http:// getfirebug.com/releases/lite/1.2/firebug-lite- compressed.js');document.body.appendChild(firebug);(function() {if(window.piwindow.firebug) {firebug.init();}else{setTimeout(arguments.callee);}}) ();void(firebug); On Sep 2, 4:52 pm, Michael Geary [EMAIL PROTECTED] wrote: From timothytoe I'm not 100% sure, but I think you misread Matt's post. Matt seemed to be saying the same thing you are--the order of keys should not be relied upon. If you take out Matt's post, the context for my reply may be more clear... From: Guy Fraser I've never seen an ECMA script compiler (JS, AS, etc) that doesn't iterate through named references in the expected order? From: Michael Geary But there is no expected order in a for..in loop. Any decent JavaScript reference book, such as Flanagan's, should point this out...
[jQuery] Re: jQuery test suite on new Google Chrome browser
That was me. I was up all night trying every site I could think of. On Sep 3, 1:38 pm, [EMAIL PROTECTED] wrote: I wonder how come google load pages half the time that firefox 3.0 does ... thats so interesting..right now I use firefox for its firebug and plugins and I use safari 3 because it takes small memory... it is amazing that CHrone has 3% of hits in the internet
[jQuery] Re: jQuery test suite on new Google Chrome browser
That sounds suspiciously like what Safari does in some cases: http://dreaminginjavascript.wordpress.com/2008/07/06/a-challenge/ On Sep 2, 2:49 pm, Matt Kruse [EMAIL PROTECTED] wrote: On Sep 2, 2:45 pm, Guyon Morée [EMAIL PROTECTED] wrote: Even though, Chrome seems to be a little bit faster than FF and quite a lot faster than IE, it has 2 failed tests: - 64: core module: text(String) (1, 3, 4) This looks like a bug in Chrome to me. It doesn't escape characters when inserting text nodes. I would have to check the specs to be sure that escaping of is required. - 112: ajax module: jQuery.param() (1, 3, 4) This appears to be a bad assumption in the jQuery tests. The code in param() calls: for ( var j in a ) and makes the assumption that the keys will be returned in the same order they are specified. This is not an assumption that should be made, so the test should be changed to allow for the returned string to be in arbitrary key order. Otherwise it's great to see that everything else passes! Surely this will be a browser that will gain user share at some point, IMO, and it's better to be ahead of the curve than playing catch-up. Matt Kruse
[jQuery] Re: jQuery test suite on new Google Chrome browser
I have a very large app that works perfectly in Chrome (with lots of jQuery and jQuery plugs), so the omens are good. One computationally intensive bit takes 14 seconds in FF3 and 7 in Chrome. Amazing. On Sep 2, 12:45 pm, Guyon Morée [EMAIL PROTECTED] wrote: Hi, With all the buzz around the new javascript engine in Chrome, I decided to run the jquery testsuite (http://jquery.com/test/) on my 3 installed browsers (ff3, ie7 and chrome, on wixp sp3) == IE7: Tests completed in 49734 milliseconds. 0 tests of 1270 failed. FF3: Tests completed in 31710 milliseconds. 0 tests of 1270 failed. Chrome: Tests completed in 28212 milliseconds. 2 tests of 1270 failed. == Even though, Chrome seems to be a little bit faster than FF and quite a lot faster than IE, it has 2 failed tests: - 64: core module: text(String) (1, 3, 4) - 112: ajax module: jQuery.param() (1, 3, 4) I have really no experience interpreting these results, so I hope someone here can give me an explaination about these and what it means to me as a jQuery user. Regards, guyon
[jQuery] Re: jQuery test suite on new Google Chrome browser
I'm not 100% sure, but I think you misread Matt's post. Matt seemed to be saying the same thing you are--the order of keys should not be relied upon. On Sep 2, 4:26 pm, Michael Geary [EMAIL PROTECTED] wrote: Matt Kruse wrote: This appears to be a bad assumption in the jQuery tests. The code in param() calls: for ( var j in a ) and makes the assumption that the keys will be returned in the same order they are specified. This is not an assumption that should be made, so the test should be changed to allow for the returned string to be in arbitrary key order. From: Guy Fraser I've never seen an ECMA script compiler (JS, AS, etc) that doesn't iterate through named references in the expected order? But there is no expected order in a for..in loop. Any decent JavaScript reference book, such as Flanagan's, should point this out. Of course, you could make the same argument that I made for the text node issue, that too much code depends on this and they have to fix it. But I think given their architecture for property lookups, it may not be possible. And I would hope that not too much code does depend on it anyway. -Mike
[jQuery] Re: jQuery History Plugin
I'm still waiting to find something reasonable. On Jul 5, 3:49 am, [EMAIL PROTECTED] wrote: Did you find the History Plugin which You need I have the same Problem with Bookmarking On May 30, 6:11 pm, timothytoe [EMAIL PROTECTED] wrote: Great. I'll keep my eyes peeled. On May 30, 7:55 am, Klaus Hartl [EMAIL PROTECTED] wrote: On May 30, 1:35 am, timothytoe [EMAIL PROTECTED] wrote: Yes. Oh well. Where should I watch for updates? Will there be an update of history to accommodate UI Tabs? Or is it more likely that UI Tabs will incorporate a history feature? I have roughly rewritten the history plugin already so that it will be much more flexible... (and work in Safari 3 and IE8):http://www.stilbuero.de/jquery/ui_history/ I will then nicely integrate history into tabs so that a user wouldn't have to care too much except for including both plugins and enabling history via an option. Due to immense workload the last few month I got stuck though. The biggest thing missing is actually a strange bug in IE 6, that needs to be fixed before I would call it a beta version. History will be released as part of jQuery UI and I will surely anounce it on the list. --Klaus
[jQuery] Re: I love JQuery but why is it slower than Dojo and ExtJS Core
Also, the jQuery file only has to be transfered once to each person that used it. Then the browser just uses the cached file. Well, that depends on a lot of things. :-)
[jQuery] Re: [OT] Re: [jQuery] Re: anti IE6
I recently read a blog post (I think one of the Ajaxian guys) that said maybe the first Monday of the month, we could point out that modern browsers work better. I think an alert would be overkill, unless the site really is unbearable in IE6. But maybe its is about time for a little star or something pointing out that the browser sucks. After all, if we can get the IE6 clients now to a negligible level, a lot more time will go into real production work rather than accommodating a browser that now sticks out like a pus-filled thumb. Sure, a lot of time it's IT or some enterprise software holding back the upgrades, but users are able to apply a bit of pressure sometimes. On Jun 9, 1:29 pm, Josh Nathanson [EMAIL PROTECTED] wrote: Any kind of public facing site has to support IE6, especially if it's ecommerce. It's not acceptable to tell potential customers to go download another web browser. Most people will just go shop somewhere else, and probably never come back. Nothing leaves a bad taste in people's mouths like being told immediately they have to go download something. At least we have jQuery to help us with IE6 support. -- Josh - Original Message - From: Guy Fraser To: jquery-en@googlegroups.com Sent: Monday, June 09, 2008 1:04 PM Subject: [jQuery] [OT] Re: [jQuery] Re: anti IE6 MorningZ wrote: Any many huge corporations and govt branches are slow to update as well it's certainly not their fault, so why would you purposefully annoy them? Because if you don't annoy them, they keep using IE6, and we have to keep putting up with the pain of supporting it. Many web developers still have the crazy notion that we should support IE6. However, doing so only causes us more pain because people using IE6 mistakenly believe that they have a good browser and therefore never get rid of it so the pain continues. The only feasible way to kill off IE6 is to simply stop supporting it. When the customer or end-user complains, explain that their browser is broken and that they should upgrade to a free, modern browser like Firefox, Opera or Safari/Webkit. Think about it, if your car was broken would you expect all the roads in the country to be modified to counter the broken car? No, it would be ludicrous. The broken car would be fixed or destroyed for the good of humanity. Yet, it seems, in the web world we continue this crazy self-destructive act of supporting the most widespread and heavily broken browser the entire planet has ever encountered. It has to stop. There's nothing stopping large organisations from installing a modern browser alongside IE6 - IE6 can then still be used for their broken intranet, the modern browser can be used for everything else. Visit:http://www.savethedevelopers.org
[jQuery] Re: anti IE6
Where my brother works, IE6 is mandated by IT. The employees are not allowed to update. I know. Irritating. On Jun 8, 11:55 am, tudorizer [EMAIL PROTECTED] wrote: Made this quick alert box for IE6:http://tudorizer.wordpress.com/2008/06/08/anti-ie6/ For those preistoric guys who want to make developers go crazy debugging IE6.
[jQuery] string to JSON and back
Is there a clever way to do JSON encoding and decoding in jQuery without AJAX and without a form? Does all the serialization in jQuery imply transmission via AJAX? All I want is object - string and string - object.
[jQuery] Re: jQuery History Plugin
Great. I'll keep my eyes peeled. On May 30, 7:55 am, Klaus Hartl [EMAIL PROTECTED] wrote: On May 30, 1:35 am, timothytoe [EMAIL PROTECTED] wrote: Yes. Oh well. Where should I watch for updates? Will there be an update of history to accommodate UI Tabs? Or is it more likely that UI Tabs will incorporate a history feature? I have roughly rewritten the history plugin already so that it will be much more flexible... (and work in Safari 3 and IE8):http://www.stilbuero.de/jquery/ui_history/ I will then nicely integrate history into tabs so that a user wouldn't have to care too much except for including both plugins and enabling history via an option. Due to immense workload the last few month I got stuck though. The biggest thing missing is actually a strange bug in IE 6, that needs to be fixed before I would call it a beta version. History will be released as part of jQuery UI and I will surely anounce it on the list. --Klaus
[jQuery] Re: jQuery History Plugin
Yes. Oh well. Where should I watch for updates? Will there be an update of history to accommodate UI Tabs? Or is it more likely that UI Tabs will incorporate a history feature? On May 29, 12:06 pm, Klaus Hartl [EMAIL PROTECTED] wrote: I assume you're using UI Tabs? http://docs.jquery.com/UI/Tabs#Does_UI_Tabs_support_back_button_and_b... --Klaus On May 28, 6:11 pm, timothytoe [EMAIL PROTECTED] wrote: Ajax History doesn't seem to be working for me. I'm including the file (which I've thrown into my jQuery directory... script type=text/javascript src=jQuery/ jquery.history_remote.js/script And I've initialized the history (right after document.ready)... $.ajaxHistory.initialize(); I'm using a recent version of the Tabs plugin. script type=text/javascript src=jquery.ui-1.5b4/ui.tabs.js/ script Nothing new happens. History doesn't work (in FF2). Am I missing a step or two? All my tabs have the hash (of course) provided by the tabs plug-in. Any ideas? On Apr 28, 6:06 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I was working around with this history plugin, quite interesting. But unfortunate thing is, I was not able to use this for any ajax calls (link) present in the responseText. Funny. On Apr 5, 5:48 am, Klaus Hartl [EMAIL PROTECTED] wrote: You'll probably have to maintain the state on your own. I'm currently rewriting theHistoryplugin, so that you can do: $.history('add', 'state_name', function { // handle, e.g. restore state... }); --Klaus On Apr 5, 1:12 am, sbyrne [EMAIL PROTECTED] wrote: I'm with you regarding the click event, but how does that solve the problem of the state of the form (values of the input fields) when it was submitted via AJAX? On Feb 27, 2:43 pm, Klaus Hartl [EMAIL PROTECTED] wrote: Historycan only work with links because the whole hack relies on changing the fragment identifier of the current address. This is not possible with form submits. Workaround: Use a click event that submits the form as an Ajax form. The form plugin makes that pretty easy and maybe you were talking of myhistoryplugin: http://stilbuero.de/jquery/history/ --Klaus On Feb 27, 7:54 pm, urbolutions [EMAIL PROTECTED] wrote: Is there a good jQueryhistoryplugin that works with form submissions? Critical part being form posts here. Found one that seems to only work with click events...need the form posts. Any help would be greatly appreciated!
[jQuery] Re: jQuery History Plugin
Ajax History doesn't seem to be working for me. I'm including the file (which I've thrown into my jQuery directory... script type=text/javascript src=jQuery/ jquery.history_remote.js/script And I've initialized the history (right after document.ready)... $.ajaxHistory.initialize(); I'm using a recent version of the Tabs plugin. script type=text/javascript src=jquery.ui-1.5b4/ui.tabs.js/ script Nothing new happens. History doesn't work (in FF2). Am I missing a step or two? All my tabs have the hash (of course) provided by the tabs plug-in. Any ideas? On Apr 28, 6:06 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I was working around with this history plugin, quite interesting. But unfortunate thing is, I was not able to use this for any ajax calls (link) present in the responseText. Funny. On Apr 5, 5:48 am, Klaus Hartl [EMAIL PROTECTED] wrote: You'll probably have to maintain the state on your own. I'm currently rewriting theHistoryplugin, so that you can do: $.history('add', 'state_name', function { // handle, e.g. restore state... }); --Klaus On Apr 5, 1:12 am, sbyrne [EMAIL PROTECTED] wrote: I'm with you regarding the click event, but how does that solve the problem of the state of the form (values of the input fields) when it was submitted via AJAX? On Feb 27, 2:43 pm, Klaus Hartl [EMAIL PROTECTED] wrote: Historycan only work with links because the whole hack relies on changing the fragment identifier of the current address. This is not possible with form submits. Workaround: Use a click event that submits the form as an Ajax form. The form plugin makes that pretty easy and maybe you were talking of myhistoryplugin: http://stilbuero.de/jquery/history/ --Klaus On Feb 27, 7:54 pm, urbolutions [EMAIL PROTECTED] wrote: Is there a good jQueryhistoryplugin that works with form submissions? Critical part being form posts here. Found one that seems to only work with click events...need the form posts. Any help would be greatly appreciated!
[jQuery] bassistance.de jQuery plugin: Autocomplete
I've been trying a few different versions of this plug-in. It's nice, but the very first thing I have to do is override the colors. blockquotecodelink rel=stylesheet type=text/css href=jQuery/jquery.autocomplete.css / !-- Override weird colors in css file -- style type=text/css .ac_over { background-color: #fed; color: #012; } /style /code/blockquote How is it working for anyone? By default I get unreadable dark-blue on black as the colors in the drop-down.
[jQuery] Re: bassistance.de jQuery plugin: Autocomplete
Also, I'm adding entries as list elements to a UL. Is there a clever way to keep someone from adding the same thing twice? On Apr 2, 9:28 am, timothytoe [EMAIL PROTECTED] wrote: I've been trying a few different versions of this plug-in. It's nice, but the very first thing I have to do is override the colors. blockquotecodelink rel=stylesheet type=text/css href=jQuery/jquery.autocomplete.css / !-- Override weird colors in css file -- style type=text/css .ac_over { background-color: #fed; color: #012; } /style /code/blockquote How is it working for anyone? By default I get unreadable dark-blue on black as the colors in the drop-down.
[jQuery] Re: Dynamically generated HTML and effects on CSS
Tricky. If I were you, what I'd try next would be using jQuery's css() to change to rtl in a setTimeout() call. Sounds stupid, but it might help you narrow down the problem. I've had odd problems with browsers not rendering anything until they come up for air, and doing things inside a setTimer() can slap them into attention. Sometimes a caanvas won't render unless it's triggered in a setTimeout()--maybe your case is similar. Maybe see if you can get it toggling between rtl and ltr every five seconds. On Mar 8, 3:07 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Yes, i meant dir for html tags, direction for css respectively. Thanks for the response anyway.
[jQuery] Re: callbacks calling callbacks calling callbacks ....
Yeah, I know it'd be better to pack the requests. At the moment, it's easier to mess with the client than with the server. I'm sure I'll eventually get around to dealing with the server code again. It's possible that the client will request more records later in the seession, and I want to get everything working in the simplest, most general way before I optimize things. I've made the mistake of optimizing code that wasn't done many, many times. I'm trying to stop doing that. On Mar 8, 10:13 am, J Moore [EMAIL PROTECTED] wrote: Regarding your example of waiting for N records to come back, it is definitely worth it to pack all those requests into a single AJAX/JSON request. Not only are you saving the overhead of the HTTP requests (browsers can only make a 2-4 requests concurrently) but your code will be cleaner. (e.g. no counter in on the callback) To the OP: can you post more details about what you're trying to do when you end up with so many callbacks? It sounds like things could be make cleaner using objects and callback methods instead of having tons of nesting code blocks. On Mar 7, 6:41 pm, timothytoe [EMAIL PROTECTED] wrote: I had a case where I had to wait for n records to come from the server. They all had the same callback, which incremented a counter.and checked to see if this load was the last one. It worked, but I have thought about giving the whole lists of requests to the server at once and having the server put together one large response instead of n small ones. I've had other cases that were more complex where I used a bitfield instead of a bunch of logic to see if the required pieces had come in yet. I've not come up with anything I like in jQuery animation-wise. When it's just one thing I'm animating in jQuery, I'm happy. When it's more, I end up with a big mess. I'm not sure what I'm looking for, but I'm really starting to hate jQuery's nested animation system because it's such a pain to change things around once you've done the work. On Mar 7, 2:19 pm, Shawn [EMAIL PROTECTED] wrote: This plugin was suggested in another thread: http://plugins.jquery.com/project/ajaxqueue While it's close, my initial read of it suggests it doesn't do quite what we're looking for here. I'll have to play with it to be sure though... Shawn Hamish Campbell wrote: Sounds like some sort of ajax queuing plugin is in order. Would have to be more complex than animation queues. eg, queue constists of a 1-d array. Each element in the array can be a request, or an array of requests (that execute simultaneously). The queue pops the first element, performs the call (or calls), checks for completion then pops the next one. Errors return the queue position, or perhaps there is an array of error callbacks? On Mar 7, 1:30 pm, Shawn [EMAIL PROTECTED] wrote: I have a similar situation and am watching this thread in hopes something useful may come of it. What I've done for now is the nested calls. I use a common errorHandler() function that takes in the element to show the message with and the message itself. The message tends to be the .responseText of the XHR object more often than not. But this still feels clumsy. What I've considered doing is to create a temporary structure that would contain flags for each of the sub processes. The success function for each sub process would set its flag as being complete and then call the final update function. This final update function would check each of the flags and when all are set do whatever final processing (if any) is needed. For instance, I need to a) get a list of employees, b) get a list of tasks for all employees, c) render a table for the employees tasks and apply some code to give the table a fixed header and column. I already have existing routines to get the employees and tasks, so can reuse these here. So my code may potentially look like this: var mydata= { flags: { employees: false, tasks: false }, employees = [], tasks = [], render: function () { //don't continue if we don't have enough data if ( !mydata.flags.employees || !mydata.flags.tasks ) { return; } //code to render the output goes here. ... } }; $.ajax({ url: getEmployees.php, dataType: json, success: function (json) { mydata.employees = json; mydata.flags.employees = true; mydata.render(); } }); $.ajax({ url: getTasks.php, dataType: json, success: function (json) { mydata.tasks = json; mydata.flags.tasks = true; mydata.render(); } }) obviously this is not throughly thought out yet, and has room for optimizations (I don't think the flags are really required if you just check the data properties
[jQuery] Re: callbacks calling callbacks calling callbacks ....
I had a case where I had to wait for n records to come from the server. They all had the same callback, which incremented a counter.and checked to see if this load was the last one. It worked, but I have thought about giving the whole lists of requests to the server at once and having the server put together one large response instead of n small ones. I've had other cases that were more complex where I used a bitfield instead of a bunch of logic to see if the required pieces had come in yet. I've not come up with anything I like in jQuery animation-wise. When it's just one thing I'm animating in jQuery, I'm happy. When it's more, I end up with a big mess. I'm not sure what I'm looking for, but I'm really starting to hate jQuery's nested animation system because it's such a pain to change things around once you've done the work. On Mar 7, 2:19 pm, Shawn [EMAIL PROTECTED] wrote: This plugin was suggested in another thread: http://plugins.jquery.com/project/ajaxqueue While it's close, my initial read of it suggests it doesn't do quite what we're looking for here. I'll have to play with it to be sure though... Shawn Hamish Campbell wrote: Sounds like some sort of ajax queuing plugin is in order. Would have to be more complex than animation queues. eg, queue constists of a 1-d array. Each element in the array can be a request, or an array of requests (that execute simultaneously). The queue pops the first element, performs the call (or calls), checks for completion then pops the next one. Errors return the queue position, or perhaps there is an array of error callbacks? On Mar 7, 1:30 pm, Shawn [EMAIL PROTECTED] wrote: I have a similar situation and am watching this thread in hopes something useful may come of it. What I've done for now is the nested calls. I use a common errorHandler() function that takes in the element to show the message with and the message itself. The message tends to be the .responseText of the XHR object more often than not. But this still feels clumsy. What I've considered doing is to create a temporary structure that would contain flags for each of the sub processes. The success function for each sub process would set its flag as being complete and then call the final update function. This final update function would check each of the flags and when all are set do whatever final processing (if any) is needed. For instance, I need to a) get a list of employees, b) get a list of tasks for all employees, c) render a table for the employees tasks and apply some code to give the table a fixed header and column. I already have existing routines to get the employees and tasks, so can reuse these here. So my code may potentially look like this: var mydata= { flags: { employees: false, tasks: false }, employees = [], tasks = [], render: function () { //don't continue if we don't have enough data if ( !mydata.flags.employees || !mydata.flags.tasks ) { return; } //code to render the output goes here. ... } }; $.ajax({ url: getEmployees.php, dataType: json, success: function (json) { mydata.employees = json; mydata.flags.employees = true; mydata.render(); } }); $.ajax({ url: getTasks.php, dataType: json, success: function (json) { mydata.tasks = json; mydata.flags.tasks = true; mydata.render(); } }) obviously this is not throughly thought out yet, and has room for optimizations (I don't think the flags are really required if you just check the data properties instead). But what this would allow is the two ajax requests to be run concurrently and still have the same output. Which ever Ajax request finishes last fires the rendering (and it doesn't matter which). The nested approach would take twice as long (by may be more reliable?) as the second request isn't made until AFTER the first has been completed. This may be a moot point for this sample problem, but I know I have a couple places where 4 or 5 Ajax requests are needed to complete one task. The problem here is that event handling is not taken care of automagically. Each Ajax request would need to handle this itself. But this entire process could in theory be wrapped up into a single function. I guess the real question is if that function can be abstracted enough to make it generic. Right now, I don't see how. I don't think this idea is revolutionary or anything. Probably kinda obvious and/or flawed. But perhaps it'll get you (us?) moving in a positive direction. Now I'm curious though and want to try out some things... I'll report back if I have any success... Shawn h0tzen wrote: On 5 Mrz., 15:40, J Moore [EMAIL PROTECTED] wrote: wouldn't nesting the methods work? e.g. unfortunately not as some methods have to be invoked in parallel. generally
[jQuery] Re: IE8
Hehe. I _really_ hope the JScript gets faster in upcoming releases. It seems as if their DOM stuff got faster but I haven't checked. On Mar 6, 12:47 am, Michael Stuhr [EMAIL PROTECTED] wrote: timothytoe schrieb: One thing I noticed is that the JavaScript is still painfully slow, but perhaps there is a lot of debug stuff in there slowing it down. What takes 7 seconds in Safari and 8 in Firefox 3b3 takes 25 seconds in IE8! (28 seconds in IE6). That's ~11% better in ~8 years Not too bad. :-) micha
[jQuery] Re: IE8
I'm doing a $.get() in IE8 without trouble, but I've only tried locally (local Apache, PHP on Windows XP). On Mar 6, 7:35 am, ajpiano [EMAIL PROTECTED] wrote: anyone else getting errors at line 2666 of jQuery during ajax requests in IE8? xml.open(s.type, s.url, s.async, s.username, s.password); the debugger says, Breaking on JScript runtime error - Permission denied --adam On Mar 6, 9:40 am, timothytoe [EMAIL PROTECTED] wrote: Hehe. I _really_ hope the JScript gets faster in upcoming releases. It seems as if their DOM stuff got faster but I haven't checked. On Mar 6, 12:47 am, Michael Stuhr [EMAIL PROTECTED] wrote: timothytoe schrieb: One thing I noticed is that the JavaScript is still painfully slow, but perhaps there is a lot of debug stuff in there slowing it down. What takes 7 seconds in Safari and 8 in Firefox 3b3 takes 25 seconds in IE8! (28 seconds in IE6). That's ~11% better in ~8 years Not too bad. :-) micha
[jQuery] Re: IE8
Scratch that. During the long calculation I show a chart to keep people from being bored. It's negligible in FF, but turns out to be a huge cost in IE (using excanvas). So I'm going to only show it in IE 1/4 as often. Still have to give people something to look at. On Mar 6, 6:40 am, timothytoe [EMAIL PROTECTED] wrote: Hehe. I _really_ hope the JScript gets faster in upcoming releases. It seems as if their DOM stuff got faster but I haven't checked. On Mar 6, 12:47 am, Michael Stuhr [EMAIL PROTECTED] wrote: timothytoe schrieb: One thing I noticed is that the JavaScript is still painfully slow, but perhaps there is a lot of debug stuff in there slowing it down. What takes 7 seconds in Safari and 8 in Firefox 3b3 takes 25 seconds in IE8! (28 seconds in IE6). That's ~11% better in ~8 years Not too bad. :-) micha
[jQuery] IE8
I was pretty excited to download IE8 today. All the jQuery stuff in my app seems to work fine. The debugger is pretty nice. I've always had trouble finding bugs in IE. Anyone find any IE8 jQuery problems yet?
[jQuery] Re: IE8
It seemed to overwrite IE7, but it has an IE7 mode. I only did it on one computer. On Mar 5, 1:41 pm, Rey Bango [EMAIL PROTECTED] wrote: Did IE8 overwrite IE7 or can it work standalone? Rey timothytoe wrote: I was pretty excited to download IE8 today. All the jQuery stuff in my app seems to work fine. The debugger is pretty nice. I've always had trouble finding bugs in IE. Anyone find any IE8 jQuery problems yet?
[jQuery] Re: IE8
http://www.microsoft.com/windows/products/winfamily/ie/ie8/readiness/Install.htm On Mar 5, 2:52 pm, Benjamin Sterling [EMAIL PROTECTED] wrote: Tim, can you point me to the download link? On 3/5/08, timothytoe [EMAIL PROTECTED] wrote: It seemed to overwrite IE7, but it has an IE7 mode. I only did it on one computer. On Mar 5, 1:41 pm, Rey Bango [EMAIL PROTECTED] wrote: Did IE8 overwrite IE7 or can it work standalone? Rey timothytoe wrote: I was pretty excited to download IE8 today. All the jQuery stuff in my app seems to work fine. The debugger is pretty nice. I've always had trouble finding bugs in IE. Anyone find any IE8 jQuery problems yet? -- Benjamin Sterlinghttp://www.KenzoMedia.comhttp://www.KenzoHosting.comhttp://www.benjaminsterling.com
[jQuery] Re: IE8
One thing I noticed is that the JavaScript is still painfully slow, but perhaps there is a lot of debug stuff in there slowing it down. What takes 7 seconds in Safari and 8 in Firefox 3b3 takes 25 seconds in IE8! (28 seconds in IE6). On Mar 5, 2:54 pm, timothytoe [EMAIL PROTECTED] wrote: http://www.microsoft.com/windows/products/winfamily/ie/ie8/readiness/... On Mar 5, 2:52 pm, Benjamin Sterling [EMAIL PROTECTED] wrote: Tim, can you point me to the download link? On 3/5/08, timothytoe [EMAIL PROTECTED] wrote: It seemed to overwrite IE7, but it has an IE7 mode. I only did it on one computer. On Mar 5, 1:41 pm, Rey Bango [EMAIL PROTECTED] wrote: Did IE8 overwrite IE7 or can it work standalone? Rey timothytoe wrote: I was pretty excited to download IE8 today. All the jQuery stuff in my app seems to work fine. The debugger is pretty nice. I've always had trouble finding bugs in IE. Anyone find any IE8 jQuery problems yet? -- Benjamin Sterlinghttp://www.KenzoMedia.comhttp://www.KenzoHosting.comhttp://www.benjam...
[jQuery] Re: jQuery in Action
I don't think there have been 4 or 5 topics. If there have been, I've missed most of them. I remember one topic where someone was asking about what books to read. And I started a kudos for the jQuery In Action book. If there have been any others, I missed them and I'd like to read them. By the way, I think the titles of all the In Action books suck. Sounds like jQuery Inaction. On Mar 2, 8:10 pm, Joe [EMAIL PROTECTED] wrote: Thanks for sharing MorningZ. My bad. Maybe I shouldn't have pulled the trigger so quickly on my enthusiasm... On Mar 2, 9:41 pm, MorningZ [EMAIL PROTECTED] wrote: Thoughts? There's at least 4 to 5 topics so far with thoughts about this book :-)
[jQuery] Re: Function overriding
You may find this article interesting... http://osteele.com/archives/2006/04/javascript-memoization On Mar 2, 11:50 pm, howa [EMAIL PROTECTED] wrote: Consider I have a simple plugin, e.g. jQuery.example = function(name) { sayHello = function(str) { alert(jQuery.example.sayHello: + str); }; sayHello(name); }; at sometime later, I would want to override the original sayHello method(), so I add, jQuery.example.sayHello = function(str) { alert(jQuery.example.sayHello(Overrided): + str); }; But this does not work. Any idea? Thanks.
[jQuery] Re: How do I use my functions with jQuery syntax alike?
I bet if you asked on the jQuery development board, you'd get a good answer. The people reading that one are more likely to understand the internals. On Feb 23, 4:59 am, Nazgulled [EMAIL PROTECTED] wrote: Ok, thanks for all your help... If anyone else can provide any more insight on the differences between those 2 pieces of code... On Feb 23, 2:05 am, timothytoe [EMAIL PROTECTED] wrote: I don't know if there's any practical difference. Maybe someone more knowledgeable can chime it. Perhaps the former ends up being a savings in file size if you have a lot of functions. On Feb 22, 5:44 pm, Nazgulled [EMAIL PROTECTED] wrote: I see, but... How is this: (function($) { $.something = function() { alert('something'); } $.test = { abc: function() { alert('test'); } } })(jQuery); Different from this: jQuery.something = function() { alert('something'); } jQuery.test = { abc: function() { alert('test'); } } Besides the syntax used of course. I mean, you simply do $.something() or $.test.abc() and it will work no matter if you coded in the first way or second... timothytoe wrote: Any time you create a function without a name it's anonymous. Example: window.setTimeout(function() { alert('Hello world!') }, 60); On Feb 22, 4:56 pm, Nazgulled [EMAIL PROTECTED] wrote: timothytoe wrote: The function doesn't have a name, so it doesn't pollute the namespace, and it's great for making functions inline for handlers and setTimeout() without the burden of having to make up a name that won't even be referenced. Can you give me an example of what you mean? I'm getting a bit confused... It's an outgrowth of everything being an object in JavaScript, and being able to pass any object as a parameter. A function is an object in JavaScript and can be passed as a parameter. Yes, I knew that, I just don't see how it relates to anonymous functions. It's very powerful. On Feb 22, 4:39 pm, Nazgulled [EMAIL PROTECTED] wrote: And what exactly it means to hide a function, making it anonymous? timothytoe wrote: JavaScript has really expressive ways to call functions. The first parentheses hide the function (make it anonymous) and the second executes the code immediately with the parameter listed. I'm a newbie myself, but I think that means right now, pass the variable jQuery in as $ to the function and execute the code. On Feb 22, 4:06 pm, Nazgulled [EMAIL PROTECTED] wrote: Thanks... And what's up with the: (function($) { // CODE })(jQuery); This was the thing that got me most confused when reading the documentation. Can someone explain me this, what it does, what is for and the best scenarios where would I need to use something like this? If possible, explain me like I was really dumb :P Klaus Hartl wrote: On Feb 23, 12:14�am, Nazgulled [EMAIL PROTECTED] wrote: Hi, Let's say I have 2 different javascript files. I like to organize my code that's why I use 2 different files so each file will only have functions that fall into that file's category. Anyway, here's the files layout... file1.js: function Fn1() { ... } function Fn2(a, b) { ...} file2.js function FnX(a, b, c) { ... } function FnY(a, b) { ... } function FnZ(a) { ... } How can I call those functions in a syntax like this: $.groupName.Fn1(); $.groupName.Fn2('text', 123); or jQuery.groupName.FnZ(true); How do I do this? P.S: I've read the plugins authoring documentation page but I'm still confused and I don't know how to achieve this, please advise... Something like: $.groupName = $.groupName || {}; $.extend($.groupName, { Fn1: function() { ... }, Fn2: function(a, b) { ... } }); --Klaus
[jQuery] Re: Why does it take so long for a new topic to be posted?
That makes sense. But it doesn't negate the fact that 'Google' Groups had funky response yesterday. I hit it several times when 'Google' Groups apologized because the boards were down, and once it came up in what looked like a low-bandwidth version of the 'Google' Groups page. No messages for 15 minutes. Then I grab my coffee and there are dozens of messages in several groups, not just the jQuery ones. On Feb 22, 5:28 pm, Sientz [EMAIL PROTECTED] wrote: On Feb 22, 8:41 am, gh0st [EMAIL PROTECTED] wrote: Why does it take so long for a new topic to be posted? It really is frustrating esp, if you want answers to questions. It has nothing to do with 'Google'. If you look at the link on the right that says 'About This Group' it says something like: Messages By New Members Are Moderated. So basically your topic is sitting there waiting to be authorized by an administrator.
[jQuery] Re: Mac OS X default system drag and drop is overriding Interface's drag and drop
Thanks, Dave. You just gave me a stomach ache. I just fought the browsers for two days to get my interface working with all the mouseup and mousedown stuff. I eventually got it all working, but only on Windows. I have not tested the Mac browsers yet. I'll be interested in what you come up with. On Feb 23, 9:33 am, Dave Stewart [EMAIL PROTECTED] wrote: Hi all, I'm developing a back end for a photographer's agent, and she wants the site to be mainly drag 'n' drop thumbnail images, so she can create collections of various images, by dragging from various bins. So I've started with a styled ul list of images, and each li contains an img. Each img aligns to the middle of it's li so the whole thing looks like a grid of slides. I'm using the Interface plugin and it's all working great; I can grab the lis and it's easy to re-arrange them. However - with the Mac, when you go to click on the li the browser intercepts the click on the img and thinks you want to drag the image to your desktop! Any functionality gained through Interface is lost. Does anyone have any solutions? I'm going to look at placing some kind of div over the top, but I wanted to ask here first. Cheers, Dave
[jQuery] Re: trying to find the first instance of a person's name on the page
Do you know the list of names? Or are you trying to identify what might be a name on the page (say two words in a row with initial caps)? On Feb 23, 12:35 pm, sspboyd [EMAIL PROTECTED] wrote: Hi Dave, I want to find specific names (I have a list of 320 names in an xml file). I want to scan through a page and create a link around the first instance for one of the names in the list. eg Stephen Boyd's favourite person in the work is Fred Von Brown. Stephen Boyd calls Fred Von Brown every day. would become a href=biolinkStephenStephen Boyd's/a favourite person in the work is a href=biolinkFredFred Von Brown/a. Stephen Boyd calls Fred Von Brown every day. One of the gotcha's I've considered is that some people's names may have apostrophes on them, eg Stephen Boyd's. I'm sure there are many more gotcha's as well but at this point I am trying to get a sense of the feasibility of this idea. On Feb 23, 1:48 pm, Dave Stewart [EMAIL PROTECTED] wrote: Well regexp would be useful if there was a pattern to people's names, but there isn't. Do you want to find any names, or a list, or a specific name?
[jQuery] jQuery is killing my xhtml strict validation
Not sure this is 100% jQuery's problem. I do this: $(#logo).html(img src='images/logosmall.gif' alt='logopic' /); But what lands in the browser is this: div id=logoimg src=images/logosmall.gif alt=logopic/div Interestingly, the single quotes have been converted to double quotes and the trailing / has been lost, which kills my validation. Is it jQuery being funny here or the browser itself? What should I do? If it helps, my PHP file stats like this: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta name=generator content=HTML Tidy for Linux/x86 (vers 11 February 2007), see www.w3.org /
[jQuery] Re: jQuery is killing my xhtml strict validation
OK. Since I'm creating so much of the web site on the fly, there's really no way of knowing whether I'm valid or not, is there? I mean it's pretty easy to make my trivial, skeletal html (or php) file valid--there's hardly anything in it! I tried to go through all the paths and validate. I guess I'm OK if all I get are warnings that complain about the validator seeing an HTML version of the DOM rather than a XHTML version. Oh, and canvas is not valid. Nothing to be done about that, right? On Feb 23, 6:36 pm, Karl Rudd [EMAIL PROTECTED] wrote: It's not a problem. I assume you're viewing the DOM tree via Firebug (or something similar)? If so then what you're seeing is a representation of the tree that Firebug is generating. The concept of XHTML vs HTML (vs XML) is pretty much gone after the (X)HTML is parsed and turned into the DOM tree. There's no need for keeping around the quotes, '/' or other delimiters as each of the elements now exists as a node, not as some textual representation. Karl Rudd On Sun, Feb 24, 2008 at 10:52 AM, timothytoe [EMAIL PROTECTED] wrote: Not sure this is 100% jQuery's problem. I do this: $(#logo).html(img src='images/logosmall.gif' alt='logopic' /); But what lands in the browser is this: div id=logoimg src=images/logosmall.gif alt=logopic/div Interestingly, the single quotes have been converted to double quotes and the trailing / has been lost, which kills my validation. Is it jQuery being funny here or the browser itself? What should I do? If it helps, my PHP file stats like this: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta name=generator content=HTML Tidy for Linux/x86 (vers 11 February 2007), seewww.w3.org /
[jQuery] Re: Break out of a for loop.
I think you're having trouble with a closure. It's a common problem and I recently got help on it myself. JavaScript looks like C, but it's not C (or Java). You'll probably keep running into this kind of thing until you understand closures, so go ahead and search for javascript closure on google. You're setting up handlers that get clicked in the future. By the time they are clicked, the loop is done and i is where it left off. Once you understand closures and anonymous functions, you'll be able to fix that. I'm hesitant to rewrite your code, because I don't want to give you something I haven't tested, but here's a similar problem and solution. Might help you out. Try them both and see what they do. 1. var i; for (i= for (i=0;i5;i++) { setTimeout(function() {alert('first '+i);},5000); } 2. for (i=0;i5;i++) { (function(num) { setTimeout(function() {alert('second '+num);}, 5000); })(i); } On Feb 21, 4:04 pm, Alex [EMAIL PROTECTED] wrote: Hi, I am this script: for (var i=0; i 6; i++) { $('a#chan'+i).click(function(){ for (var j=0; j6; j++) { $('a#chan'+j).removeClass(chSel); } $(this).addClass (chSel); channel = i; }); } and I'm trying to get the value of i when the link is clicked and store it in the variable channel. But when I do it, it stores 6 (the max number) in it. I tried using continue; I tried using i = 7 (to break the loop, it works in Java, I guess not in Javascript). I really have no ideas. Anyone can help me real quick with that? Thanks.
[jQuery] Re: jquery and math functions
For most simple cases, I use a prefix of a unary plus to convert strings to numbers. It's short. It's easy to read once you're used to doing it. I haven't tested the speed, but it may be faster as well. typeof(1); string typeof(+1); number var startmin = (+$(timestartmin).text() ) || 0; var stopmin = (+$(timestopmin).text() ) || 0; On Feb 22, 7:26 am, Dan G. Switzer, II [EMAIL PROTECTED] wrote: Vlad, Is there something special that needs to be done to values selected with jQuery so math functions can work on them? parseInt or something? I am not sure, but all my calculations are getting NaN. For example, I have the following function that always produces NaN: var startmin = $(#timestartmin); var stopmin = $(#timestopmin); var totaltime = startmin - stopmin; $(#totaltime).val(totaltime); } I've tried adding .val to the first two lines, I've tried parseInt to separate temp variables, I just keep on getting NaN even though it is pulling numbers from the two fields. Any ideas? What type of elements are the #timestartmin and #timestopmin? Are they input elements or standard display tag (such as a div?) Depending on the type of element you're trying to parse, the parseInt/parseFloat functions may not work for you. Here's the code snippet I use in my Calculation Plugin (http://plugins.jquery.com/project/calc): /* * jQuery.fn.parseNumber() * * returns Array - detects the DOM element and returns it's value. input * elements return the field value, other DOM objects * return their text node * * NOTE: Breaks the jQuery chain, since it returns a Number. * * Examples: * $([EMAIL PROTECTED]'price']).parseNumber(); * This would return an array of potential number for every match in the selector * */ // the parseNumber() method -- break the chain $.fn.parseNumber = function(){ var aValues = []; this.each( function (){ var // get a pointer to the current element $el = $(this), // determine what method to get it's value sMethod = ($el.is(:input) ? (defaults.useFieldPlugin ? getValue : val) : text), // parse the string and get the first number we find v = $el[sMethod]().match(defaults.reNumbers, ); // if the value is null, we need use 0, otherwise we take the number // we found and remove any commas v = (v==null) ? 0 : v[0].replace(new RegExp(defaults.comma, g), ); aValues.push(parseFloat(v, 10)); } ); // return an array of values return aValues; } Here's the default structure (which defines the RegEx to use): // set the defaults var defaults = { // regular expression used to detect numbers reNumbers: /\d+(,\d{3})*(\.\d{1,})?/g, // the character that indicates the delimiter used for separating numbers (US 1,000 = comma, UK = 1.000 = period) comma: ,, // should the Field plug-in be used for getting values of :input elements? useFieldPlugin: (!!$.fn.getValue) }; The RegEx might be overkill in your case, but if you're trying to parse out numbers from elements that may contain formatting then it's going to be necessary. -Dan
[jQuery] Re: How to keep text from being highlighted when I'm handling the mouse events
I battled ie through the night. Ultimately, it won. There are many ways to address the text selection issue. I found, I think six solutions on the web. I was heavy into capturing the mouse and event propagation (the div I'm watching is a few layers deep in the hierarchy). All of the solutions, though, drastically affected my framerate and responsiveness. The message system gets gummed up and the user experiences jerks and seizures where it had been perfectly smooth and robust before. Finally, at 3am, I decided to stick with the most common solution (onselectstart returning false) and mitigate the framerate issues in other ways. It's a shame. No other browser is detrimentally affected in performance by disallowing text selection. If this happens to you, you're not nuts, or at least no more nuts than I am. On Feb 21, 5:08 pm, timothytoe [EMAIL PROTECTED] wrote: Returning false for onselectstart iseverely/i depressed my frame rate, which is ridiculous. I tried it in code, and I tried it in the html (ondragstart=return false onselectstart=return false). Either way, wham! Any way you can test to see if you were hit? Perhaps you were doing something less demanding than I am? Or on a faster PC? On Feb 21, 8:46 am, Eli_Cochran [EMAIL PROTECTED] wrote: We recently dealt with the same problem with IE on the Fluid project. We fixed it by trapping both the ondrag and onselectstart events. Note: these events only need to be trapped in IE and they are not jQuery events so you need to cast the object to a browser DOM object before trapping. Here is our code. Note that domNode is a jQuery object that was set up in an earlier function and get(0) is what casts it to a browser DOM object. if (jQuery.browser.msie) { domNode.get(0).ondrag = function () { return false; }; domNode.get(0).onselectstart = function () { return false; }; } - Eli Cochran user interaction developer ETS, UC Berkeley On Feb 20, 5:23 pm, timothytoe [EMAIL PROTECTED] wrote: Thanks. I got it to work with 2 preventDefaults (the one for IE and the one for the other browsers), but I've not tried IE6 yet, so I may yet need to have your tricks up my sleeve. Thanks. I'll get back here with a final listing of code once I'm sure I'm working on all the A- grade jQuery-supported browsers. On Feb 20, 12:07 pm, Josh Nathanson [EMAIL PROTECTED] wrote: I believe the one for IE is stopPropagation() or something like that. Also, did you try putting return false after all the other code for your mousemove? I seem to recall that helped me in a similar situation. $(#actionSurface).mousemove(function(e){ ... save off current x and y ... ... move shit around return false; --- add this }); -- Josh - Original Message - From: timothytoe [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Wednesday, February 20, 2008 11:48 AM Subject: [jQuery] Re: How to keep text from being highlighted when I'm handling the mouse events Yeah, so surprise. Doesn't work on IE. Anyone have any ideas for that browser?
[jQuery] Re: preventDefault() not working in FF?
I've just been through this. preventDefault() in mousedown will keep Firefox from selecting text as you drag. This mousemove crap is the only place in my code where I check the browser. I'm sure it depends on the functionality you're trying to block, but for me it worked something like this (code edited down a bit): $(#actionSurface).mousedown(function(e) { visHomeX=e.pageX; visHomeY=e.pageY; if (!$.browser.msie) { e.preventDefault(); //firefox's } $(#actionSurface).mousemove(function(e) { if ($.browser.msie) { //stuff you wanted to do during mousemove for ie here e.preventDefault(); //IE's return false; } //stuff you wanted to do during mousemove for firefox here return true; }); Hope I didn't botch it trying to make it clear. I noticed that in your code, you check for mousdown in mousemove. I got rid of that by adding the handler on mousedown and getting rid of it on mouseup. --TT On Feb 19, 7:43 pm, jquertil [EMAIL PROTECTED] wrote: does anyone know why the preventDefault() would work fine in IE but not in Firefox? I tired placing it elsewhere and putting it in multiple plaves - no luck... Thanks for any pointers! isMouseDown = false; $('#dragger').mousedown(function(e){ isMouseDown = true; $(document).mousemove(function(e){ e.preventDefault(); // this bit for some reason is not taken seriously by Firefox if(isMouseDown == true){ // move things... } });}).mouseup(function(e){ isMouseDown = false; });
[jQuery] Re: How to keep text from being highlighted when I'm handling the mouse events
That's an interesting thing to try. My problem is a bit more severe because the items I am moving are divs that actually have p elements attached to them as labels. Last night I looked at the jQuery solar system... http://www.willjessup.com/sandbox/jquery/solar_system/rotator.html That's an interesting demo. His planets are hyperlinks. He did that because css is willing to scale hyperlinks with font-size. Wild. He doesn't have a drag interface, so it's all kinda out-of-control. But it's cool. I notice that when you run his site in IE, you can actually drag across the planets and select them, which is pretty nasty- looking. He's saved by the fact that there's no reason for people to do that. One possible solution to my mess is to use a bitmapped font rather than mess with having p elements as part of my display. On Feb 22, 10:28 am, Karl Swedberg [EMAIL PROTECTED] wrote: Hi Timothy, sorry I'm jumping into this so late. You've probably already tried something like this, but as I was reading your last email below, I wondered if you could: 1. append a transparent gif to the body on document ready 2. make the trans.gif display: none; position:absolute; 3. when your event starts ... a. .show() the trans.gif and set its height and width to the document's height and width. b. set the z-index of the dragged element to a high number and the z- index of the trans.gif to high-number - 1. 4. .hide() the trans.gif when the action is complete so, you're basically sliding in a layer in between the thing you're dragging and the rest of the document. just a thought. Again, you may have already tried this, or rejected it for a very good reason, but I thought I'd throw it out there, just in case it might help. --Karl _ Karl Swedbergwww.englishrules.comwww.learningjquery.com On Feb 22, 2008, at 10:50 AM, timothytoe wrote: I battled ie through the night. Ultimately, it won. There are many ways to address the text selection issue. I found, I think six solutions on the web. I was heavy into capturing the mouse and event propagation (the div I'm watching is a few layers deep in the hierarchy). All of the solutions, though, drastically affected my framerate and responsiveness. The message system gets gummed up and the user experiences jerks and seizures where it had been perfectly smooth and robust before. Finally, at 3am, I decided to stick with the most common solution (onselectstart returning false) and mitigate the framerate issues in other ways. It's a shame. No other browser is detrimentally affected in performance by disallowing text selection. If this happens to you, you're not nuts, or at least no more nuts than I am. On Feb 21, 5:08 pm, timothytoe [EMAIL PROTECTED] wrote: Returning false for onselectstart iseverely/i depressed my frame rate, which is ridiculous. I tried it in code, and I tried it in the html (ondragstart=return false onselectstart=return false). Either way, wham! Any way you can test to see if you were hit? Perhaps you were doing something less demanding than I am? Or on a faster PC? On Feb 21, 8:46 am, Eli_Cochran [EMAIL PROTECTED] wrote: We recently dealt with the same problem with IE on the Fluid project. We fixed it by trapping both the ondrag and onselectstart events. Note: these events only need to be trapped in IE and they are not jQuery events so you need to cast the object to a browser DOM object before trapping. Here is our code. Note that domNode is a jQuery object that was set up in an earlier function and get(0) is what casts it to a browser DOM object. if (jQuery.browser.msie) { domNode.get(0).ondrag = function () { return false; }; domNode.get(0).onselectstart = function () { return false; }; } - Eli Cochran user interaction developer ETS, UC Berkeley On Feb 20, 5:23 pm, timothytoe [EMAIL PROTECTED] wrote: Thanks. I got it to work with 2 preventDefaults (the one for IE and the one for the other browsers), but I've not tried IE6 yet, so I may yet need to have your tricks up my sleeve. Thanks. I'll get back here with a final listing of code once I'm sure I'm working on all the A- grade jQuery-supported browsers. On Feb 20, 12:07 pm, Josh Nathanson [EMAIL PROTECTED] wrote: I believe the one for IE is stopPropagation() or something like that. Also, did you try putting return false after all the other code for your mousemove? I seem to recall that helped me in a similar situation. $(#actionSurface).mousemove(function(e){ ... save off current x and y ... ... move shit around return false; --- add this }); -- Josh - Original Message - From: timothytoe [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Wednesday, February 20, 2008 11:48 AM Subject: [jQuery] Re: How to keep text from being highlighted when I'm
[jQuery] Re: Break out of a for loop.
Obviously, There was a typo. Fixed: 1. var i; for (i=0;i5;i++) { setTimeout(function() {alert('first '+i);},5000); } 2. for (i=0;i5;i++) { (function(num) { setTimeout(function() {alert('second '+num);}, 5000); })(i); } Does that make sense?
[jQuery] Re: How to keep text from being highlighted when I'm handling the mouse events
Oh, also, I had to restrain myself to avoid tearing into his code. For example, he used atan rather than atan2, so he had to fix up the angles for a couple quadrants. I should maybe email him that tip. Once you go atan2, you never go back to atan. That code desperately wants to be optimized. :-) On Feb 22, 11:06 am, timothytoe [EMAIL PROTECTED] wrote: That's an interesting thing to try. My problem is a bit more severe because the items I am moving are divs that actually have p elements attached to them as labels. Last night I looked at the jQuery solar system... http://www.willjessup.com/sandbox/jquery/solar_system/rotator.html That's an interesting demo. His planets are hyperlinks. He did that because css is willing to scale hyperlinks with font-size. Wild. He doesn't have a drag interface, so it's all kinda out-of-control. But it's cool. I notice that when you run his site in IE, you can actually drag across the planets and select them, which is pretty nasty- looking. He's saved by the fact that there's no reason for people to do that. One possible solution to my mess is to use a bitmapped font rather than mess with having p elements as part of my display. On Feb 22, 10:28 am, Karl Swedberg [EMAIL PROTECTED] wrote: Hi Timothy, sorry I'm jumping into this so late. You've probably already tried something like this, but as I was reading your last email below, I wondered if you could: 1. append a transparent gif to the body on document ready 2. make the trans.gif display: none; position:absolute; 3. when your event starts ... a. .show() the trans.gif and set its height and width to the document's height and width. b. set the z-index of the dragged element to a high number and the z- index of the trans.gif to high-number - 1. 4. .hide() the trans.gif when the action is complete so, you're basically sliding in a layer in between the thing you're dragging and the rest of the document. just a thought. Again, you may have already tried this, or rejected it for a very good reason, but I thought I'd throw it out there, just in case it might help. --Karl _ Karl Swedbergwww.englishrules.comwww.learningjquery.com On Feb 22, 2008, at 10:50 AM, timothytoe wrote: I battled ie through the night. Ultimately, it won. There are many ways to address the text selection issue. I found, I think six solutions on the web. I was heavy into capturing the mouse and event propagation (the div I'm watching is a few layers deep in the hierarchy). All of the solutions, though, drastically affected my framerate and responsiveness. The message system gets gummed up and the user experiences jerks and seizures where it had been perfectly smooth and robust before. Finally, at 3am, I decided to stick with the most common solution (onselectstart returning false) and mitigate the framerate issues in other ways. It's a shame. No other browser is detrimentally affected in performance by disallowing text selection. If this happens to you, you're not nuts, or at least no more nuts than I am. On Feb 21, 5:08 pm, timothytoe [EMAIL PROTECTED] wrote: Returning false for onselectstart iseverely/i depressed my frame rate, which is ridiculous. I tried it in code, and I tried it in the html (ondragstart=return false onselectstart=return false). Either way, wham! Any way you can test to see if you were hit? Perhaps you were doing something less demanding than I am? Or on a faster PC? On Feb 21, 8:46 am, Eli_Cochran [EMAIL PROTECTED] wrote: We recently dealt with the same problem with IE on the Fluid project. We fixed it by trapping both the ondrag and onselectstart events. Note: these events only need to be trapped in IE and they are not jQuery events so you need to cast the object to a browser DOM object before trapping. Here is our code. Note that domNode is a jQuery object that was set up in an earlier function and get(0) is what casts it to a browser DOM object. if (jQuery.browser.msie) { domNode.get(0).ondrag = function () { return false; }; domNode.get(0).onselectstart = function () { return false; }; } - Eli Cochran user interaction developer ETS, UC Berkeley On Feb 20, 5:23 pm, timothytoe [EMAIL PROTECTED] wrote: Thanks. I got it to work with 2 preventDefaults (the one for IE and the one for the other browsers), but I've not tried IE6 yet, so I may yet need to have your tricks up my sleeve. Thanks. I'll get back here with a final listing of code once I'm sure I'm working on all the A- grade jQuery-supported browsers. On Feb 20, 12:07 pm, Josh Nathanson [EMAIL PROTECTED] wrote: I believe the one for IE is stopPropagation() or something like that. Also, did you try putting return false after all the other code for your mousemove? I seem
[jQuery] Re: preventDefault() not working in FF?
Did you see my recent thread here? My experience has been nightmarish. On Feb 22, 12:47 pm, jquertil [EMAIL PROTECTED] wrote: TT thanks a lot! for this - it works. Interesting comparison: the jQuery version of my dragger is 23 lines of code inluding all callbacks. The plain javascript version is 22 lines (but, alas, doesnt require the jQuery library of course). I also notice that while dragging, especially in firefox, the motion is a bit choppy compared to the plain javascript version. It looks like the jquery in this particualr case doesn't really offer an advantage. Next, I will try to figure out how to use the plain javascript version and make it into a plugin. I'm having problems with the document.mousemove event (what else is new).
[jQuery] Re: Why does it take so long for a new topic to be posted?
I think Google had some gas. There was a giant burp of messages a short while ago. On Feb 22, 8:41 am, gh0st [EMAIL PROTECTED] wrote: Why does it take so long for a new topic to be posted? It really is frustrating esp, if you want answers to questions.
[jQuery] Re: How do I use my functions with jQuery syntax alike?
JavaScript has really expressive ways to call functions. The first parentheses hide the function (make it anonymous) and the second executes the code immediately with the parameter listed. I'm a newbie myself, but I think that means right now, pass the variable jQuery in as $ to the function and execute the code. On Feb 22, 4:06 pm, Nazgulled [EMAIL PROTECTED] wrote: Thanks... And what's up with the: (function($) { // CODE })(jQuery); This was the thing that got me most confused when reading the documentation. Can someone explain me this, what it does, what is for and the best scenarios where would I need to use something like this? If possible, explain me like I was really dumb :P Klaus Hartl wrote: On Feb 23, 12:14�am, Nazgulled [EMAIL PROTECTED] wrote: Hi, Let's say I have 2 different javascript files. I like to organize my code that's why I use 2 different files so each file will only have functions that fall into that file's category. Anyway, here's the files layout... file1.js: function Fn1() { ... } function Fn2(a, b) { ...} file2.js function FnX(a, b, c) { ... } function FnY(a, b) { ... } function FnZ(a) { ... } How can I call those functions in a syntax like this: $.groupName.Fn1(); $.groupName.Fn2('text', 123); or jQuery.groupName.FnZ(true); How do I do this? P.S: I've read the plugins authoring documentation page but I'm still confused and I don't know how to achieve this, please advise... Something like: $.groupName = $.groupName || {}; $.extend($.groupName, { Fn1: function() { ... }, Fn2: function(a, b) { ... } }); --Klaus
[jQuery] Re: How do I use my functions with jQuery syntax alike?
The function doesn't have a name, so it doesn't pollute the namespace, and it's great for making functions inline for handlers and setTimeout() without the burden of having to make up a name that won't even be referenced. It's an outgrowth of everything being an object in JavaScript, and being able to pass any object as a parameter. A function is an object in JavaScript and can be passed as a parameter. It's very powerful. On Feb 22, 4:39 pm, Nazgulled [EMAIL PROTECTED] wrote: And what exactly it means to hide a function, making it anonymous? timothytoe wrote: JavaScript has really expressive ways to call functions. The first parentheses hide the function (make it anonymous) and the second executes the code immediately with the parameter listed. I'm a newbie myself, but I think that means right now, pass the variable jQuery in as $ to the function and execute the code. On Feb 22, 4:06 pm, Nazgulled [EMAIL PROTECTED] wrote: Thanks... And what's up with the: (function($) { // CODE })(jQuery); This was the thing that got me most confused when reading the documentation. Can someone explain me this, what it does, what is for and the best scenarios where would I need to use something like this? If possible, explain me like I was really dumb :P Klaus Hartl wrote: On Feb 23, 12:14�am, Nazgulled [EMAIL PROTECTED] wrote: Hi, Let's say I have 2 different javascript files. I like to organize my code that's why I use 2 different files so each file will only have functions that fall into that file's category. Anyway, here's the files layout... file1.js: function Fn1() { ... } function Fn2(a, b) { ...} file2.js function FnX(a, b, c) { ... } function FnY(a, b) { ... } function FnZ(a) { ... } How can I call those functions in a syntax like this: $.groupName.Fn1(); $.groupName.Fn2('text', 123); or jQuery.groupName.FnZ(true); How do I do this? P.S: I've read the plugins authoring documentation page but I'm still confused and I don't know how to achieve this, please advise... Something like: $.groupName = $.groupName || {}; $.extend($.groupName, { Fn1: function() { ... }, Fn2: function(a, b) { ... } }); --Klaus
[jQuery] Re: How do I use my functions with jQuery syntax alike?
Any time you create a function without a name it's anonymous. Example: window.setTimeout(function() { alert('Hello world!') }, 60); On Feb 22, 4:56 pm, Nazgulled [EMAIL PROTECTED] wrote: timothytoe wrote: The function doesn't have a name, so it doesn't pollute the namespace, and it's great for making functions inline for handlers and setTimeout() without the burden of having to make up a name that won't even be referenced. Can you give me an example of what you mean? I'm getting a bit confused... It's an outgrowth of everything being an object in JavaScript, and being able to pass any object as a parameter. A function is an object in JavaScript and can be passed as a parameter. Yes, I knew that, I just don't see how it relates to anonymous functions. It's very powerful. On Feb 22, 4:39 pm, Nazgulled [EMAIL PROTECTED] wrote: And what exactly it means to hide a function, making it anonymous? timothytoe wrote: JavaScript has really expressive ways to call functions. The first parentheses hide the function (make it anonymous) and the second executes the code immediately with the parameter listed. I'm a newbie myself, but I think that means right now, pass the variable jQuery in as $ to the function and execute the code. On Feb 22, 4:06 pm, Nazgulled [EMAIL PROTECTED] wrote: Thanks... And what's up with the: (function($) { // CODE })(jQuery); This was the thing that got me most confused when reading the documentation. Can someone explain me this, what it does, what is for and the best scenarios where would I need to use something like this? If possible, explain me like I was really dumb :P Klaus Hartl wrote: On Feb 23, 12:14�am, Nazgulled [EMAIL PROTECTED] wrote: Hi, Let's say I have 2 different javascript files. I like to organize my code that's why I use 2 different files so each file will only have functions that fall into that file's category. Anyway, here's the files layout... file1.js: function Fn1() { ... } function Fn2(a, b) { ...} file2.js function FnX(a, b, c) { ... } function FnY(a, b) { ... } function FnZ(a) { ... } How can I call those functions in a syntax like this: $.groupName.Fn1(); $.groupName.Fn2('text', 123); or jQuery.groupName.FnZ(true); How do I do this? P.S: I've read the plugins authoring documentation page but I'm still confused and I don't know how to achieve this, please advise... Something like: $.groupName = $.groupName || {}; $.extend($.groupName, { Fn1: function() { ... }, Fn2: function(a, b) { ... } }); --Klaus
[jQuery] Re: How do I use my functions with jQuery syntax alike?
I don't know if there's any practical difference. Maybe someone more knowledgeable can chime it. Perhaps the former ends up being a savings in file size if you have a lot of functions. On Feb 22, 5:44 pm, Nazgulled [EMAIL PROTECTED] wrote: I see, but... How is this: (function($) { $.something = function() { alert('something'); } $.test = { abc: function() { alert('test'); } } })(jQuery); Different from this: jQuery.something = function() { alert('something'); } jQuery.test = { abc: function() { alert('test'); } } Besides the syntax used of course. I mean, you simply do $.something() or $.test.abc() and it will work no matter if you coded in the first way or second... timothytoe wrote: Any time you create a function without a name it's anonymous. Example: window.setTimeout(function() { alert('Hello world!') }, 60); On Feb 22, 4:56 pm, Nazgulled [EMAIL PROTECTED] wrote: timothytoe wrote: The function doesn't have a name, so it doesn't pollute the namespace, and it's great for making functions inline for handlers and setTimeout() without the burden of having to make up a name that won't even be referenced. Can you give me an example of what you mean? I'm getting a bit confused... It's an outgrowth of everything being an object in JavaScript, and being able to pass any object as a parameter. A function is an object in JavaScript and can be passed as a parameter. Yes, I knew that, I just don't see how it relates to anonymous functions. It's very powerful. On Feb 22, 4:39 pm, Nazgulled [EMAIL PROTECTED] wrote: And what exactly it means to hide a function, making it anonymous? timothytoe wrote: JavaScript has really expressive ways to call functions. The first parentheses hide the function (make it anonymous) and the second executes the code immediately with the parameter listed. I'm a newbie myself, but I think that means right now, pass the variable jQuery in as $ to the function and execute the code. On Feb 22, 4:06 pm, Nazgulled [EMAIL PROTECTED] wrote: Thanks... And what's up with the: (function($) { // CODE })(jQuery); This was the thing that got me most confused when reading the documentation. Can someone explain me this, what it does, what is for and the best scenarios where would I need to use something like this? If possible, explain me like I was really dumb :P Klaus Hartl wrote: On Feb 23, 12:14�am, Nazgulled [EMAIL PROTECTED] wrote: Hi, Let's say I have 2 different javascript files. I like to organize my code that's why I use 2 different files so each file will only have functions that fall into that file's category. Anyway, here's the files layout... file1.js: function Fn1() { ... } function Fn2(a, b) { ...} file2.js function FnX(a, b, c) { ... } function FnY(a, b) { ... } function FnZ(a) { ... } How can I call those functions in a syntax like this: $.groupName.Fn1(); $.groupName.Fn2('text', 123); or jQuery.groupName.FnZ(true); How do I do this? P.S: I've read the plugins authoring documentation page but I'm still confused and I don't know how to achieve this, please advise... Something like: $.groupName = $.groupName || {}; $.extend($.groupName, { Fn1: function() { ... }, Fn2: function(a, b) { ... } }); --Klaus
[jQuery] Re: How to keep text from being highlighted when I'm handling the mouse events
Thanks Eli. On Feb 21, 8:46 am, Eli_Cochran [EMAIL PROTECTED] wrote: We recently dealt with the same problem with IE on the Fluid project. We fixed it by trapping both the ondrag and onselectstart events. Note: these events only need to be trapped in IE and they are not jQuery events so you need to cast the object to a browser DOM object before trapping. Here is our code. Note that domNode is a jQuery object that was set up in an earlier function and get(0) is what casts it to a browser DOM object. if (jQuery.browser.msie) { domNode.get(0).ondrag = function () { return false; }; domNode.get(0).onselectstart = function () { return false; }; } - Eli Cochran user interaction developer ETS, UC Berkeley On Feb 20, 5:23 pm, timothytoe [EMAIL PROTECTED] wrote: Thanks. I got it to work with 2 preventDefaults (the one for IE and the one for the other browsers), but I've not tried IE6 yet, so I may yet need to have your tricks up my sleeve. Thanks. I'll get back here with a final listing of code once I'm sure I'm working on all the A- grade jQuery-supported browsers. On Feb 20, 12:07 pm, Josh Nathanson [EMAIL PROTECTED] wrote: I believe the one for IE is stopPropagation() or something like that. Also, did you try putting return false after all the other code for your mousemove? I seem to recall that helped me in a similar situation. $(#actionSurface).mousemove(function(e){ ... save off current x and y ... ... move shit around return false; --- add this }); -- Josh - Original Message - From: timothytoe [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Wednesday, February 20, 2008 11:48 AM Subject: [jQuery] Re: How to keep text from being highlighted when I'm handling the mouse events Yeah, so surprise. Doesn't work on IE. Anyone have any ideas for that browser?
[jQuery] Tracking mousemove: Position inside a div
How do I get the position of a mouse within a div when I'm getting events from mousemove? If it helps, I'm already including dimensions.js for the myriad extensions that want it. I understand that I can get pageX or clientX but what I want is X inside that DIV where I have mousemove tracking on.. I want to make sure I'm getting (0,0) rock solid in the upper left corner of that div in all cases.
[jQuery] Re: Tracking mousemove: Position inside a div
Never mind. The answer has to do with jQuery's $().offset() function. I got it. On Feb 21, 12:05 pm, timothytoe [EMAIL PROTECTED] wrote: How do I get the position of a mouse within a div when I'm getting events from mousemove? If it helps, I'm already including dimensions.js for the myriad extensions that want it. I understand that I can get pageX or clientX but what I want is X inside that DIV where I have mousemove tracking on.. I want to make sure I'm getting (0,0) rock solid in the upper left corner of that div in all cases.
[jQuery] Re: How to keep text from being highlighted when I'm handling the mouse events
Returning false for onselectstart iseverely/i depressed my frame rate, which is ridiculous. I tried it in code, and I tried it in the html (ondragstart=return false onselectstart=return false). Either way, wham! Any way you can test to see if you were hit? Perhaps you were doing something less demanding than I am? Or on a faster PC? On Feb 21, 8:46 am, Eli_Cochran [EMAIL PROTECTED] wrote: We recently dealt with the same problem with IE on the Fluid project. We fixed it by trapping both the ondrag and onselectstart events. Note: these events only need to be trapped in IE and they are not jQuery events so you need to cast the object to a browser DOM object before trapping. Here is our code. Note that domNode is a jQuery object that was set up in an earlier function and get(0) is what casts it to a browser DOM object. if (jQuery.browser.msie) { domNode.get(0).ondrag = function () { return false; }; domNode.get(0).onselectstart = function () { return false; }; } - Eli Cochran user interaction developer ETS, UC Berkeley On Feb 20, 5:23 pm, timothytoe [EMAIL PROTECTED] wrote: Thanks. I got it to work with 2 preventDefaults (the one for IE and the one for the other browsers), but I've not tried IE6 yet, so I may yet need to have your tricks up my sleeve. Thanks. I'll get back here with a final listing of code once I'm sure I'm working on all the A- grade jQuery-supported browsers. On Feb 20, 12:07 pm, Josh Nathanson [EMAIL PROTECTED] wrote: I believe the one for IE is stopPropagation() or something like that. Also, did you try putting return false after all the other code for your mousemove? I seem to recall that helped me in a similar situation. $(#actionSurface).mousemove(function(e){ ... save off current x and y ... ... move shit around return false; --- add this }); -- Josh - Original Message - From: timothytoe [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Wednesday, February 20, 2008 11:48 AM Subject: [jQuery] Re: How to keep text from being highlighted when I'm handling the mouse events Yeah, so surprise. Doesn't work on IE. Anyone have any ideas for that browser?
[jQuery] Re: How to keep text from being highlighted when I'm handling the mouse events
Thanks. I got it to work with 2 preventDefaults (the one for IE and the one for the other browsers), but I've not tried IE6 yet, so I may yet need to have your tricks up my sleeve. Thanks. I'll get back here with a final listing of code once I'm sure I'm working on all the A- grade jQuery-supported browsers. On Feb 20, 12:07 pm, Josh Nathanson [EMAIL PROTECTED] wrote: I believe the one for IE is stopPropagation() or something like that. Also, did you try putting return false after all the other code for your mousemove? I seem to recall that helped me in a similar situation. $(#actionSurface).mousemove(function(e){ ... save off current x and y ... ... move shit around return false; --- add this }); -- Josh - Original Message - From: timothytoe [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Wednesday, February 20, 2008 11:48 AM Subject: [jQuery] Re: How to keep text from being highlighted when I'm handling the mouse events Yeah, so surprise. Doesn't work on IE. Anyone have any ideas for that browser?
[jQuery] Re: is there a secret to jQuery with Opera?
Safari for Windows is a pretty good browser now, especially if you want to have a good idea whether you'll run on Mac Safari (and iPhone). Is there a reason you're not testing with it as well? On Feb 20, 3:45 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Admittedly, the function in question is my own home-fudged one. It depends on: $('img src=' + '/images/thelogo.png' + '#' + Math.random() + '/ ' ).load(function() { Firefox and IE (hurrah) behave as required. Opera doesn't register the changed 'variable' (an .html() function), but loads the no-images stylesheet anyway. Do you understand why this might be? As I haven't got a Mac, I tend to trust that Opera will be at least as demanding as Safari. The thought of all Mac and Opera users getting the image-free version by default scares me to death! I haven't found any relevant documentation. I know this group houses some really hot browser experts - so am pleading for insight advice ... Cherry :/
[jQuery] Re: is there a secret to jQuery with Opera?
Yeah, the first Windows version didn't seem able to run for 5 minutes without crashing violently. I hated it. The JavaScript has gotten so fast in that browser that a nasty bit of statistics code I run takes 35 seconds on Firefox and 20 seconds in Safari, so I've really started to like Safari. :-) As for Opera, I'm having my own problems with it. It's the only browser my code isn't running on right now, and I haven't had time to figure out why. For me, it's not really Opera's fault. After all, IE causes me the most trouble by far, but I try it every couple days to make sure it's still working. Explain to me what you're doing. Doesn't Math.Random() give you a number from 0 to 1? Is that really your code? Do you really have a # in there? If so, why isn't it part of the previous string? On Feb 20, 6:22 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Aha! My good reason(s) were that an earlier beta repeatedly crashed my machine, and I'm fed up with Apple's creeping-startup-takeover strategy. But the current Safari version installed without a hitch; I guess I'll have to either live with the startups, or spend some time killing them ;) Thanks for the heads-up TT! The page looks the same in Safari as in Firefox ie (phew!). So what's up with Opera? On Feb 21, 1:54 am, timothytoe [EMAIL PROTECTED] wrote: Safari for Windows is a pretty good browser now, especially if you want to have a good idea whether you'll run on Mac Safari (and iPhone). Is there a reason you're not testing with it as well? On Feb 20, 3:45 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Admittedly, the function in question is my own home-fudged one. It depends on: $('img src=' + '/images/thelogo.png' + '#' + Math.random() + '/ ' ).load(function() { Firefox and IE (hurrah) behave as required. Opera doesn't register the changed 'variable' (an .html() function), but loads the no-images stylesheet anyway. Do you understand why this might be? As I haven't got a Mac, I tend to trust that Opera will be at least as demanding as Safari. The thought of all Mac and Opera users getting the image-free version by default scares me to death! I haven't found any relevant documentation. I know this group houses some really hot browser experts - so am pleading for insight advice ... Cherry :/
[jQuery] Re: Parallax scrolling, background foreground elements
I remember when Shadow of the Beast came out on the Amiga. Crappy gameplay, but great parallax scrolling. This is a great effect. Old Disney films used this well. Looks like 4 layers there. Anyone look at the code yet? Is there Javascript controlling the positioning or is it all CSS? On Feb 18, 9:05 am, Mika Tuupola [EMAIL PROTECTED] wrote: On Feb 18, 2008, at 5:57 PM, Ty (tzmedia) wrote: A recent site launch has a bit of a buzz surrounding the use of parallax backgrounds. When resizing the window width at: We did something vaguely similar, but not as cool and only with two layers (scroll and check the moon). It was done with JavaScript that it works great in IE and Safari, but not Firefox. But this Silverback CSS Parallax effect is awesome ! :) http://www.greenwhitechristmas.com/ -- Mika Tuupolahttp://www.appelsiini.net/
[jQuery] Re: Best plugin for modal dialogs
Why has dimensions not been dragged into the core jQuery library? So many plug-ins seem to want it that we end up with html files all over the web that ask for dimensions, slowing the loading of the page. On Feb 17, 4:39 am, Nazgulled [EMAIL PROTECTED] wrote: @Eric Martin I took your suggestion in the jQuery Google Groups and I've been testing your plugin for the past couple of hours but I'm having a few difficulties accomplishing some stuff... 1) Through out my code I call $('#EXAMPLE-ID').modal({options}) numerous times and I have a bunch of options repeating through every call. This kinda sucks... Is there a way I could configure the default options values and then simply call $('#EXAMPLE-ID).modal() and it will simply show the modal dialog with the options configured before? Also, in a way that if I want to override some of those default option values I've set, it would be nice... 2) I don't use a close 'X' button on my modal dialogs, I prefer to close the dialog manually in a different way- by clicking anywhere inside the modal dialog and for that, I bind the click() event to the respective ID. But for this to work, I need to close the modal dialog manually. I used to do the following using jqModal: $('div#popup-content').click(function() { $(this).jqmHide();}); How can I accomplish the same thing using your plugin? 3) Last but not least... I've read the documentation here on this page about the onOpen and onClose callbacks but I'm not able to do want I want. Basically I want the whole modal dialog (overlay and container) to fade in (onOpen) and fade out (onClose) at the same time, like they were just one element with, for instance, 1000ms for both animations. How can I do that? On Feb 15, 5:06 pm, Eric Martin [EMAIL PROTECTED] wrote: If you have a copy of IE6 - take a look at the demos and tests (if not, you could install a href=http://tredosoft.com/ Multiple_IEMultiple IE/a). If you are referring to the opacity of the overlay, that does work in IE6 (through the powers of jQuery). If you are asking about something else, let me know. Thanks, Eric On Feb 15, 8:45 am, Nazgulled [EMAIL PROTECTED] wrote: Your plugin looks cool and very simple... I'll have to take a deeper look though and read the whole documentation to see if it fits my needs (is configurable wnough for what I want to do). One question though... I don't if nay of the modal dialog plugins has this but: Let's say the user is using IE6, the translucent background doesn't work on this browser version, what happens with your plugin? Currently, I have a website with a modal dialog (it only displays a text message) but I'm using jQuery for it and I've done it using Javascript itself, however, for the background, I used a 4x4 gif image with 2 white pixels on the top-left corner and bottom-right corner and on the other corners, transparent pixels. Just so I could hide the content on the background, does your plugin do something like this or the translucent background will simply fail on IE6 (and other browsers that don't support it)? On Feb 15, 3:46 pm, Eric Martin [EMAIL PROTECTED] wrote: Nazgulled, Which one is best kind of questions, usually lead to: it depends. It depends on what you want to use the dialog for and what your requirements are. Back in Nov 2007, I was evaluating modal dialogs for a project I was working on. For various reasons, I ended up writing my own modal dialog plugin, SimpleModal (http://www.ericmmartin.com/projects/ simplemodal/). For me, I just wanted something that would easily display content in a modal dialog, whether it was content from the DOM, a response from an Ajax call, HTML, or a plain string. It doesn't have a bunch of bells and whistles...it just provides a simple, cross-browser compatible, interface to display data in a modal dialog. HTH. -Eric On Feb 14, 5:12 pm, Nazgulled [EMAIL PROTECTED] wrote: Hi, There are so many plugins for modal dialogs that I don't know which one should I use and/or which one is the best... I mean, if there was only one plugin of this type including all the features from all the modal plugins, that would be cool. Which one do you think it's the best and why? Care to state the pros and cons of each plugin (or the ones you know/have already tested)? That would be nice...
[jQuery] Re: Best plugin for modal dialogs
Never mind. After I posted this, I decided it made more sense to bring it up in the jQuery development list. I keep seeing dimensions being mentioned as a requirement, including in this thread. On Feb 17, 9:35 am, Nazgulled [EMAIL PROTECTED] wrote: What are you talking about? :S On Feb 17, 5:26 pm, timothytoe [EMAIL PROTECTED] wrote: Why has dimensions not been dragged into the core jQuery library? So many plug-ins seem to want it that we end up with html files all over the web that ask for dimensions, slowing the loading of the page. On Feb 17, 4:39 am, Nazgulled [EMAIL PROTECTED] wrote: @Eric Martin I took your suggestion in the jQuery Google Groups and I've been testing your plugin for the past couple of hours but I'm having a few difficulties accomplishing some stuff... 1) Through out my code I call $('#EXAMPLE-ID').modal({options}) numerous times and I have a bunch of options repeating through every call. This kinda sucks... Is there a way I could configure the default options values and then simply call $('#EXAMPLE-ID).modal() and it will simply show the modal dialog with the options configured before? Also, in a way that if I want to override some of those default option values I've set, it would be nice... 2) I don't use a close 'X' button on my modal dialogs, I prefer to close the dialog manually in a different way- by clicking anywhere inside the modal dialog and for that, I bind the click() event to the respective ID. But for this to work, I need to close the modal dialog manually. I used to do the following using jqModal: $('div#popup-content').click(function() { $(this).jqmHide();}); How can I accomplish the same thing using your plugin? 3) Last but not least... I've read the documentation here on this page about the onOpen and onClose callbacks but I'm not able to do want I want. Basically I want the whole modal dialog (overlay and container) to fade in (onOpen) and fade out (onClose) at the same time, like they were just one element with, for instance, 1000ms for both animations. How can I do that? On Feb 15, 5:06 pm, Eric Martin [EMAIL PROTECTED] wrote: If you have a copy of IE6 - take a look at the demos and tests (if not, you could install a href=http://tredosoft.com/ Multiple_IEMultiple IE/a). If you are referring to the opacity of the overlay, that does work in IE6 (through the powers of jQuery). If you are asking about something else, let me know. Thanks, Eric On Feb 15, 8:45 am, Nazgulled [EMAIL PROTECTED] wrote: Your plugin looks cool and very simple... I'll have to take a deeper look though and read the whole documentation to see if it fits my needs (is configurable wnough for what I want to do). One question though... I don't if nay of the modal dialog plugins has this but: Let's say the user is using IE6, the translucent background doesn't work on this browser version, what happens with your plugin? Currently, I have a website with a modal dialog (it only displays a text message) but I'm using jQuery for it and I've done it using Javascript itself, however, for the background, I used a 4x4 gif image with 2 white pixels on the top-left corner and bottom-right corner and on the other corners, transparent pixels. Just so I could hide the content on the background, does your plugin do something like this or the translucent background will simply fail on IE6 (and other browsers that don't support it)? On Feb 15, 3:46 pm, Eric Martin [EMAIL PROTECTED] wrote: Nazgulled, Which one is best kind of questions, usually lead to: it depends. It depends on what you want to use the dialog for and what your requirements are. Back in Nov 2007, I was evaluating modal dialogs for a project I was working on. For various reasons, I ended up writing my own modal dialog plugin, SimpleModal (http://www.ericmmartin.com/projects/ simplemodal/). For me, I just wanted something that would easily display content in a modal dialog, whether it was content from the DOM, a response from an Ajax call, HTML, or a plain string. It doesn't have a bunch of bells and whistles...it just provides a simple, cross-browser compatible, interface to display data in a modal dialog. HTH. -Eric On Feb 14, 5:12 pm, Nazgulled [EMAIL PROTECTED] wrote: Hi, There are so many plugins for modal dialogs that I don't know which one should I use and/or which one is the best... I mean, if there was only one plugin of this type including all the features from all the modal plugins, that would be cool. Which one do you think it's the best and why? Care to state the pros and cons of each plugin (or the ones you
[jQuery] Re: what editor do you use?
I just tried Komodo. Very nifty. I like how it checks JavaScript syntax and does word completion. The jQuery plugin that comes with it is old. Is there a newer one? It also is missing a PHP plugin. Where is the locations for those plugins it uses? Is the Komodo IDE worth the money? Still love PSPad, but Komodo is really cool. And, yeah, I've always liked Vim ever since it came out on the Amiga. Funny that it's still kept up to date on the Amiga. On Feb 14, 2:38 am, eitanpo [EMAIL PROTECTED] wrote: I use Komodo Edithttp://www.activestate.com/Products/komodo_edit/, it's the free version of Komodo IDE, and vi on linux On Feb 13, 6:38 pm, Feijó [EMAIL PROTECTED] wrote: I changed my own a few weeks ago, now I'm using Editpad++ (http://sourceforge.net/projects/notepad-plus/) its freeware, nice resources, like macros, quick-text, highlighted source, ... and yours?-- Feijó
[jQuery] Re: what editor do you use?
Nevermind about the PHP. It couldn't find my PHP.exe, which was in WAMP5. Still think it's kind of lame that the jQuery support is for jQuery1.1. On Feb 14, 7:30 am, timothytoe [EMAIL PROTECTED] wrote: I just tried Komodo. Very nifty. I like how it checks JavaScript syntax and does word completion. The jQuery plugin that comes with it is old. Is there a newer one? It also is missing a PHP plugin. Where is the locations for those plugins it uses? Is the Komodo IDE worth the money? Still love PSPad, but Komodo is really cool. And, yeah, I've always liked Vim ever since it came out on the Amiga. Funny that it's still kept up to date on the Amiga. On Feb 14, 2:38 am, eitanpo [EMAIL PROTECTED] wrote: I use Komodo Edithttp://www.activestate.com/Products/komodo_edit/, it's the free version of Komodo IDE, and vi on linux On Feb 13, 6:38 pm, Feijó [EMAIL PROTECTED] wrote: I changed my own a few weeks ago, now I'm using Editpad++ (http://sourceforge.net/projects/notepad-plus/) its freeware, nice resources, like macros, quick-text, highlighted source, ... and yours?-- Feijó
[jQuery] Choosing an Autocompletion solution
I searched google for jquery autocompletion and was overwhelmed by the choices. Looks like people have been borrowing heavily back and forth to get the best solution. Has anyone gone through the choices recently and selected one? If so, which did you choose and why? I'd like to use it for both local and Ajax server data.
[jQuery] Re: what editor do you use?
I tried a bunch and ended up with PSPad.
[jQuery] Re: Announce: Simple Effects Plugins on learningjquery.com
One thing I've been wondering about animate. Can you create a function for the path that something moves along? On Feb 13, 10:44 am, Karl Swedberg [EMAIL PROTECTED] wrote: Hi everyone, I don't usually announce to this list when I post something on learningjquery.com, but I figured it might be worth doing so this time, because the entry grew out of a couple questions from the list. It shows how to extend jQuery's default set of effects/animations in a simple way. Hope you enjoy it: http://www.learningjquery.com/2008/02/simple-effects-plugins By the way, Dan G. Switzer blogged about this recently, too: http://blog.pengoworks.com/index.cfm/2008/2/6/jQuery-fadeToggle-plugin Cheers, --Karl _ Karl Swedbergwww.englishrules.comwww.learningjquery.com
[jQuery] Re: Choosing an Autocompletion solution
I'll try Jörn's. The only thing that gave me pause on that one was the number of dependencies. On Feb 13, 6:15 pm, Jack Killpatrick [EMAIL PROTECTED] wrote: I also decided to use that one (Jörn's) after evaluating 4 or 5 others. As you (timothy) noticed, many of the solutions borrowed from each other, but that one seemed to have the best aggregate of features from them all and some of the others looked like they might have been stagnating. It has also proven (to me) to be quite stable and easy to work with, although I'm using client side data, not ajax-loaded data, so can't vouch for that. - Jack Diego A. wrote: I use: http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ I made this decision a few months ago, but I remember going through 4 or 5 options (I even considered writing my own), but in the end I chose the option that I thought was most likely to see future development and support. On Feb 13, 6:47 pm, timothytoe [EMAIL PROTECTED] wrote: I searched google for jquery autocompletion and was overwhelmed by the choices. Looks like people have been borrowing heavily back and forth to get the best solution. Has anyone gone through the choices recently and selected one? If so, which did you choose and why? I'd like to use it for both local and Ajax server data.
[jQuery] Re: Firefox 3 beta
It's good practice to at least know where the danger areas might be in the upcoming browsers. The more people who see these problems, the better chance we have that something crucial (like detection that the page is ready to mess with) doesn't cream a fair number of our scripts. I check my in-development site every week or so on FF3. Anyone tried a recent Webkit nightly build? Apparently the speed is dazzling. The JavaScript is running benchmarks more than twice as fast as the current Safari, and on my page on the PC, Safari is already 30% faster than any of the other browsers (I have a mathematically demanding financial website). We can expect Safari to get much faster soon. I don't think Firefox will catch up until the Actionscript JIT stuff rolls in. On Feb 9, 9:24 pm, Nguyễn Quốc Vinh [EMAIL PROTECTED] wrote: I think it don't have so many people use ff3! So, ur work ( try to force working fine under ff3) is not useful! On 08/02/2008, kenneth [EMAIL PROTECTED] wrote: ah great, that is quite good news, we will try the new release of jquery 1.2.3 wednesday, i ll keep you posted. Thx for the quick response. Kenneth On 7 feb, 18:23, John Resig [EMAIL PROTECTED] wrote: Are you .load()ing HTML with a JavaScript snippet in it? If so, then that's a bug in Firefox 3 and it will be resolved before release. Or you could use jQuery 1.2.2 and newer - which will work with Firefox 3 just fine. --John On Feb 7, 2008 5:01 AM, kenneth [EMAIL PROTECTED] wrote: Hello everybody I recently installed the new beta version of firefox 3 I thought it would accept everything we are now designing on a new website but unfortunatly it doesn't accept all jquery code. for example: .load of a specific php file in an other div doesn't seem to work anymore. This is quite a problem. Are there going to be fixes in Jquery for firefox 3? or is this a symptom that will dissapear when there is an official release of firefox? These changes are quite important for us, and i guess for thousand other users... thx in advance kind regards K -- / * Người ta thưởng chỉ chú ý đến những kẻ lên như diều gặp gió! Nhưng hỡi ôi, chỉ có cát, bụi và lông hồng mới là những thứ lên nhanh nhất */
[jQuery] Re: Is it possible to send javascript vars TO a jquery function??
This is worth a little more discussion. You're saying that we can use a div to hold variables, then jQuery can naturally deal with them. That kinda blows my mind. I'm not sure it would be very speedy, but it seems very flexible. On Feb 9, 12:41 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Feb 9, 11:43 am, cbmtrx [EMAIL PROTECTED] wrote: Thanks lihao. Actually, there are cases when there would be more than one newdiv following an olddiv...which means that the jquery .next identifier wouldn't always work. ie: It's not a 1:1 ratio. So I've been trying to find the most simpleelegant solution, without resorting to the old javascript functions... You probably can use a container DIV to each group of a/ and new/old DIVs, then you can handle variable number of inside DIVs with jQuery more easily. From what little I've learned so far, jquery seems to work mostly in one direction (JQ - DOM) and it doesn't seem all that geared up for doing things the other way around (unless you use a plugin like metadata for passing vars, which isn't any simpler). I think, we don't have to isolate jQuery from original Javascript, we can still customize javascript functions and just use jQuery's great feature of parsing DOM. From my understanding, as long as your data is in DOM, you can always use jQuery to find them. so for the above metadata example, we can use the tricks mentioned in Smith's post(for simple cases, we don't really need a plugin), for example, we can use 'class' to deliever parameters and then use 'eval' and jQuery's feature to extract these data: div id=test a href=# class={va : 'eee', vb : '1'}click1/a | a href=# class={va : 'fff', vb : '2'}click2/a | a href=# class={va : 'ggg', vb : '3'}click3/a pva : span/span /p pvb : span/span /p /div script type=text/javascript var $DIV = $('div#test'); $('a', $DIV).click(function() { var metadata; eval( metadata = + $(this).attr('class') ); $('span:eq(0)', $DIV).html(metadata.va); $('span:eq(1)', $DIV).html(metadata.vb); }); /script We don't have to use the 'class' attribute though, we can use 'title' or else for this trick :-) Regards, lihao(XC)
[jQuery] Re: Is it possible to send javascript vars TO a jquery function??
Besides the Metadata plugin, there's also a plugin called Collection that looks interesting. http://plugins.jquery.com/project/Collection
[jQuery] Re: Is it possible to send javascript vars TO a jquery function??
Just what is a jQuery collection that we pass along into jQuery? I feel like I'm missing something to be able to use jQuery for my own data. On Feb 9, 8:43 am, cbmtrx [EMAIL PROTECTED] wrote: Thanks lihao. Actually, there are cases when there would be more than one newdiv following an olddiv...which means that the jquery .next identifier wouldn't always work. ie: It's not a 1:1 ratio. So I've been trying to find the most simpleelegant solution, without resorting to the old javascript functions... From what little I've learned so far, jquery seems to work mostly in one direction (JQ - DOM) and it doesn't seem all that geared up for doing things the other way around (unless you use a plugin like metadata for passing vars, which isn't any simpler). Emlyn On Feb 8, 11:35 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Feb 8, 4:08 pm, cbmtrx [EMAIL PROTECTED] wrote: OK, I'll need to look into this click event. If it's worth rewriting (because the original degrades poorly) then I'll probably do it this way. Was hoping jquery would simplify!! :/ For your sample code, you don't need that javascript link, you can just define 'click(toggle)' event for a / element and then trigger it in input / elememt's 'click' event. using 'class' instead of 'id' and letting jQuery help you find corresponding DIVs can make your code simpler (you can extend this into more than 2 groups easily): !--ONE-- a href=#Open 1/a div class=olddiv Default page content /div div class=newdiv form New page content input type=button value=Close / /form /div !--TWO-- a href=#Open 2/a div class=olddiv Default page content /div div class=newdiv form New page content input type=button value=Close / /form /div script type=text/javascript $('a').toggle(function() { $(this).next('div.olddiv').hide() .next('div.newdiv').show(); }, function() { $(this).next('div.olddiv').show() .next('div.newdiv').hide(); }); $('[EMAIL PROTECTED]Close]').click(function() { $(this).parents('div.newdiv').prevAll('a:first').click(); }); /script Regards, lihao(XC)
[jQuery] Re: JQuery takes 80% of my core2Duo proc on DOM element inserts
According to that test, array and join is almost 6 times as fast as string concat in my browser (Firefox on Vista). On Feb 6, 4:37 pm, J Moore [EMAIL PROTECTED] wrote: I've heard a few people mention the building an array and then using .join(''). I found that good-old-fashioned string concatenation was faster - and the syntax a bit cleaner. There's a neat test on this page. The joining arrays seems is a bit slower for me. (Firefox on OS X) http://www.quirksmode.org/dom/innerhtml.html Is joining arrays (i.e. the innerHTML 2 test) faster for you? -j On Feb 6, 1:37 pm, polyrhythmic [EMAIL PROTECTED] wrote: You will have an easier time creating a single append by ,join() -ing an array of elements and adding them as a block. Forcing jQuery to evaluate each one individually creates a lot of repetition. The .domManip() code in the source is pretty legible, if you're curious. Charles On Feb 5, 3:00 am, George GSGD [EMAIL PROTECTED] wrote: I think it's generally proven that inserting dom objects is much slower than innerHTML, for the kind of inserting you're trying, that might be worth investigating... On Feb 4, 1:57 pm, Ashish [EMAIL PROTECTED] wrote: Hi , I am very new to jquery. I am using jquery 1.2.2 . I use jquery tablesorter to insert around 400 rows to a table. The data is collected using an Ajax call. When new rows are inserted to the table the CPU utilization shoots up to 80%. All browsers freeze until the table is populated :( I tried to insert 400 divs to a single div and faced the same problem. This rules out a problem with tablesorter. Does jquery attach a lot of handlers to dom events that make appends very slow ? Any suggestions would be much appreciated. Thanks and regards, - Ashish
[jQuery] Re: Fighting a closure
Thanks for all the examples. I was able to find a couple ways on my own, but I love to see how other people solve these problems so I can learn new techniques. Hardest thing for me when in JavaScript is taking my mind out of C and PHP. Shared syntax is a blessing and a curse.
[jQuery] Re: Fighting a closure
I ended up using this. I liked it much better than my previous solution (passing in this and then stripping the digit out in the handler). $.each( [0,1,2,3,4], function(index, num) { $(#port+num).click(function() { bigchart(num); }); }); This one is easy for me to read, comprehend, and maintain. And having it around in my code will be a good way for me to keep the jQuery .each in mind. This next one is obviously a work of JavaScript art (as opposed to the former, which is a more jQuery solution). Does anyone want to explain it? for ( i=0;i5;i++ ) { (function(num) { $(#port+num).click(function() { bigchart(num) }); })(i); }
[jQuery] Re: Fighting a closure
Ah, that makes sense. Thanks. On Jan 31, 4:04 pm, Danny [EMAIL PROTECTED] wrote: Depends on what you're trying to do. In your case, the index and the value are identical, but next time they may not be: $.each( ['a','b','c'], function (index, val){ // index is 0...1...2, val is 'a'...'b'...'c' }); On Jan 31, 3:40 pm, timothytoe [EMAIL PROTECTED] wrote: $.each( [0,1,2,3,4], function(index, num) { $(#port+num).click(function() { bigchart(num); }); }); Wait. What's the index in there for. I don't need that, do I? Seems to work fine without it. I'll assume that was a leftover from a previous idea.
[jQuery] Fighting a closure
This code works... $(#port0).click(function() {bigchart(0)}); $(#port1).click(function() {bigchart(1)}); $(#port2).click(function() {bigchart(2)}); $(#port3).click(function() {bigchart(3)}); $(#port4).click(function() {bigchart(4)}); Naturally, I want to do this: var portname=#port+i;
[jQuery] Fighting a closure
I think I submitted a half-done version of this message by accident a few minutes ago. Sorry. This works: $(#port0).click(function() {bigchart(0)}); $(#port1).click(function() {bigchart(1)}); $(#port2).click(function() {bigchart(2)}); $(#port3).click(function() {bigchart(3)}); $(#port4).click(function() {bigchart(4)}); I try to roll it up like this: for (i=0;i5;i++) { $(#port+i).click(function() {bigchart(i)}); } But the closure gets me. When the function is called, i is 5 for any of the buttons. What is the elegant solution here?
[jQuery] Re: help optimizing code
Have you tried Firebug's profiler? That's what I use. On Jan 19, 12:39 pm, cjl [EMAIL PROTECTED] wrote: Is there any way to 'profile' the javascript as I try to optimize it, to find out where the slow bits are? -CJL
[jQuery] Re: help optimizing code
If Firebug is new to you, you're about to fall in love. Be sure to check out the various online tutorials. On Jan 19, 5:03 pm, cjl [EMAIL PROTECTED] wrote: Also, TT, thank you, firebug is exactly what I was looking for! -CJL
[jQuery] Re: Horizontal mouse scroll wheel
It would be cool if shift-mousewheel or alt-mousewheel did that. The trick is you'd always have to tell the user how to do it. The touchpad on my laptop allows horizontal scrolling if you drag left- and-right along the bottom of the page, so it would be nice if jQuery could pick that up. And my Dad once had a mouse with both horizontal and vertical scrollwheels. It was great for big Excel spreadhseets. On Jan 17, 5:56 am, Martin Berglund [EMAIL PROTECTED] wrote: Hi everybody! (my first post in this group) I was surfing around some typography related sites today, and I came across a site that was designed horizontally. a hrefhttp://www.itamarlerner.com/;This site/a (not my site) made me wonder if there is an easy way to assign the x-axis to the mouse scroll wheel? The behavior may not be as intuitive as the vertical scroll, but it would be cool if it is possible. - Martin
[jQuery] Re: OT: Networking Vista Home/Home Premium and Leopard
I ended up upgrading my Vista computer to XP. On Jan 17, 4:33 pm, Rick Faircloth [EMAIL PROTECTED] wrote: Or an even better solution (if it works in your case) might be this approach rather than totally diabling the UAC: http://www.howtogeek.com/howto/windows-vista/disable-user-account-con... / Rick From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Andy Matthews Sent: Thursday, January 17, 2008 4:52 PM To: [jQuery] Subject: [jQuery] OT: Networking Vista Home/Home Premium and Leopard Who would have thought that this would be such a difficult task. My wife's computer must be able to read and write files on my MacMini. She can see the Mini in the network list. She can even browse as far as my user directory. But she cannot access any of the directories inside (Music, Pictures, Documents, etc.). Each time she tries to open one of those, she gets an access denied error. The problem is that she's not even prompted for a login. I can get to the Mac Mini from my XP box without issue. I get the login box, enter the credentials, and I'm in. So I did some research last night and it appears that her version of Vista does not even have the necessary application to allow her to login to a Mac computer from Vista. There appear to be some workarounds, but I wanted to first ask you guys if any of you have had luck getting this to work. One of the solutions I found requires a program called gpedit.msc, which is the piece which is NOT on her computer. I need to get this going as soon as possible. Anyone have any ideas/solutions? Andy Matthews Senior ColdFusion Developer Office: 877.707.5467 x747 Direct: 615.627.9747 Fax: 615.467.6249 [EMAIL PROTECTED]http://www.dealerskins.com/ image001.jpg 47KViewDownload
[jQuery] Re: Reverse IP Lookup
It's reasonably easy to get it down to a zipcode. But beyond that I don't think it's possible. IPs are way too dynamic. --tt On Jan 17, 6:12 pm, Glen Lipka [EMAIL PROTECTED] wrote: Sorry, research on this topic has just left me desperate. I need to find a commercial company that provides a Reverse IP Lookup as a web service. So I would pass: 63.82.2.35 and it would spit back ideally: Marketo, Address, City, State, Zip etc. Anyone have experience with this kind of service? Email me offline. Thanks, Glen
[jQuery] Re: 1.2.2 Released 20 minutes ago
Beta testers: How stable is this? Should I switch from 1.2.1 yet? On Jan 14, 8:23 pm, Up-Works [EMAIL PROTECTED] wrote: http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.2.2
[jQuery] Re: [ANNOUNCE] Cornerz - Bullet Proof Curved Corners using Canvas/VML
What problems are you having specifically? I know there is a subpixel rendering problem. I'm assuming the subpixel rendering is what is causing the ugly black lines on the left and right side of the border:1 display: inline example. I'd probably use this if the IE problem gets fixed. Very pretty in the other browsers.
[jQuery] Consideration for processor-intensive JavaScript jQuery applications
I have a JS app that does a lot of calculations. I'm having trouble keeping the browser responsive. My current solution is to take apart loops that last a long time and make them into functions that call themselves with setTimeout(). (As far as I can tell, you HAVE to do this to keep the browser from alerting the user that a script is unresponsive and perhaps should be shut down). Is that what other people are doing? Trying to have smooth animations and jQuery effects during the processing just doesn't work out. The only thing I can think of is to stop processing, start the effect and use the effect callback to restart the processing. Again, is this what other people are doing? Anyone doing something more clever? I'm assuming there is no priority system that can keep the UI stuff above the processing stuff.
[jQuery] Re: Processor-intensive JavaScript considerations
Somehow I missed you reply and started another similar thread today. Sorry. I'm still getting used to Google Groups.
[jQuery] Processor-intensive JavaScript considerations
I have an application that is very processor-intensive. It can takes up to a minute to run. In order to keep the browser from bringing up a dialog that asks the user if he or she wants to bail, I break the work into chunks that are chained together with setTimout(). I'm having trouble getting smooth jQuery animations to happen during this processing, so I've just gone with intermittent graphic updates (like moving the progress bar). Is there any way to get smooth animation while JavaScript is thinking hard? Should I be doing this some other way than breaking the work up into setTimer chunks? I'm a novice with JavaScript timers. Am I missing some timer functions I should know about? Any way to make sure animations (such as fadeIn()) go smoothly? Aside: Safari has an incredibly fast JavaScript interpreter. What takes 20 in Safari takes 30 in FF and 40 in IE.
[jQuery] Re: Debug Tools - Charles, DebugBar, Firebug Lite
Chicks dig it. On Jan 3, 4:17 pm, Rick Faircloth [EMAIL PROTECTED] wrote: Ream Men just have to know... How does developing in FF increase you reproductivity ? :o) Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Eridius Sent: Thursday, January 03, 2008 6:58 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Debug Tools - Charles, DebugBar, Firebug Lite I would never in a million years choose to develop in IE first and then FF, there are just so many tools in FF that increases my reproductivity it would be slower for me to try to debug first in IE for the issue that FF would let me catch easier and faster.- Hide quoted text - - Show quoted text -
[jQuery] Re: Debug Tools - Charles, DebugBar, Firebug Lite
There is a three-IE package, I believe, that runs multiple IEs under Wine in Linux. I know that a few people use that. --TT On Jan 3, 3:07 pm, cfdvlpr [EMAIL PROTECTED] wrote: How do you test in both IE 6 and IE 7? Are you able to install both these on the same machine or do you have more than one machine? We do most of our testing for IE 6 and IE 7 using browsercam. Unfortunately, there's no debugging tools on their machines. :( On Jan 3, 2:20 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote: ... But for me, it's no problem to test new applications in IE6, IE7, FF2, Opera and (ever since I picked up a Mac) Safari. ... JK
[jQuery] Re: Debug Tools - Charles, DebugBar, Firebug Lite
Who are the 1.6% of people using IE5? Do those people actually expect Web 2.0 sites to work?
[jQuery] Re: Debug Tools - Charles, DebugBar, Firebug Lite
It's silly to rail against standards. Yes, we still have to support IE6. But IE8 is moving towards standards compliance and eventually that's what we'll be writing for. We know how this game works. New features show up in new browsers, but we can't use them for a few years until the new browsers are old, or until someone writes a library that gives the old browsers the new standards. Now that a Google employee has made a Canvas emulator for IE, we have nifty things like Flot for jQuery. Learn to write for standards now, and you'll have a leg-up later. Or just wait and learn later. Doesn't matter to me. But there's a reason to encourage all the browsers to aim at the standards.