[jQuery] Re: callbacks calling callbacks calling callbacks ....
I did a little search and came across this page: http://www.soapatterns.org/asynchronous_queuing.asp While it may not appear to be an exact answer, it does tend to suggest some possibilities here. For instance, if each of the Ajax requests were added to a queue for processing, and the queue handles everything and fires an event/callback when it's done. This is similar in some ways to what I suggested earlier, but maybe a little more robust in the approach. Still digging. Shawn Shawn 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 exactly this nesting looks fine with no real code behind but it is just cruel if you imagine having error-handling, rollbacks and business logic etc within. what im looking for is some pattern abstracting the async-callbacks or just a real-world example/solution of someone having the same issues with logic involving multiple, dependent ajax-calls. thanks, kai
[jQuery] jqGrid final preview
Hi all, At end I have done a lot of work to finalize the jqGrid. More information you can found here http://www.trirand.com/blog Note that this is not official release, since of missing documentation. I'm working hard on this and hope to finish the documentation at end of week. Enjoy Tony
[jQuery] Re: jqGrid final preview
Sorry, Forgot to give a link to the new demos http://www.trirand.com/gridpreview/jqgrid.html See the new Live Data manipulation examples Tony On Mar 7, 11:07 am, Tony [EMAIL PROTECTED] wrote: Hi all, At end I have done a lot of work to finalize the jqGrid. More information you can found herehttp://www.trirand.com/blog Note that this is not official release, since of missing documentation. I'm working hard on this and hope to finish the documentation at end of week. Enjoy Tony
[jQuery] Re: jqGrid final preview
Nice job Tony, i like jqGrid ! Matthieu 2008/3/7, Tony [EMAIL PROTECTED]: Sorry, Forgot to give a link to the new demos http://www.trirand.com/gridpreview/jqgrid.html See the new Live Data manipulation examples Tony On Mar 7, 11:07 am, Tony [EMAIL PROTECTED] wrote: Hi all, At end I have done a lot of work to finalize the jqGrid. More information you can found herehttp://www.trirand.com/blog Note that this is not official release, since of missing documentation. I'm working hard on this and hope to finish the documentation at end of week. Enjoy Tony
[jQuery] Pass a parameter to $.ajax's success callback?
Here's the scenario. I'm writing a routine that will take in a list of items. Each item will fire an Ajax request and the resulting data is placed into a variable identified in the items properties. Looping over the items to do the Ajax call results in the LAST item's variable being updated. This makes sense in that the callback happens after the loop has completed. So the question is how do I have the callback set the correct variable? Here's some sample code if it helps: //loop over each item and set the data as needed. for (var x = 0; x options.items.length; x++ ) { var i = options.items[x]; if (!i.ajaxparams) { return; }; var macb = function (data) { queueData[i.dataname] = data; checkComplete(); } i.ajaxparams.success = macb; $.ajax(i.ajaxparams); } } The problem is the macb function - specifically the use of the i.dataname. This works great if I have ONE ajax item. But adding two (say for names and scores) only sets the last dataname seen in the loop. doing the var i = *should* have prevented this, but isn't. (and my brain is mush right now). So the next option is to pass in the dataname value to the callback function. Except I don't see any possible way to pass extra data to the callback. Is there a better way to handle this? I'm afraid the obvious answers probably aren't suitable in this case. Unless my brain is worse off than I thought right now. Thanks for any tips. Shawn ps. I snipped a little bit from the above code. There's logic to check if a success function is specified in the ajaxparams and if so use it's return value to set the queueData property.
[jQuery] Re: How to animate remove() and html() ?
You can do a similar thing with show (or fadeIn, etc). $('divText/div') .hide() .appendTo(somewhere) .fadeIn(1000); Thanks guys! And sorry about asking questions when I know the answer. It must be because I'm working 16h/day while sleeping 5h/day since 2 weeks. My brain is slowly freezing. And I must admitt thhhhh ,rkkka Rzzz -- Fabien Meghazi Website: http://www.amigrave.com Email: [EMAIL PROTECTED] IM: [EMAIL PROTECTED]
[jQuery] Re: Pass a parameter to $.ajax's success callback?
Shawn Look at this: http://plugins.jquery.com/project/ajaxqueue Maybe will solve the problem or use ajax with option async = false Regards Tony On Mar 7, 12:16 pm, Shawn [EMAIL PROTECTED] wrote: Here's the scenario. I'm writing a routine that will take in a list of items. Each item will fire an Ajax request and the resulting data is placed into a variable identified in the items properties. Looping over the items to do the Ajax call results in the LAST item's variable being updated. This makes sense in that the callback happens after the loop has completed. So the question is how do I have the callback set the correct variable? Here's some sample code if it helps: //loop over each item and set the data as needed. for (var x = 0; x options.items.length; x++ ) { var i = options.items[x]; if (!i.ajaxparams) { return; }; var macb = function (data) { queueData[i.dataname] = data; checkComplete(); } i.ajaxparams.success = macb; $.ajax(i.ajaxparams); } } The problem is the macb function - specifically the use of the i.dataname. This works great if I have ONE ajax item. But adding two (say for names and scores) only sets the last dataname seen in the loop. doing the var i = *should* have prevented this, but isn't. (and my brain is mush right now). So the next option is to pass in the dataname value to the callback function. Except I don't see any possible way to pass extra data to the callback. Is there a better way to handle this? I'm afraid the obvious answers probably aren't suitable in this case. Unless my brain is worse off than I thought right now. Thanks for any tips. Shawn ps. I snipped a little bit from the above code. There's logic to check if a success function is specified in the ajaxparams and if so use it's return value to set the queueData property.
[jQuery] Will latest version of TableSorter work with its Pager?
Hi All, Summary - Ultimately I'd like a table that can be generated client-side, is sortable, can be updated, and paged through. I have already got the generation, updating and sorting working. - I use TableSorter to do the sorting, and I'd like to use its addon plugin Pager. http://tablesorter.com/docs/ I'm using the latest version of TableSorter http://dev.jquery.com/ browser/trunk/plugins/tablesorter/jquery.tablesorter.js?format=txt but the Pager addon plugin that comes with this has not been updated yet. Does anyone know if this will be updated too? The issue seems to be that 'table.config' is no longer accessible in jquery.tablesorter.pager.js - presumably this was set in the current version of jquery.tablesorter.js, but not in the new version. The reason I'm using the latest version, and not the released version is that I have a table that looks like this: table id=dlHistory thead trthTitle/ththBought/ththSize/ththStatus/th/tr /thead tbody tr id=row_1231 td sortBy=my episode name div id=mediaSeries_1231My Series: Season 2/div div id=mediaEpisode_1231Episode 6: my episode name/div divsome other stuff/div /td tdspan id=mediaSize_1231366 MB/span/td tdspan id=mediaPurchase_123103/03/08/span/td td sortBy=Processing div id=mediaStatus_1231downloading.../div divsome other stuff/div /td /tr ... and repeat ... /tbody /table I want to sort by Episode and Status, so I've added a 'sortBy' attribute to the 1st and 4th TD tags, containing the text to sort by: $('#dlHistory').tableSorter({ textExtractionType: ['sortBy'], disableHeader: [1,2] }); - note the new way of calling tableSorter (rather than tablesorter), which has changed between release latest versions. So far, so good, and it all works quite cheerfully. To make it even more complicated, this table is actually constructed by a client-side XML/XSLT transformation, and the result is pushed into a div wrapper. Finally each row is constantly updated at various stages, either by being amended, deleted, or adding new rows. $('#dlHistory tbody').prepend(newRow); // add $('#row_'+LibId).remove(); // delete $('#row_'+LibId).replaceWith(updateRow); // replace So, to go back to my original question, is Christian Bach still working on this (great) plugin? It's working a treat so far, and I'd really like to get the paging working too. If I go back to the current (release) version of tablesorter, I'm not convinced I could get my custom sorting working correctly. Would I be correct in thinking that I should be looking at tablesorter.addParser to look at the Title column and try to extract the my episode name text? And then do roughly the same thing on the Status column? So any help would be much appreciated. Thanks! rob
[jQuery] Re: How to know if the entire page has loaded, AFTER it has loaded? [advanced]
As far as I know, document.ready will execute functions right away if the dom is ready. Also you can use: if( jQuery.isReady ). On 6 mar, 17:46, Iair Salem [EMAIL PROTECTED] wrote: Hello everyone, I have a problem The basics: $(document).ready(function(){alert(DOM Loaded)}); $(window).load(function(){alert(Full Page Images Loaded)}); But, what happens if I do this?: $(window).load(function(){ setTimeout(foo(), 2000); ); function foo(){ $(window).load(function(){alert(this alert will never occur)}); / *calling window load() after it has been called once results in nothing happening*/ } This beaviour isn't the same as $(document).ready, because $ (document).ready is handled by jQuery, and jQuery sets jQuery.isReady = true, and calls it inmediately. Maybe I'm asking for the property jQuery.isPageLoaded which would tell me if the entire page has loaded, also AFTER the page has loaded (for example in a click event). There is a dirty workaround: var isPageLoaded = false; $(window).load( function(){ isPageLoaded=true;} ); This will workaround the problem and fix it partially (because in theory this won't work when loading scripts dinamically) If you have a better solution, please share it with the group. Thank you, Iair Salem
[jQuery] Re: Targeting pseudo classes with jQuery
On Thu, Mar 6, 2008 at 4:57 PM, TheOriginalH [EMAIL PROTECTED] wrote: I have a menu which is working nicely. When an item is clicked, I'm using jQuery to change the CSS color to indicate it is current. To keep things neat, I have also changed the color of all similar items back to the default (otherwise ALL items would be highlighted as you went through the menu. I think addClass() and removeClass() are a better fit here than css(). Ex: menuItems.filter('.current').removeClass('current'); // or oldItem.removeClass('current'); newItem.addClass('current'); Then you can simply have a different css rule for .current:hover, no? - Richard Richard D. Worth http://rdworth.org/
[jQuery] Re: problems with event triggering in IE6, presumably 5.5 as well.
I actually started with hover, with something along the lines of... -(snip) $(#trigger_news).hover( function () {$(#news).addClass(news_on);}, function () {$(#news).removeClass(news_on);$ (#news).addClass(news);}); -(/snip) ...which sadly wound up producing the same result. This is using jQuery 1.2.3. On Mar 6, 5:34 am, h0tzen [EMAIL PROTECTED] wrote: use jquerys specific hover-method which workarounds the browser- failures of mouseover/mouseout. in the recent jquery-plugin there are also new virtual events mouseenter, mouseleave i think, which wrap mouseouver and mouseout and are used by hover() $(elem).hover(overFn, outFn)
[jQuery] Current element position on sort change
Is there a way I am able to find out what position the dragged element is in.. IE: i have 5 list elements which are sortable, i drag element 4 into position 2. I need to update a referenced list with the new sort order. thanks.
[jQuery] Using JQuery Effects in Parent Window from iFrame?
Hello, I have a simple HTML file with an iframe. Inside the iframe is a simple submission form. I would like to be able to click Submit and have Jquery append content to a div that is outside of the iframe. I have exhausted my knowledge of parent heirarchy in JS trying to find a solution. I couldn't find a solution in the Wiki or on Google. Any help is appreciated, Andrew
[jQuery] Re: callbacks calling callbacks calling callbacks ....
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 exactly this nesting looks fine with no real code behind but it is just cruel if you imagine having error-handling, rollbacks and business logic etc within. what im looking for is some pattern abstracting the async-callbacks or just a real-world example/solution of someone having the same issues with logic involving multiple, dependent ajax-calls. thanks, kai- Hide quoted text - - Show quoted text -
[jQuery] Sortable Element Position
Hi, I'm trying to figure out how i can get the current element position of a sortable list after drag has complete. Should i be using traverse for this?? code example: the second alert gives me -1 as an index. ie: ul id=foolivalue/lilivalue/lilivalue/li/ul $(#foo).sortable({update:function(e) { alert(e.target.id); alert($(foo).index(e.target)); } });
[jQuery] Using JQuery Effects in Parent Window from iFrame?
Hello, I have a simple HTML file with an iframe. Inside the iframe is a simple submission form. I would like to be able to click Submit and have Jquery append content to a div that is outside of the iframe. I have exhausted my knowledge of parent heirarchy in JS trying to find a solution. I couldn't find a solution in the Wiki or on Google. Any help is appreciated, Andrew -- View this message in context: http://www.nabble.com/Using-JQuery-Effects-in-Parent-Window-from-iFrame--tp15885517s27240p15885517.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: best web 2.0 ads and mailings ?
Sure! Could you review http://www.ZoToDo.com? It's a simple daily to do list organizer, I just finished up :) -Venkat On Feb 28, 11:24 am, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: Hi all This is quite an off topic question, I hope it wont be moderated. I would like to review nice ads and mailings that are promoting web 2.0services from webagencies or hosting companies. I am especially interested in material targeted at a non-specialist audience. Have you links for me ? thanks -Olivier
[jQuery] getJSON data problem for getting youtube json data
Hi , I want to get the json data from the youtube api (http:// code.google.com/apis/youtube/developers_guide_protocol.html). My code is like : url=http://gdata.youtube.com/feeds/api/videos?format=1vq=catstart- index=10max-results=20orderby=viewCountalt=json; $.getJSON(url,callBackFucntion); function callBackFucntion () { // here parse the json data } But i got an error when i run this code. [Exception... 'Permission denied to call method XMLHttpRequest.open' when calling method: [nsIDOMEventListener::handleEvent] nsresult: 0x8057001e (NS_ERROR_XPC_JS_THREW_STRING) location: unknown data: no] so agian i change the url and add the callback parameter with ? : url=http://gdata.youtube.com/feeds/api/videos?format=1vq=catstart- index=10max-results=20orderby=viewCountalt=jsoncallback=?; $.getJSON(url,fucntion (data){ // parse json data alert ('json data get'); }); This time i do not get error . But i do not get the call back So how can i get the json data problem Thanks Saidur Rahman
[jQuery] Re: Targeting pseudo classes with jQuery
Rather than setting CSS attributes directly, use classes. Eg, with hover: $('.someElements').click(function() { $('.someElements').removeClass('aSelected'); $(this).addClass('aSelected'); } $('.someElements').hover( function(){ $(this).addClass('aHover') }, function() { $(this).removeClass('aHover'); } ); This should solve your problem. On Mar 7, 10:57 am, TheOriginalH [EMAIL PROTECTED] wrote: I have a menu which is working nicely. When an item is clicked, I'm using jQuery to change the CSS color to indicate it is current. To keep things neat, I have also changed the color of all similar items back to the default (otherwise ALL items would be highlighted as you went through the menu. Unfortunately this has the side effect of killing the natural css hover pseudo class :( I've messed with the .hover function, but the implementation I've used then kills the coloring on click (as when you mouse away from hover, it returns to the default). Anyone come across this and know how to fix it? TIA, H
[jQuery] Checkbox click event fires more than once
Hey All, I'm trying to dynamically add a list of check boxes (and an associated click event handler) to my page. Problem is, when I click on a box, the event is fired multiple times (once per checkbox on the page). I don't really understand this behaviour - the event should only fire once. I would graciously appreciate any suggestions you may have. Regards Patrick Code snippit : script type=text/javascript $(function() { $.ajax({ type: GET, url: ./?get=Lignes, dataType: xml, cache: false, success: function(xml){ $(xml).find(Lignes).each(function() { var line = $(this); $(#filters) .append(input type='checkbox' value= + line.attr(ID) + ) .click(function() { $(#map).append(wtf??).append(br/); return false; }) .append(line.attr(Nom)).append(br/); }); } }); }); /script
[jQuery] Problem with Lightbox plugin (background-shadow)
Hi. I have some problems with the jQuery plugin Lightbox. I would like to do a reference page for my webprojects with the Lightbox. The problem is, that that the background-shadow doesn't appear over the hole screen when i use an big image. You can see the effect on: http://10.0.0.1/movido.com/de/webdesign-referenzen.html Scroll to the bottom of the page and click on the last reference logo (rieglerhütte). I guess the problem could be solved by setting the background-shadow again, when the image is complete loaded. But I'm quite new in jQuery so i don't know how i can do this. Can anybody help me to fix this problem? I would be deeply grateful. cu, kisi
[jQuery] New way to hover and first-child in IE6
Hi people, my first post and i want that you see this new way to hover and first-child in IE6: http://elmicoxcodes.blogspot.com/2008/03/new-way-to-hover-and-first-child-in-ie6.html What you think about this?
[jQuery] Re: How to animate remove() and html() ?
Remove: $('#someElement').hide('slow').remove(); Html: .html() isn't suitable - ie what does it mean to 'slowly' change the html content of an element?? Perhaps a typing effect, or cloning a div, changing the content then fading the original - but these would be specialised effects that you should code yourself. On Mar 7, 3:04 pm, Fabien Meghazi [EMAIL PROTECTED] wrote: Is there a way to animate remove() and html() like it's possible to hide(slow) ? -- Fabien Meghazi Website:http://www.amigrave.com Email: [EMAIL PROTECTED] IM: [EMAIL PROTECTED]
[jQuery] [validate] check select on change instead of on focus?
I just started using the grate validate plugin today and I can't really find an example of what I'm trying to customize... Basically, I think it's confusing for a select element to change on focus instead of on change, meaning: the user forgets to select an option, the drop down is highlighted with some CSS, so use selects an option, but CSS error styling doesn't go away until the user clicks somewhere else on the page... A minor gripe, but I'm a big believer of the Steve Krug don't make me think school ;) Any suggestion or pointer on how to do that would be greatly appreciated. I'm still not quite clearly on how to implement own customizations of this plugin even after going through the docs... Thanks!
[jQuery] Re: neewbe help, Bassistance Validation Plugin
I haven't used the validation plugin myself so I can't really say much about how it works internally. Can't you simply use the errorPlacement option to put the error messages in hidden balloons belonging to the respective fields, and then show/hide them using regular onfocus events? - Original Message - From: Alexsandro_xpt [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Thursday, March 06, 2008 1:46 PM Subject: [jQuery] neewbe help, Bassistance Validation Plugin Hello all, It's my second time I post here, I hope help me. My problem is about Bassistance Validation Plugin. I wish use a ballon to show the error message for each onfocus input elements. But I can't manipulate onfocusin event. Someone can help? I do some thing here. see: blog.alexsandro.com.br/aa.htm [] Alexsandro
[jQuery] Re: How to know if the entire page has loaded, AFTER it has loaded? [advanced]
Sorry about not being so clear: what I exactly want is to know if window has loaded. I need to be sure if all the IMAGES had been loaded, that's why jQuery.isReady is useless for me. jquery.isReady equals true when DOM is loaded, but not the images. I hope someone could help me. Iair Salem. PD: Please Google do something about the delay for a message to be seen and searchable on the group. On 7 mar, 09:11, Ariel Flesler [EMAIL PROTECTED] wrote: As far as I know, document.ready will execute functions right away if the dom is ready. Also you can use: if( jQuery.isReady ). On 6 mar, 17:46,IairSalem[EMAIL PROTECTED] wrote: Hello everyone, I have a problem The basics: $(document).ready(function(){alert(DOM Loaded)}); $(window).load(function(){alert(Full Page Images Loaded)}); But, what happens if I do this?: $(window).load(function(){ setTimeout(foo(), 2000); ); function foo(){ $(window).load(function(){alert(this alert will never occur)}); / *calling window load() after it has been called once results in nothing happening*/ } This beaviour isn't the same as $(document).ready, because $ (document).ready is handled by jQuery, and jQuery sets jQuery.isReady = true, and calls it inmediately. Maybe I'm asking for the property jQuery.isPageLoaded which would tell me if the entire page has loaded, also AFTER the page has loaded (for example in a click event). There is a dirty workaround: var isPageLoaded = false; $(window).load( function(){ isPageLoaded=true;} ); This will workaround the problem and fix it partially (because in theory this won't work when loading scripts dinamically) If you have a better solution, please share it with the group. Thank you, IairSalem
[jQuery] Re: How to know if the entire page has loaded, AFTER it has loaded? [advanced]
Why not just set a globally available flag? script type=text/javascript var _PageIsLoaded = false; $(window).load(function(){ _PageIsLoaded = true; ); /script Now _PageIsLoaded will tell you if the page is loaded or not
[jQuery] Validation jQuery plugin - onfocusout throws error
jquery: 1.2.3 jquery validation plugin: 1.2.1 I have: form id=myform name=myform ... /form $().ready(){ $(#myform).validate({onfocusout:true}); } firebug error message validator.settings[on + event.type].call is not a function on jquery.validate.js line 250 same error msg is thrown with onkeyup as well... Why?? Thank you.
[jQuery] Re: How to know if the entire page has loaded, AFTER it has loaded? [advanced]
Use the good old load event. $(window).load(function () { // run code }); ( from http://docs.jquery.com/Events/load ) Karl Rudd On Fri, Mar 7, 2008 at 11:10 PM, Iair Salem [EMAIL PROTECTED] wrote: Sorry about not being so clear: what I exactly want is to know if window has loaded. I need to be sure if all the IMAGES had been loaded, that's why jQuery.isReady is useless for me. jquery.isReady equals true when DOM is loaded, but not the images. I hope someone could help me. Iair Salem. PD: Please Google do something about the delay for a message to be seen and searchable on the group. On 7 mar, 09:11, Ariel Flesler [EMAIL PROTECTED] wrote: As far as I know, document.ready will execute functions right away if the dom is ready. Also you can use: if( jQuery.isReady ). On 6 mar, 17:46,IairSalem[EMAIL PROTECTED] wrote: Hello everyone, I have a problem The basics: $(document).ready(function(){alert(DOM Loaded)}); $(window).load(function(){alert(Full Page Images Loaded)}); But, what happens if I do this?: $(window).load(function(){ setTimeout(foo(), 2000); ); function foo(){ $(window).load(function(){alert(this alert will never occur)}); / *calling window load() after it has been called once results in nothing happening*/ } This beaviour isn't the same as $(document).ready, because $ (document).ready is handled by jQuery, and jQuery sets jQuery.isReady = true, and calls it inmediately. Maybe I'm asking for the property jQuery.isPageLoaded which would tell me if the entire page has loaded, also AFTER the page has loaded (for example in a click event). There is a dirty workaround: var isPageLoaded = false; $(window).load( function(){ isPageLoaded=true;} ); This will workaround the problem and fix it partially (because in theory this won't work when loading scripts dinamically) If you have a better solution, please share it with the group. Thank you, IairSalem
[jQuery] Re: [validate] check select on change instead of on focus?
The don't notice the change till blur is actually a feature of the select GUI element. Consider if the user was using the keyboard to chose an option in a select, when do you fire the ok they've chosen something different (aka change) event? *shrug* It's just one of those things. Karl Rudd On Fri, Mar 7, 2008 at 1:09 PM, minimal design [EMAIL PROTECTED] wrote: I just started using the grate validate plugin today and I can't really find an example of what I'm trying to customize... Basically, I think it's confusing for a select element to change on focus instead of on change, meaning: the user forgets to select an option, the drop down is highlighted with some CSS, so use selects an option, but CSS error styling doesn't go away until the user clicks somewhere else on the page... A minor gripe, but I'm a big believer of the Steve Krug don't make me think school ;) Any suggestion or pointer on how to do that would be greatly appreciated. I'm still not quite clearly on how to implement own customizations of this plugin even after going through the docs... Thanks!
[jQuery] Re: jqGrid final preview
Looks good Tony. The only issue I can see the at the moment is that the nav buttons at the bottom act oddly when hovered over. It happens only in the following example: http://trirand.com/jqgrid/example.html It must be a CSS thing. Rey Tony wrote: Hi all, At end I have done a lot of work to finalize the jqGrid. More information you can found here http://www.trirand.com/blog Note that this is not official release, since of missing documentation. I'm working hard on this and hope to finish the documentation at end of week. Enjoy Tony
[jQuery] Re: jqGrid final preview
Another thing. Is there a way to make the scrollbar fit within the control itself? Currently, it sits out to the right and, IMO, seems a little out of place just floating there. Rey... Tony wrote: Hi all, At end I have done a lot of work to finalize the jqGrid. More information you can found here http://www.trirand.com/blog Note that this is not official release, since of missing documentation. I'm working hard on this and hope to finish the documentation at end of week. Enjoy Tony
[jQuery] Re: cluetip on an imagemap troubles
Hi nEo, Sorry for the delay in getting back to you. I'm going to devote some time this weekend to looking into your problem and will report back as soon as I've discovered something. --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Mar 5, 2008, at 11:45 PM, nEo wrote: Hi, I tried using id (#usamap). It created the cluetip, but everything was running in a loop... Please help. On Feb 29, 10:26 pm, nEo [EMAIL PROTECTED] wrote: Hi, I have an image map marked with areas. I am having trouble in passing the dynamic values to the ajax script. My image map is like this map name=USAMap id=USAMap area shape=poly coords=52,143,60,106,23,96,14,137,38,208,83,244,92,210 class=USAstates name=CA title=California State href=CA- california.html / area shape=poly coords=88,111,99,62,40,48,23,95 class=USAstates name=OR title=in Oregon State href=OR-oregon.html / area shape=poly coords=98,61,106,22,60,10,41,15,39,47 class='USAstates' name='WA' title='Washington State' href='WA- washington.html' / /map my jquery script is this. script language=javascript $(document).ready(function() { $('area.USAstates').each( function () { var statekey = $(this).attr(name).toString(); //alert('statekey =' + statekey ); $(.USAStates).attr(rel,ajaxsearch.php).cluetip({ showTitle: true, closePosition : title, sticky : true, hoverIntent: { sensitivity: 7, interval: 500, timeout: 100 }, ajaxCache: false, ajaxSettings : { type : POST, data : state= + statekey }, ajaxProcess : function (data) { return div + data + /div; } }); });}); /script Can some one assist me? Thank you. Regards Neo M
[jQuery] Turning an object into simple string
I've got an object in my javascript that keeps tracks of controls and their values and am trying to pass it to the server to use with James Network-King's excellent ASP.NET Json object So it allows me to pass a JSON-d object to it and i can manipulate it it in my VB code Problem i am having is turning my object: var PageData = [ { Tab: Recipients, Objects: [Recipients_Choice,U_RoleList,U_Select], Values: [,,], Valid: false }, { Tab: Body, Objects: [Subject_Text,BodyHtml_Text,BodyText_Text], Values: [,,], Valid: false }, { Tab: Schedule, Objects: [Schedule_Start,Schedule_End,Schedule_Frequency], Values: [,,], Valid: false } ]; into a simple string to my use of the getJSON method $.getJSON( modules/Schedule.ashx, { Mode: Save, Description: Description, Data: *** The PageData object as string here }, function(json) { if (json.HasError) { alert(json.Message); } else { // Code for success here with json.Data } } ); I am using this code i found (http://www.thomasfrank.se/ json_stringify_revisited.html), but when my script hits the line: JsonString = JSON.stringify(PageData); (and then in the getJSON call have Data: JsonString in the parameters Which works but the browser hangs for like 3 seconds (and it's not even that big of an object as you can see) Anyone have any suggestions to stringify an object using alternative methods (jQuery or even not)?
[jQuery] Re: jqGrid final preview
Rey, Thank you again for the note. I forgot to update the link in the new demo. Now all should work ok. As for the scrolling - yes you have right it sits out and look not good. Let me do something for this. Regards Tony On Mar 7, 3:51 pm, Rey Bango [EMAIL PROTECTED] wrote: Looks good Tony. The only issue I can see the at the moment is that the nav buttons at the bottom act oddly when hovered over. It happens only in the following example: http://trirand.com/jqgrid/example.html It must be a CSS thing. Rey Tony wrote: Hi all, At end I have done a lot of work to finalize the jqGrid. More information you can found here http://www.trirand.com/blog Note that this is not official release, since of missing documentation. I'm working hard on this and hope to finish the documentation at end of week. Enjoy Tony
[jQuery] Re: How to know if the entire page has loaded, AFTER it has loaded? [advanced]
@MorningZ, Karl: You're right, in fact, in my first message I pointed exactly what you did. But I also pointed that: This will workaround the problem and fix it partially (because in theory this won't work when loading scripts dinamically) If someone has a better solution, please share it with the group. On 7 mar, 10:30, Karl Rudd [EMAIL PROTECTED] wrote: Use the good old load event. $(window).load(function () { // run code }); ( fromhttp://docs.jquery.com/Events/load) Karl Rudd On Fri, Mar 7, 2008 at 11:10 PM, Iair Salem [EMAIL PROTECTED] wrote: Sorry about not being so clear: what I exactly want is to know if window has loaded. I need to be sure if all the IMAGES had been loaded, that's why jQuery.isReady is useless for me. jquery.isReady equals true when DOM is loaded, but not the images. I hope someone could help me. Iair Salem. PD: Please Google do something about the delay for a message to be seen and searchable on the group. On 7 mar, 09:11, Ariel Flesler [EMAIL PROTECTED] wrote: As far as I know, document.ready will execute functions right away if the dom is ready. Also you can use: if( jQuery.isReady ). On 6 mar, 17:46,IairSalem[EMAIL PROTECTED] wrote: Hello everyone, I have a problem The basics: $(document).ready(function(){alert(DOM Loaded)}); $(window).load(function(){alert(Full Page Images Loaded)}); But, what happens if I do this?: $(window).load(function(){ setTimeout(foo(), 2000); ); function foo(){ $(window).load(function(){alert(this alert will never occur)}); / *calling window load() after it has been called once results in nothing happening*/ } This beaviour isn't the same as $(document).ready, because $ (document).ready is handled by jQuery, and jQuery sets jQuery.isReady = true, and calls it inmediately. Maybe I'm asking for the property jQuery.isPageLoaded which would tell me if the entire page has loaded, also AFTER the page has loaded (for example in a click event). There is a dirty workaround: var isPageLoaded = false; $(window).load( function(){ isPageLoaded=true;} ); This will workaround the problem and fix it partially (because in theory this won't work when loading scripts dinamically) If you have a better solution, please share it with the group. Thank you, IairSalem
[jQuery] Latest jquery breaks onsubmit in IE7
Hello, I have a login page (I know it's not terribly secure, but the code wasn't written by me, I'd write it differently, that's not the point currently) with two forms: proxy_login and login. Login form is defined as form method=post onsubmit=return login(this); Javascript function 'login' copies username and sha1 hash of the password to the proxy_login hidden form fields, submits proxy_login form and returns false. Everything works fine when jquery 1.1.3.1 used on the page (it's not used by login function at all, by the way). When jquery is upgraded to the latest version, login sequence continue to work fine in the firefox browser, but in IE7 (didn't test in IE6) first login_proxy form is correctly submitted, then `login` form with plaintext password is submitted despite the fact that onsubmit handler returned false! Does anyone know a workaround? Eugene
[jQuery] Description of Product
May I make a suggestion? Your product is obviously a good one and is being well-received. But for those of us unfamiliar with its capabilities, would not a simple description or overview of what jQuery is, on your landing page, be of assistance to newbies (such as myself) who might or might not be looking for just what this does? If I have overlooked such a entry, please forgive my comments. Thank you!
[jQuery] Re: Targeting pseudo classes with jQuery
Perfect gentlemen, thank you very much :) On Mar 7, 3:32 am, Hamish Campbell [EMAIL PROTECTED] wrote: Rather than setting CSS attributes directly, use classes. Eg, with hover: $('.someElements').click(function() { $('.someElements').removeClass('aSelected'); $(this).addClass('aSelected'); } $('.someElements').hover( function(){ $(this).addClass('aHover') }, function() { $(this).removeClass('aHover'); } ); This should solve your problem. On Mar 7, 10:57 am, TheOriginalH [EMAIL PROTECTED] wrote: I have a menu which is working nicely. When an item is clicked, I'm using jQuery to change the CSS color to indicate it is current. To keep things neat, I have also changed the color of all similar items back to the default (otherwise ALL items would be highlighted as you went through the menu. Unfortunately this has the side effect of killing the natural css hover pseudo class :( I've messed with the .hover function, but the implementation I've used then kills the coloring on click (as when you mouse away from hover, it returns to the default). Anyone come across this and know how to fix it? TIA, H
[jQuery] Re: jqGrid final preview
I have to say good job! I really like what I see. This looks like it might be exactly the type of thing I need...
[jQuery] Re: jqGrid final preview
Hmm, I only have one thing I'm not sure I like: it looks like all the sorting is done on the backend? Do I have to write my own sort routines then? Are there any plans to integrate it with tablesorter, or to have sorting like tablesorter (client side, not server side)?
[jQuery] $.getJSON doesn't work on Vista PC while calling remote server
Hi guys, if tried the following where usercontacts.j is in my localhost pc windows vista (tomcat6) and alert showed like [object object] mean there's some object in json argument: $.getJSON(usercontacts.js, function(json){ alert(json); }); so when I changed to remote location : $.getJSON(http://stufftolet.com/test/usercontacts.js;, function(json){ alert(json); }); the alert doesn't work alert anymore. However, both behavior (local and remote) works on windows xp in my office. Is it some kind of security issue where stupid vista try to block outgoing connection? Appreciate any advice and help, Thanks ! regards, Mark -- View this message in context: http://www.nabble.com/%24.getJSON-doesn%27t-work-on-Vista-PC-while-calling-remote-server-tp15893358s27240p15893358.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: simplemodal and datepicker
Hello, in your example, if you one time open modal box, then open datepicker, close s-modal, and one more open s-modal, then you either get an error or datepicker moves to (0, 0) point. On Jan 31, 3:52 am, Eric Martin [EMAIL PROTECTED] wrote: Thanks for the example Marc. To answer the OP's question, I added an example usingSimpleModal: http://ericmmartin.com/code/datepicker/ -Eric On Jan 30, 12:43 pm, 1Marc [EMAIL PROTECTED] wrote: I've had a lot of questions about modal windows and UI Datepicker, so I created a demo example using thickbox: http://marcgrabanski.com/code/ui-datepicker/extras/thickbox-datepicker I hope that helps. On Jan 30, 10:55 am, Eric Martin [EMAIL PROTECTED] wrote: On Jan 30, 6:13 am, rayfidelity [EMAIL PROTECTED] wrote: Hi, I want to enable datepicker in the modal window that opens...datepicker works fine for itself but i cannot get it to work in modal. Any ideas? Can you clarify what you mean by cannot get it to work in modal? Modal window is loaded through ajax... Do you have a page or code that we/I can view? -Eric
[jQuery] Re: problems with event triggering in IE6, presumably 5.5 as well.
Hi hedgomatic and h0tzen, I'm experiencing the same problem here. I've tried mouseover/mouseout, hover()... without success. On Mar 6, 7:08 pm, hedgomatic [EMAIL PROTECTED] wrote: I actually started with hover, with something along the lines of... -(snip) $(#trigger_news).hover( function () {$(#news).addClass(news_on);}, function () {$(#news).removeClass(news_on);$ (#news).addClass(news);}); -(/snip) ...which sadly wound up producing the same result. This is using jQuery 1.2.3. On Mar 6, 5:34 am, h0tzen [EMAIL PROTECTED] wrote: use jquerys specific hover-method which workarounds the browser- failures of mouseover/mouseout. in the recent jquery-plugin there are also new virtual events mouseenter, mouseleave i think, which wrap mouseouver and mouseout and are used by hover() $(elem).hover(overFn, outFn)
[jQuery] Re: Resizable only to specified width
Did you ever find a solution to this? Since the resizing of the parent element is achieved through the dragging of the handle, perhaps you could make the handle snap to a grid when its being dragged? The result of this will be a parent element that appears to resize according to a grid. On 10 Jan, 17:23, thierry [EMAIL PROTECTED] wrote: Hello, I would like to create a weekly calendar where people can select one day, or more. I would like it to work a bit like outlook. So when someone selects a day, it should be possible toresizethe selection to include more days. Problem is that theresizeshould snap to a day, so that it is not possible that someone resizes to the middle of a day. When I look at the draggable feature, it is possible to add a grid option, but I didn't see it for resizables. Is this possible with thejqueryuiplugin or perhaps with another plugin? Thank you.
[jQuery] Re: Problem width tabs + splitter
The version of tabs is2.7.4 ( cesar. On Mar 6, 9:38 pm, Klaus Hartl [EMAIL PROTECTED] wrote: The demo is broken, I get an error page due... which version of Tabs do you use? --Klaus On Mar 6, 8:37 pm, cesar c [EMAIL PROTECTED] wrote: Hi! I've try to mix tabs + splitter but didn't works in IE6/7 In FF works great! but I don't know what to do to solved in IE6 The microsoft script debbuger, report that de line 597 has an error on the jquery-1.1.3.1.js file. I copy this part of code... in jquery-1.1.3.1.js file in attr method if ( value != undefined ) { /* only for see the values for (i=0;i2;i++){ console.log(i); console.log(name); console.log(value); }; */ elem[name] = value; in this line m s d breaks } I created a link width the demo page...is someone want to see..is inhttp://elcirculorojo.890m.com/index.html Cheers!...
[jQuery] Re: Description...
...Never mind! :)
[jQuery] Re: [POLL] Online jQuery Training from John Resig
I think it is important to gauge skill levels for these classes as novices wouldn't want to be caught up in complex issues and vice verse for advanced users. Just a suggestion to have some sort of hierarchy in regards to skill level... On Mar 6, 4:29 pm, Rick Faircloth [EMAIL PROTECTED] wrote: Now, that's funny! Leanan, I don't think you realized your own pun, but as a father of two grown kids, I still remember being amazed at how often infants soil their diapers! It's a crap shoot, indeed! :o) Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Leanan Sent: Thursday, March 06, 2008 1:35 PM To: jQuery (English) Subject: [jQuery] Re: [POLL] Online jQuery Training from John Resig Hmm, interesting indeed. I said I'm interested but whether or not I would do it depends on most of the things mentioned above: cost time ability to get recordings The last one is especially important to me, as I have an infant and as anyone with kids can attest, trying to get something done at this stage in the game is a crap shoot.
[jQuery] Re: Issues with Backwards Traversing the DOM
This code worked for me: $(#mainCol ul li a).each(function() { var headerText = $(this).parent().siblings(h1).text(); $(this).attr(title, headerText ); }); Also, you might want to consider using something other than an h1 tag. Strictly speaking, that tag is supposed to represent the document's header, rather than the header of an individual element. I'd recommend using a div or span tag instead. David On Mar 6, 11:32 am, Joe [EMAIL PROTECTED] wrote: So I'm having an issue attempting to traverse back in a li element to grab the text inside a header tag and insert that text as the title attribute's value in a link. The markup will more more sense: div id=mainCol ul li h1Header 1/h1 pSome nice text here./p pa href=url title=Click Here!/a/p /li li h1Header 2/h1 pSome nice text here./p pa href=url/a/p /li /ul /div !-- End of Main Column -- $(document).ready(function(){ // Add title to each link in the main content column's unordered list for each list element by using the h1 tag's text. $('#mainCol ul li a').each(function(){ // Grab the header text of this link's header parent $(this).parents().size()); }); }); // End of ready function. Clearly this script won't execute what I need, but the size is 0 and I can't seem to traverse up the DOM to grab the h1 tag's text with combinations using parent, parents, siblings, etc.. Any suggestions?
[jQuery] jQuery in Google Summer of Code?
Hello everybody! Is jQuery going to participate in Google Summer of Code this year? 5 days left to register as a mentoring organization :)
[jQuery] Re: Checkbox click event fires more than once
Hi Not totally sure what you're trying to do but try the $.one() event handler instead of click() in your case replace click() with one() http://docs.jquery.com/Events/one - Chris On Mar 7, 2:39 am, Patrick J Collins [EMAIL PROTECTED] wrote: Hey All, I'm trying to dynamically add a list of check boxes (and an associated click event handler) to my page. Problem is, when I click on a box, the event is fired multiple times (once per checkbox on the page). I don't really understand this behaviour - the event should only fire once. I would graciously appreciate any suggestions you may have. Regards Patrick Code snippit : script type=text/javascript $(function() { $.ajax({ type: GET, url: ./?get=Lignes, dataType: xml, cache: false, success: function(xml){ $(xml).find(Lignes).each(function() { var line = $(this); $(#filters) .append(input type='checkbox' value= + line.attr(ID) + ) .click(function() { $(#map).append(wtf??).append(br/); return false;}) .append(line.attr(Nom)).append(br/); }); } }); }); /script
[jQuery] Re: jqGrid final preview
Leanan, Grid support client side sorting. Maybe it is not good documented - (see array data example - here we have client side sorting), but i hope that this will be done in the new documentation. Regards Tony On Mar 7, 5:45 pm, Leanan [EMAIL PROTECTED] wrote: Hmm, I only have one thing I'm not sure I like: it looks like all the sorting is done on the backend? Do I have to write my own sort routines then? Are there any plans to integrate it with tablesorter, or to have sorting like tablesorter (client side, not server side)?
[jQuery] Re: Validation jQuery plugin - onfocusout throws error
henry schrieb: jquery: 1.2.3 jquery validation plugin: 1.2.1 I have: form id=myform name=myform ... /form $().ready(){ $(#myform).validate({onfocusout:true}); } firebug error message validator.settings[on + event.type].call is not a function on jquery.validate.js line 250 same error msg is thrown with onkeyup as well... Why?? You can pass a function and a boolean-false as the argument to those. What are you trying to achieve with true? Jörn
[jQuery] Re: [validate] check select on change instead of on focus?
minimal design schrieb: I just started using the grate validate plugin today and I can't really find an example of what I'm trying to customize... Basically, I think it's confusing for a select element to change on focus instead of on change, meaning: the user forgets to select an option, the drop down is highlighted with some CSS, so use selects an option, but CSS error styling doesn't go away until the user clicks somewhere else on the page... A minor gripe, but I'm a big believer of the Steve Krug don't make me think school ;) Any suggestion or pointer on how to do that would be greatly appreciated. I'm still not quite clearly on how to implement own customizations of this plugin even after going through the docs... The change event is only fired on blur of the select, so listening to it doesn't help. In any case, you can trigger validation on an element manually this way: $(select).change(function() { $(this).valid(); }); Jörn
[jQuery] Re: How to know if the entire page has loaded, AFTER it has loaded? [advanced]
This may be out of left field from what you're asking but I wrote a script called onImagesLoaded, with a tolerance setting. I used this to fire the jquery.flash.js script only after most of the images had been downloaded. Some sites I've coded were overly image-heavy with the Flash at the top of the page, so it would tend to make an ugly user-experience. If they're of any value to you, here they are: // Fire a specific event once all images are loaded. function onImagesLoaded(fn,tolerance) { // Ensure we have a valid function. if (!$.isFunction(fn)) return; var images = $('img').filter(function(el,i) { return !this.complete; }); if (images.length) { window.$loadedImageCount = images.length; window.$imagesLoadedTolerance = $.toInt(tolerance); if (!window.$onImagesLoaded) window.$onImagesLoaded = []; window.$onImagesLoaded.push(fn); images.one('load',imageHasLoaded); } else fn(); } // Each time an image is loaded, check to see if we can fire the event. function imageHasLoaded(e) { // Ensure we still have functions to execute. if (!window.$onImagesLoaded) return; // Reduce the number of images left. try { window.$loadedImageCount--; } catch(ex) {} // If we've reached 0 or the tolerance, fire the events. if ((window.$loadedImageCount||0) = (window.$imagesLoadedTolerance||0)) { for (var i=0;iwindow.$onImagesLoaded.length;i++) { if ($.isFunction(window.$onImagesLoaded[i])) window.$onImagesLoaded[i](); } window.$onImagesLoaded = null; } } -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Karl Rudd Sent: Friday, March 07, 2008 4:31 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: How to know if the entire page has loaded, AFTER it has loaded? [advanced] Use the good old load event. $(window).load(function () { // run code }); ( from http://docs.jquery.com/Events/load ) Karl Rudd On Fri, Mar 7, 2008 at 11:10 PM, Iair Salem [EMAIL PROTECTED] wrote: Sorry about not being so clear: what I exactly want is to know if window has loaded. I need to be sure if all the IMAGES had been loaded, that's why jQuery.isReady is useless for me. jquery.isReady equals true when DOM is loaded, but not the images. I hope someone could help me. Iair Salem. PD: Please Google do something about the delay for a message to be seen and searchable on the group. On 7 mar, 09:11, Ariel Flesler [EMAIL PROTECTED] wrote: As far as I know, document.ready will execute functions right away if the dom is ready. Also you can use: if( jQuery.isReady ). On 6 mar, 17:46,IairSalem[EMAIL PROTECTED] wrote: Hello everyone, I have a problem The basics: $(document).ready(function(){alert(DOM Loaded)}); $(window).load(function(){alert(Full Page Images Loaded)}); But, what happens if I do this?: $(window).load(function(){ setTimeout(foo(), 2000); ); function foo(){ $(window).load(function(){alert(this alert will never occur)}); / *calling window load() after it has been called once results in nothing happening*/ } This beaviour isn't the same as $(document).ready, because $ (document).ready is handled by jQuery, and jQuery sets jQuery.isReady = true, and calls it inmediately. Maybe I'm asking for the property jQuery.isPageLoaded which would tell me if the entire page has loaded, also AFTER the page has loaded (for example in a click event). There is a dirty workaround: var isPageLoaded = false; $(window).load( function(){ isPageLoaded=true;} ); This will workaround the problem and fix it partially (because in theory this won't work when loading scripts dinamically) If you have a better solution, please share it with the group. Thank you, IairSalem
[jQuery] Re: Resizable only to specified width
If you haven't already, I would recommend taking a look at the selectables plugin: http://docs.jquery.com/UI/Selectables http://dev.jquery.com/view/trunk/ui/demos/ui.selectable.html It seems like a good fit. You can have each hour/quarter hour/day be selectable and allow for drag to select a range/region of time. - Richard On Thu, Jan 10, 2008 at 12:23 PM, thierry [EMAIL PROTECTED] wrote: Hello, I would like to create a weekly calendar where people can select one day, or more. I would like it to work a bit like outlook. So when someone selects a day, it should be possible to resize the selection to include more days. Problem is that the resize should snap to a day, so that it is not possible that someone resizes to the middle of a day. When I look at the draggable feature, it is possible to add a grid option, but I didn't see it for resizables. Is this possible with the jquery ui plugin or perhaps with another plugin? Thank you.
[jQuery] GData JSON queries Invalid query parameters:_
I've been running into a problem querying GData (Google's Data APIs) using jQuery and JSON. jQuery's ajax function automatically adds a cache-buster timestamp to the query, and Google is barfing on it. The timestamp is inserted starting around line 2608 in jQuery 1.2.3. As an example, here is an example JSON query url as sent by jQuery: http://gdata.youtube.com/feeds/videos/ysTmUTQ5wZE?alt=json-in-scriptcallback=jsonp1204907988594_=1204907988789 That returns Invalid query parameters:_ Removing the underscore timestamp parameter and Google returns the JSON object: http://gdata.youtube.com/feeds/videos/ysTmUTQ5wZE?alt=json-in-scriptcallback=jsonp1204907988594 In the end, I ended up inserting the JSON loading script tags into the page the old-fashioned way, missing out on all benefits of using jQuery for this. I'm also filing a bug with Google encouraging them to fail a touch more gracefully when faced with unknown query parameters. Please star issue 390 to help get their attention: http://code.google.com/p/gdata-issues/issues/detail?id=390
[jQuery] Re: $.getJSON doesn't work on Vista PC while calling remote server
I've had issues where jQuery's JSON requests were treated as XHRs if there was no JSONp callback. That obviously doesn't work going cross- domain. If you change your url to /http://stufftolet.com/test/usercontacts.js? callback=? it should work, though you're going to need to hook up the result. joe On Mar 7, 9:55 am, Plant More Tree [EMAIL PROTECTED] wrote: Hi guys, if tried the following where usercontacts.j is in my localhost pc windows vista (tomcat6) and alert showed like [object object] mean there's some object in json argument: $.getJSON(usercontacts.js, function(json){ alert(json); }); so when I changed to remote location : $.getJSON(http://stufftolet.com/test/usercontacts.js;, function(json){ alert(json); }); the alert doesn't work alert anymore. However, both behavior (local and remote) works on windows xp in my office. Is it some kind of security issue where stupid vista try to block outgoing connection? Appreciate any advice and help, Thanks ! regards, Mark -- View this message in context:http://www.nabble.com/%24.getJSON-doesn%27t-work-on-Vista-PC-while-ca... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: $.getJSON doesn't work on Vista PC while calling remote server
And it wouldn't, as that would be a crosssite scripting instance, which isn't permitted. -- Steve Cutter Blades Adobe Certified Professional Advanced Macromedia ColdFusion MX 7 Developer _ http://blog.cutterscrossing.com --- The Past is a Memory The Future a Dream But Today is a Gift That's why they call it The Present
[jQuery] Re: $.getJSON doesn't work on Vista PC while calling remote server
The getJSON uses the XMLHttpRequest to make the ajax call. The XMLHttpRequest doesn't support remote website calls. The odd thing is that the remote call was actually working for you at your office -- it shouldn't. If you do need to use ajax with a remote url, you can use JSONP, which is a work-around to this problem that uses script src=/script tags to get the remote url. Here is some info on it: http://ajaxian.com/archives/jsonp-json-with-padding http://remysharp.com/2007/10/08/what-is-jsonp/ http://docs.jquery.com/Release:jQuery_1.2/Ajax JK -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Plant More Tree Sent: Friday, March 07, 2008 6:56 AM To: jquery-en@googlegroups.com Subject: [jQuery] $.getJSON doesn't work on Vista PC while calling remote server Hi guys, if tried the following where usercontacts.j is in my localhost pc windows vista (tomcat6) and alert showed like [object object] mean there's some object in json argument: $.getJSON(usercontacts.js, function(json){ alert(json); }); so when I changed to remote location : $.getJSON(http://stufftolet.com/test/usercontacts.js;, function(json){ alert(json); }); the alert doesn't work alert anymore. However, both behavior (local and remote) works on windows xp in my office. Is it some kind of security issue where stupid vista try to block outgoing connection? Appreciate any advice and help, Thanks ! regards, Mark -- View this message in context: http://www.nabble.com/%24.getJSON-doesn%27t-work-on-Vista-PC-while-calling-r emote-server-tp15893358s27240p15893358.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: getJSON data problem for getting youtube json data
There are a problems requesting JSON object from GDATA using jQuery. jQuery appends a timestamp to the url which causes GData to throw an Invalid parameter error. If you check with FireBug, you'll see it. Also, GData's API says to use alt=json-in-script instead of just alt=json. It's hard to find, and I made the same mistake at first. Without a callback parameter in the query, GData will return the object wrapped in gdata.io.handleScriptLoaded({...}) but jQuery seems to want to try callback-less JSON requests as XHRs. I ended up working around these problems by manually inserting the script and building a dummy gdata.id object to catch the result. It's clumsy but it works and will be easy to convert once jQuery and GData start to get along better. gdataURL = http://gdata.youtube.com/feeds/api/videos?format=1vq=catstart-index=10max-results=20orderby=viewCountalt=json-in-script // insert the script: var s = document.createElement('script'); s.src = gdataURL; document.getElementsByTagName('head')[0].appendChild(s); //fake object: gdata = { io: { handleScriptLoaded: function(data) { JSONparser(data); } } }; I've posted to this list about this and opened an issue with Google: http://code.google.com/p/gdata-issues/issues/detail?id=390 Hope this helps, joe On Mar 7, 3:36 am, Saidur [EMAIL PROTECTED] wrote: Hi , I want to get the json data from the youtube api (http:// code.google.com/apis/youtube/developers_guide_protocol.html). My code is like : url=http://gdata.youtube.com/feeds/api/videos?format=1vq=catstart- index=10max-results=20orderby=viewCountalt=json; $.getJSON(url,callBackFucntion); function callBackFucntion () { // here parse the json data } But i got an error when i run this code. [Exception... 'Permission denied to call method XMLHttpRequest.open' when calling method: [nsIDOMEventListener::handleEvent] nsresult: 0x8057001e (NS_ERROR_XPC_JS_THREW_STRING) location: unknown data: no] so agian i change the url and add the callback parameter with ? : url=http://gdata.youtube.com/feeds/api/videos?format=1vq=catstart- index=10max-results=20orderby=viewCountalt=jsoncallback=?; $.getJSON(url,fucntion (data){ // parse json data alert ('json data get'); }); This time i do not get error . But i do not get the call back So how can i get the json data problem Thanks Saidur Rahman
[jQuery] Superfish Plugin CSS problem
I have created a menu that when a selection is hovered over, its background changes to a dark green, and the text becomes white. This works fine, except when you hover over a selection in a deeper level of the menu, the background of the parent li stays dark, but the text returns to its original color, and is unreadable. I can't seem to get this to work properly. Any suggestions? Thanks! CSS of menu follows: .nav, .nav * { margin:0; padding:0; } .nav { line-height:1.0; margin-bottom:1.5em; width: 150px; font-size: 0.9em; } .nav ul { background:#fff; /*IE6 needs this*/ width: 150px; } .nav li { background:#c9dcc6; /*float: left;*/ list-style:none; position:relative; width: 150px; z-index:999; } .nav a { color: #336633; text-align: left; font-weight: bold; display:block; padding: 5px 0 5px 10px; text-decoration:none; width: 140px; } .nav li ul { top:-999em; position:absolute; width:160px; border: 1px solid #aaa; } .nav li:hover, .nav li.sfHover, .nav a:focus, .nav a:hover, .nav a:active { background:#336633; color: #fff; } .nav li:hover ul, /* pure CSS hover is removed below */ ul.nav li.sfHover ul { left:150px; top:0px; } .nav li:hover li ul, .nav li.sfHover li ul { top:-999em; } .nav li li:hover ul, /* pure CSS hover is removed below */ ul.nav li li.sfHover ul { left:150px; top:0px; } .nav li li:hover li ul, .nav li li.sfHover li ul { top:-999em; } .nav li li li:hover ul, /* pure CSS hover is removed below */ ul.nav li li li.sfHover ul { left:150px; top:0px; } /*following rule negates pure CSS hovers so submenu remains hidden and JS controls when and how it appears*/ .superfish li:hover ul, .superfish li li:hover ul, .superfish li li li:hover ul { top: -999em; } .nav li li { background:#c9dcc6; width:160px; } .nav li li li { background:#c9dcc6; } .nav li li a { padding-right:0; width:150px; }
[jQuery] Re: Problem width tabs + splitter
On Mar 7, 1:22 pm, cesar [EMAIL PROTECTED] wrote: The version of tabs is2.7.4 Ok, this should be compatible with jQuery 1.1.3.1. But in the demo some of the javascript files load an (error) html page causing a syntax error, so I can't tell anything reliable until this isn't fixed. Apart from that I saw that you're including jQuery twice. You should avoid that. --Klaus
[jQuery] [ANNOUNCE] jQuery UI Team Needs Your Help!
The jQuery UI Team is pleased to announce its first Worldwide Sprint, to take place next Friday and Saturday, March 14-15, 2008. Two full days of testing, fixes, documentation, and general getting-stuff-done. Our goal is to get the jQuery UI 1.5 release (alpha, beta) ready for final, and we invite any and all to help. Whether you have an hour, or an afternoon, come and run really fast with us. How Will It Work? We’ll all gather in IRC (#jquery-sprint on freenode) throughout the two-day sprint, with a couple of scheduled meetings to keep everyone on the same page, and make sure things keep moving. Other than that we’ll just be doing as much as we can, as fast as we can. Opening tickets, closing tickets, breaking stuff, fixing other things, and everyone’s favorite pastime: documentation. I’m New Here. Can I Help? Absolutely. If you’ve thought about contributing to jQuery or jQuery UI before, but never really found the right moment or momentum, this sprint is the perfect time to get involved. Paul and I will be around, as well other members of the jQuery Team to help people get started, especially if it’s your first time. We’ll help you help us, in whatever way you want. That could be testing, documentation, ticket triage, bug fixes, writing demos, or even just playing with new stuff as we churn it out, and providing valuable feedback. We want to ensure this release is rock solid on all supported browsers, including yours. More Details We’ve created a wiki page to help coordinate this big event. It has some more details on what is planned, how to jump in, and will be updated throughout the sprint to show status and next steps. We invite you to add your name to the page as a participant, if you’re interested, even if you have only a few hours (or aren’t sure how much time you’ll have). Also, feel free to specify what you’re willling and/or able to do. Thanks! http://docs.jquery.com/JQuerySprint
[jQuery] Re: Using JQuery Effects in Parent Window from iFrame?
you look at the frames plugin yet? http://ideamill.synaptrixgroup.com/?p=6 On Mar 6, 7:24 pm, ABecks [EMAIL PROTECTED] wrote: Hello, I have a simple HTML file with an iframe. Inside the iframe is a simple submission form. I would like to be able to click Submit and have Jquery append content to a div that is outside of the iframe. I have exhausted my knowledge of parent heirarchy in JS trying to find a solution. I couldn't find a solution in the Wiki or on Google. Any help is appreciated, Andrew -- View this message in context:http://www.nabble.com/Using-JQuery-Effects-in-Parent-Window-from-iFra... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: How to know if the entire page has loaded, AFTER it has loaded? [advanced]
This is great! Could you possibly show me an example of this online? On Mar 7, 12:12 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote: This may be out of left field from what you're asking but I wrote a script called onImagesLoaded, with a tolerance setting. I used this to fire the jquery.flash.js script only after most of the images had been downloaded. Some sites I've coded were overly image-heavy with the Flash at the top of the page, so it would tend to make an ugly user-experience. If they're of any value to you, here they are: // Fire a specific event once all images are loaded. function onImagesLoaded(fn,tolerance) { // Ensure we have a valid function. if (!$.isFunction(fn)) return; var images = $('img').filter(function(el,i) { return !this.complete; }); if (images.length) { window.$loadedImageCount = images.length; window.$imagesLoadedTolerance = $.toInt(tolerance); if (!window.$onImagesLoaded) window.$onImagesLoaded = []; window.$onImagesLoaded.push(fn); images.one('load',imageHasLoaded); } else fn(); } // Each time an image is loaded, check to see if we can fire the event. function imageHasLoaded(e) { // Ensure we still have functions to execute. if (!window.$onImagesLoaded) return; // Reduce the number of images left. try { window.$loadedImageCount--; } catch(ex) {} // If we've reached 0 or the tolerance, fire the events. if ((window.$loadedImageCount||0) = (window.$imagesLoadedTolerance||0)) { for (var i=0;iwindow.$onImagesLoaded.length;i++) { if ($.isFunction(window.$onImagesLoaded[i])) window.$onImagesLoaded[i](); } window.$onImagesLoaded = null; } } -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Karl Rudd Sent: Friday, March 07, 2008 4:31 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: How to know if the entire page has loaded, AFTER it has loaded? [advanced] Use the good old load event. $(window).load(function () { // run code }); ( fromhttp://docs.jquery.com/Events/load) Karl Rudd On Fri, Mar 7, 2008 at 11:10 PM, Iair Salem [EMAIL PROTECTED] wrote: Sorry about not being so clear: what I exactly want is to know if window has loaded. I need to be sure if all the IMAGES had been loaded, that's why jQuery.isReady is useless for me. jquery.isReady equals true when DOM is loaded, but not the images. I hope someone could help me. Iair Salem. PD: Please Google do something about the delay for a message to be seen and searchable on the group. On 7 mar, 09:11, Ariel Flesler [EMAIL PROTECTED] wrote: As far as I know, document.ready will execute functions right away if the dom is ready. Also you can use: if( jQuery.isReady ). On 6 mar, 17:46,IairSalem[EMAIL PROTECTED] wrote: Hello everyone, I have a problem The basics: $(document).ready(function(){alert(DOM Loaded)}); $(window).load(function(){alert(Full Page Images Loaded)}); But, what happens if I do this?: $(window).load(function(){ setTimeout(foo(), 2000); ); function foo(){ $(window).load(function(){alert(this alert will never occur)}); / *calling window load() after it has been called once results in nothing happening*/ } This beaviour isn't the same as $(document).ready, because $ (document).ready is handled by jQuery, and jQuery sets jQuery.isReady = true, and calls it inmediately. Maybe I'm asking for the property jQuery.isPageLoaded which would tell me if the entire page has loaded, also AFTER the page has loaded (for example in a click event). There is a dirty workaround: var isPageLoaded = false; $(window).load( function(){ isPageLoaded=true;} ); This will workaround the problem and fix it partially (because in theory this won't work when loading scripts dinamically) If you have a better solution, please share it with the group. Thank you, IairSalem
[jQuery] Re: Issues with Backwards Traversing the DOM
Thanks David. This was requested by my boss to use this for this particular page, but I agree about the span or div tag. As far as the jQuery code, that's exactly what I ended up doing after reading a bit more in the jQuery in Action book. Thanks for help though! Cheers. Joe On Mar 7, 10:28 am, David Stamm [EMAIL PROTECTED] wrote: This code worked for me: $(#mainCol ul li a).each(function() { var headerText = $(this).parent().siblings(h1).text(); $(this).attr(title, headerText ); }); Also, you might want to consider using something other than an h1 tag. Strictly speaking, that tag is supposed to represent the document's header, rather than the header of an individual element. I'd recommend using a div or span tag instead. David On Mar 6, 11:32 am, Joe [EMAIL PROTECTED] wrote: So I'm having an issue attempting to traverse back in a li element to grab the text inside a header tag and insert that text as the title attribute's value in a link. The markup will more more sense: div id=mainCol ul li h1Header 1/h1 pSome nice text here./p pa href=url title=Click Here!/a/p /li li h1Header 2/h1 pSome nice text here./p pa href=url/a/p /li /ul /div !-- End of Main Column -- $(document).ready(function(){ // Add title to each link in the main content column's unordered list for each list element by using the h1 tag's text. $('#mainCol ul li a').each(function(){ // Grab the header text of this link's header parent $(this).parents().size()); }); }); // End of ready function. Clearly this script won't execute what I need, but the size is 0 and I can't seem to traverse up the DOM to grab the h1 tag's text with combinations using parent, parents, siblings, etc.. Any suggestions?
[jQuery] Re: jqGrid final preview
Wow, this plugin is quite impressive! Nice job!
[jQuery] Re: How to know if the entire page has loaded, AFTER it has loaded? [advanced]
Iair, so what you are saying is that you want to know if, at any point in time, there are any page elements that are still loading? for example, if a mouse click appends a script to the page you need to know if the script has loaded or not? If that's the case, then I've been also trying to get this functionality as well, but with no great results. In the case of scripts in particular what I've done is set up a timer that checks for a specific function contained in that script. If the function exists, it meas the script has loaded; otherwise the script is still loading (or the function does not exist, or the path of the script is incorrect). Perhaps a timer that checks if an element exists ($ (selector).length0) should do the trick for all types of files (scripts,styles, imgs etc)?
[jQuery] Re: Interface - Sortable Float with Child nodes issue?
I am encountering this same issue with the following structure: div id=sortme div id=item1 blah div class=blahtext here/div blah /div div id=item2 blah div class=blahtext here/div blah /div div id=item3 blah div class=blahtext here/div blah /div div id=item4 blah div class=blahtext here/div blah /div /div Interestingly, it works in IE7. In Firefox, the items are grabbable, but not droppable (divs dont move out of the way, dropping it puts it back in original position). Each image has a float: left attribute, as soon as I take it out, everything works. blainegarrett wrote: Hi, I am not sure if this is the appropriate list to post to, but the Interface site says to post bugs, issues, etc to the main trac for jQuery. Anywho, I am having issues with floating sortables when the sortables have child elements. My situation is that I have a bunch of floating fixed width LI slides and inside of the LI tags is an IMG tag. I can grab an LI but the other slides do not move out of the way to allow for a place to drop. I took the working float demo and wrapped the image tags in LIs and it created the same broken effect. I know Scriptaculous's sortables works, and so I was digging around in their code, but I am not an expert JS developer so I can't really say much, but it appears that JQuery droppables isn't detecting the item as being of the acceptable css class since the child nodes are being selectable. It sounds like jquery's UI library also has drag and drop, but I have read it is very buggy, which is compounded by the fact that the demos are broken for me. If there is a jquery based alternative to sortables that works, I am willing to check it out. Thanks in advance! Blaine -- View this message in context: http://www.nabble.com/Interface---Sortable-Float-with-Child-nodes-issue--tp14652503s27240p15902149.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Make List Element Clickable
Thanks Dan. My solution was very similar, but I like yours as well. I do use Firebug religiously so I will definitely take your tip on dumping things into the console. Cheers. Joe On Mar 6, 4:59 pm, Dan G. Switzer, II [EMAIL PROTECTED] wrote: Joe, I would like to make the element list element clickable on the hovering of the list element. I can't seem to traverse the DOM and grab the a tag's href value for the CURRENT list element that is being hovered over. $(#mainCol ul li).hover(function() { $(this).addClass(highlight).css(cursor,pointer).click(function() { //location.href= will be used when this works! var x = $(this).attr('href'); The this object is going to refer to your li tag. You can get what you want be doing: var x = $(a, this).attr('href'); - or - var x = $(this).find(a).attr('href'); You also might want to use a selector of a to make sure you only grab anchor tags that are direct descendents of the li tag. Also, I'd recommend using Firefox and the Firebug extension. Dumping items to the console is a very good way to find out what object this is referring to. -Dan
[jQuery] Referencing relative to $(this)
Hi all, I've been using jQuery for a few months now and I've built a simple little slide down link list that looks like: jQuery bit: var mouseDelay = 250; $(document).ready(function(){ $('#qlink_search p').hide(); $('#qlink_search h2').mouseover(function() { timeMain=setTimeout(function(){$('#qlink_search p').slideToggle('fast');}, mouseDelay); }); $('#qlink_search h2').mouseout(function() { clearTimeout(timeMain); }); }); html bit div id=qlinks div id=qlink_search h2 class=qlink_headerSearch Engines/h2 p class=qlink_item firsta href=http://google.com; target=_blankGoogle/a/p p class=qlink_itema href=http://clusty.com; target=_blankClusty/a/p p class=qlink_itema href=http://msn.com; target=_blankMSN/ a/p p class=qlink_itema href=http://altavista.com; target=_blankAlta Vista/a/p p class=qlink_itema href=http://yahoo.com; target=_blankYahoo! /a/p p class=qlink_item lasta href=http://metacrawler.com; target=_blankMetacrawler/a/p /div /div The links start out hidden and when you mouse over the h2 section heading the items toggle slide visibility. Pretty easy and it works fine. My problem comes up as the list of sections grows I need to add another jQuery code block referencing the second section and the third on and on. What I'd like to do is something like: var mouseDelay = 250; $(document).ready(function(){ $('#qlinks div p').each(function (i) { $(this).hide(); }); $('#qlinks div h2').mouseover(function() { timeMain=setTimeout(function(){?.slideToggle('fast');}, mouseDelay); }); $('#qlinks div h2').mouseout(function() { clearTimeout(timeMain); }); }); Looping over all the sections and using $(this) in some way to select the correct elements. $(this) for the second selector above will be the h2 element. My question is: is it possible to reference all the p elements under $(this) h2? Can $(this) be manipulated to make relative references? Am I WAY OFF on how to do this and making it more difficult than it needs to be? Please help anyone! Thanks
[jQuery] VTD-XML 2.3 released
Version 2.3 of VTD-XML (http://vtd-xml.sf.net), the next generation document-centric XML processing model, is now released. To download the latest version please visit http://sourceforge.net/project/showfiles.php?group_id=110612package_id=120172. Below is a list of new features and enhancements in this version. * VTDException is now introduced as the root class for all other VTD- XML's exception classes (per suggestion of Max Rahder). * Transcoding capability is now added for inter-document cut and paste. You can cut a chuck of bytes in a UTF-8 encoded document and paste it into a UTF-16 encoded document and the output document is still well-formed. * ISO-8859-10, ISO-8859-11, ISO-8859-12, ISO-8859-13, ISO-8859-14 and ISO-8859-15 support has now been added * Zero length Text node is now possible. * Ability to dump in-memory copy of text is added. * Various code cleanup, enhancement and bug fixes. Below are some new articles related to VTD-XML * Index XML documents with VTD-XML http://xml.sys-con.com/read/453082.htm * Manipulate XML content the Ximple Way http://www.devx.com/xml/Article/36379 * VTD-XML: A new vision of XML http://www.developer.com/xml/article.php/3714051 * VTD-XML: XML Processing for the future http://www.codeproject.com/KB/cs/vtd-xml_examples.aspx
[jQuery] datepicker
Hello, Is there a way to make the datepicker select future dates? Is there a way to make the datepicker select specific days (ex. Sundays and Wednesdays only) ? Thanks
[jQuery] Re: Validation jQuery plugin - onfocusout throws error
Validate elements (except checkboxes/radio buttons) on blur. If nothing is entered, all rules are skipped, except when the field was already marked as invalid. I want $.validate() to validate my form element on blur, so I set onfocusout to true. Althought it says by default it is set to true, but my form element is not validated on blur, why? Thank you. On Mar 7, 9:00 am, Jörn Zaefferer [EMAIL PROTECTED] wrote: henry schrieb: jquery: 1.2.3 jquery validation plugin: 1.2.1 I have: form id=myform name=myform ... /form $().ready(){ $(#myform).validate({onfocusout:true}); } firebug error message validator.settings[on + event.type].call is not a function on jquery.validate.js line 250 same error msg is thrown with onkeyup as well... Why?? You can pass a function and a boolean-false as the argument to those. What are you trying to achieve with true? Jörn- Hide quoted text - - Show quoted text -
[jQuery] Re: Using JQuery Effects in Parent Window from iFrame?
I beat my head against this wall for quite some time. Try this: $(#myid, top.document); the top.document tells the selector to target the myid element which exists in the topmost document (your parent page). In order for this to work, jquery must be loaded in the file which is viewed through the iframe. On Mar 6, 6:24 pm, ABecks [EMAIL PROTECTED] wrote: Hello, I have a simple HTML file with an iframe. Inside the iframe is a simple submission form. I would like to be able to click Submit and have Jquery append content to a div that is outside of the iframe. I have exhausted my knowledge of parent heirarchy in JS trying to find a solution. I couldn't find a solution in the Wiki or on Google. Any help is appreciated, Andrew -- View this message in context:http://www.nabble.com/Using-JQuery-Effects-in-Parent-Window-from-iFra... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: datepicker
For the first: As long as you do not explicitly set the maxDate option (http:// docs.jquery.com/UI/Datepicker/datepicker#options), there isn't any problem selecting dates in the future For the second: I'm no expert on the datepicker and all it's inner workings and that, but if i had to do what you request and had to have it done fast, i'd tie into the onSelect method, use javascript's .getDay() method to see if it's 0 (for Sunday) or 3 (Weds) and if it's not, clear out the value of the textbox On Mar 7, 2:28 pm, Ahmad [EMAIL PROTECTED] wrote: Hello, Is there a way to make the datepicker select future dates? Is there a way to make the datepicker select specific days (ex. Sundays and Wednesdays only) ? Thanks
[jQuery] Best method for detecting the depth of childed ordered list...
I'm trying to get the depth of an ordered list. I need to know what the deepest branch of the list is. My data looks like: ul li Item 1 ul li Item 1.a /li li Item 1.b /li /ul /li li Item 2 /li li Item 3 ul li Item 3.a ul liItem 3.a.i/li liItem 3.a.ii/li liItem 3.a.iii/li /li li Item 3.b /li /ul /li li Item 4 /li /ul I need to know that the deepest branch is 3 nodes deep (i.e. Item 3.a.i). I can get this using recursion or loop through all the ul nodes, but I'm wondering if I'm missing an obviously selector that will get me the same information. -Dan
[jQuery] jquery tabs: For ajax tabs, how do I trigger event handler when tab loads?
Hi, I'm using Jquery tabs from here -- http://www.stilbuero.de/2006/05/13/accessible-unobtrusive-javascript-tabs-with-jquery/. I'm using the AJAX feature so that clicking on a tab loads content from another page on my server. How do I set up an event handler so that when the content loads into the tab, the event handler is fired? Thanks, - Dave Here's my code so far ... var tabSelected = $('#tabcontent ul').tabs().bind('select.ui-tabs', function(e, ui) { ... }).bind('show.ui-tabs', function(e, ui) { ... }).data('selected.ui-tabs');
[jQuery] every nth element - photo grid arranging
I basically want to create a grid of items from a list. For example I want a new row after every 4th element. So I will have all of these elements doing a float left, but I need to do a clear:all after each 4th element. The end goal is to be able to do a sortable or drag and drop to reorder these items (pictures arranged in an album). I'd kind of like to do something like Flickr (if you've seen how they rearrange photos in an album). Has anyone done anything like that? I'm hoping the new UI version might lend aid in the final product.
[jQuery] Re: every nth element - photo grid arranging
I did this: $('ul li:nth-child(5n)').css(clear,both); It's still having a strange output: http://education.llnl.gov/sme/photos.lasso On Mar 7, 1:33 pm, Shelane [EMAIL PROTECTED] wrote: I basically want to create a grid of items from a list. For example I want a new row after every 4th element. So I will have all of these elements doing a float left, but I need to do a clear:all after each 4th element. The end goal is to be able to do a sortable or drag and drop to reorder these items (pictures arranged in an album). I'd kind of like to do something like Flickr (if you've seen how they rearrange photos in an album). Has anyone done anything like that? I'm hoping the new UI version might lend aid in the final product.
[jQuery] Re: Referencing relative to $(this)
Hi there, Provided that your expanded HTML structure will look something like this ... div id=qlinks div id=qlink_search h2 class=qlink_headerSearch Engines/h2 p class=qlink_item firsta href=http://google.com; target=_blankGoogle/a/p p class=qlink_itema href=http://clusty.com; target=_blankClusty/a/p p class=qlink_itema href=http://msn.com; target=_blankMSN/ a/p p class=qlink_itema href=http://altavista.com; target=_blankAlta Vista/a/p p class=qlink_itema href=http://yahoo.com; target=_blankYahoo!/a/p p class=qlink_item lasta href=http://metacrawler.com; target=_blankMetacrawler/a/p /div div id=qlink_something h2 class=qlink_headersomething/h2 p class=qlink_item first.../p p class=qlink_item.../p p class=qlink_item last.../p /div div id=qlink_somethingelse h2 class=qlink_headersomething else/h2 p class=qlink_item first.../p p class=qlink_item.../p p class=qlink_item last.../p /div /div try this ... var mouseDelay = 250; $(document).ready(function(){ $('#qlinks div p').hide(); // -- you don't need the .each() here $('#qlinks div h2').hover(function() { // -- use hover instead of separate mouseover/mouseout timeMain=setTimeout(function(){ $ (this).siblings('p').slideToggle('fast');}, mouseDelay); }, function() { clearTimeout(timeMain); }); }); --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Mar 7, 2008, at 1:58 PM, pmcelroy wrote: Hi all, I've been using jQuery for a few months now and I've built a simple little slide down link list that looks like: jQuery bit: var mouseDelay = 250; $(document).ready(function(){ $('#qlink_search p').hide(); $('#qlink_search h2').mouseover(function() { timeMain=setTimeout(function(){$('#qlink_search p').slideToggle('fast');}, mouseDelay); }); $('#qlink_search h2').mouseout(function() { clearTimeout(timeMain); }); }); html bit div id=qlinks div id=qlink_search h2 class=qlink_headerSearch Engines/h2 p class=qlink_item firsta href=http://google.com; target=_blankGoogle/a/p p class=qlink_itema href=http://clusty.com; target=_blankClusty/a/p p class=qlink_itema href=http://msn.com; target=_blankMSN/ a/p p class=qlink_itema href=http://altavista.com; target=_blankAlta Vista/a/p p class=qlink_itema href=http://yahoo.com; target=_blankYahoo! /a/p p class=qlink_item lasta href=http://metacrawler.com; target=_blankMetacrawler/a/p /div /div The links start out hidden and when you mouse over the h2 section heading the items toggle slide visibility. Pretty easy and it works fine. My problem comes up as the list of sections grows I need to add another jQuery code block referencing the second section and the third on and on. What I'd like to do is something like: var mouseDelay = 250; $(document).ready(function(){ $('#qlinks div p').each(function (i) { $(this).hide(); }); $('#qlinks div h2').mouseover(function() { timeMain=setTimeout(function(){?.slideToggle('fast');}, mouseDelay); }); $('#qlinks div h2').mouseout(function() { clearTimeout(timeMain); }); }); Looping over all the sections and using $(this) in some way to select the correct elements. $(this) for the second selector above will be the h2 element. My question is: is it possible to reference all the p elements under $(this) h2? Can $(this) be manipulated to make relative references? Am I WAY OFF on how to do this and making it more difficult than it needs to be? Please help anyone! Thanks
[jQuery] Keyup differences among browsers
While investigating the various key events, I've run into some interesting findings. I wanted to post them here to have others confirm/deny my findings. First off, I was working with the TAB key (keyCode: 9) and found out quickly that IE does not fire the keypress event for the TAB key. PPK has a good a href='http://www.quirksmode.org/js/keys.html'resource page/a about detecting keystrokes. Once I switched to using keyup, all of the browsers I was testing with fired on TAB, but with differing results: a href='http://www.ericmmartin.com/code/jquery/keyup.html'http:// www.ericmmartin.com/code/jquery/keyup.html/a The results: - Firefox 2 3: results mostly as expected. after 1 cycle, the tab back into the content selects the body and returns an undefined target, but still triggers a keyup event - IE7 6: results not as expected. initial tab to the first element, in this case the text input, does not trigger a keyup event - Safari 2: results as expected - Opera 9: results mostly as expected. unlike all other browsers, tabbing does not cycle through the browser controls, only through the elements on the page I thought it was interesting how each of the browsers handled tabbing differently. The lack of a keyup event in IE is frustrating...anyone know of a workaround?
[jQuery] Re: get value of checked checkboxes into a list
I'm trying exactly the same. $(input:checkbox:checked); returns a set of jQuery elements $(input:checkbox:checked).val(); returns the value of the first element in the set. I really wanted to get an array with all the values, or even a string, without the need to iterate over each of the elements. Thanks jeangougou wrote: Updating jQuery to 1.2 gives you all the values, as you can see here: http://docs.jquery.com/Attributes/val else you can use a plugin http://www.malsup.com/jquery/form/#fields pay attention for the result, it might be an array. i haven't checked that yet. Good luck Duncan ha scritto: All, I am lost right now, still pretty green with jQuery. I have a number of checkboxes on a page input type=checkbox name=listProductID value=2 input type=checkbox name=listProductID value=3 input type=checkbox name=listProductID value=4 input type=checkbox name=listProductID value=5 and a button at the end. button name=editOptions id=editOptionsEdit /button I would like to have the value of alll checked checkboxes put into a list for use in a variable. how would I go about this? $().ready(function() { $('#editOptions').click(function(){ alert($('#listProductID').val());//returns only the first value, selected or not }); }); Thanks -- Duncan I Loxton [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/get-value-of-checked-checkboxes-into-a-list-tp14750244s27240p15906685.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: jqGrid final preview
I stand corrected, Tony. Fantastic! Thank you for the clarification. That'll teach me to be eager.
[jQuery] Re: callbacks calling callbacks calling callbacks ....
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 exactly this nesting looks fine with no real code behind but it is just cruel if you imagine having error-handling, rollbacks and business logic etc within. what im looking for is some pattern abstracting the async-callbacks or just a real-world example/solution of someone having the same issues with logic involving multiple, dependent ajax-calls. thanks, kai- Hide quoted text - - Show quoted text -
[jQuery] Re: get value of checked checkboxes into a list
Gonna have to iterate. jquery selector gives you a jquery object. $(input:checkbox:checked).each() is your friend. On Mar 7, 3:27 pm, Rafael Soares [EMAIL PROTECTED] wrote: I'm trying exactly the same. $(input:checkbox:checked); returns a set of jQuery elements $(input:checkbox:checked).val(); returns the value of the first element in the set. I really wanted to get an array with all the values, or even a string, without the need to iterate over each of the elements. Thanks jeangougou wrote: Updating jQuery to 1.2 gives you all the values, as you can see here: http://docs.jquery.com/Attributes/val else you can use a plugin http://www.malsup.com/jquery/form/#fields pay attention for the result, it might be an array. i haven't checked that yet. Good luck Duncan ha scritto: All, I am lost right now, still pretty green with jQuery. I have a number of checkboxes on a page input type=checkbox name=listProductID value=2 input type=checkbox name=listProductID value=3 input type=checkbox name=listProductID value=4 input type=checkbox name=listProductID value=5 and a button at the end. button name=editOptions id=editOptionsEdit /button I would like to have the value of alll checked checkboxes put into a list for use in a variable. how would I go about this? $().ready(function() { $('#editOptions').click(function(){ alert($('#listProductID').val());//returns only the first value, selected or not }); }); Thanks -- Duncan I Loxton [EMAIL PROTECTED] -- View this message in context:http://www.nabble.com/get-value-of-checked-checkboxes-into-a-list-tp1... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Identifying a specific UI element
Hello! I wonder if you can help as I'm new to JQuery. I'm looking for a particular UI element which can be seen used on many GUI applications but whose name I don't know. Here is what it does: - Consider a long list of short phrases - possibly, a list of thousands of short phrases - Search with autocompletion for a phrase in SearchBox - The LeftBox underneath the SearchBox displays a number of phrases - LeftBox has scroll bars - When a user finds and selects a phrase they can move it to an adjacent RightBox by clicking the Move button in the MiddlePanel which sits between the LeftBox and RightBox. - The MiddlePanel also has a Remove button to remove selected items from the RightBox That's it. If I can find out what the name of this UI element is I can then see if a JQuery plugin or code exists. Thanks! Dinesh
[jQuery] jQuery.form error handling
I've noticed that if i define error callback function within the options parameter of ajaxForm, it is called only if request is failed (if there is no response from provided url). When i return some http error from my serverside script (like 404, 401...) success callback is called. I have habit to treat those returns as errors, because $.ajax treat them like that (only when http ok response is returned, success callback is called, and there is some other response (404,403,401) error callback is called. Is there any chance that this will be corrected, or i'm missing the point Thanx
[jQuery] Re: get value of checked checkboxes into a list
I'm trying exactly the same. $(input:checkbox:checked); returns a set of jQuery elements $(input:checkbox:checked).val(); returns the value of the first element in the set. I really wanted to get an array with all the values, or even a string, without the need to iterate over each of the elements. var valArray = $('input:checkbox').serializeArray(); 'tis beautiful!
[jQuery] Re: jQuery.form error handling
I've noticed that if i define error callback function within the options parameter of ajaxForm, it is called only if request is failed (if there is no response from provided url). When i return some http error from my serverside script (like 404, 401...) success callback is called. I have habit to treat those returns as errors, because $.ajax treat them like that (only when http ok response is returned, success callback is called, and there is some other response (404,403,401) error callback is called. Is there any chance that this will be corrected, or i'm missing the point That will happen if you are uploading files. Is that the case? The file upload logic does not use ajax and there is really no way to determine the status of the server response. Mike
[jQuery] Re: Using jQuery without ready()
moving to the end of ready() isn't solution. we'll have flickering anyway. i'm not learning jQuery, i'm just using it. we can use simple JS in described way and I just want to know could we do same with jQuery. if it has some onload actions inside thier core, then we can't. it's question for jQuery developers in general.
[jQuery] [validate]
I found out how to validate multiple form elements. no problem with that. but... how can i sent each form to a specific address(action)? because the default submit handler redirects the request to the same action. any suggestions?? thx
[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: get value of checked checkboxes into a list
Rafael, I'm trying exactly the same. $(input:checkbox:checked); returns a set of jQuery elements $(input:checkbox:checked).val(); returns the value of the first element in the set. I really wanted to get an array with all the values, or even a string, without the need to iterate over each of the elements. My Field Plug-in has a method called fieldArray() which will do exactly what you're looking to do: http://jquery.com/plugins/project/field -Dan
[jQuery] Re: Using jQuery without ready()
On Mar 5, 7:33 am, MorningZ [EMAIL PROTECTED] wrote: A good trick for that is to hide the content you are manipulating, and then for the last line of the Ready() event, do a .show() and now the only thing the user will see is styled and complete elements And if scripting isn't supported or fails, the visitor sees nothing. Also, they don't see anything until the page finishes loading. That was the default behaviour for about Navigator 2 I think, and was pretty quickly changed because surfers *expect* to see the page as it loads and not to stare at a blank page until everything is loaded. I think what people are trying to get through to you, and i wholeheartedly agree, is that it wouldn't necessarily be best practice to do what you point out in your first post, and if you are learning to use jQuery, why not do so in the way it was designed and used most widespread Best practice is simply a point of view. Using a script at the bottom of the page has the advantage of working more reliably and it allows the page to load faster. -- Rob
[jQuery] Re: Keyup differences among browsers
FWIW, I tested that page in IE7, and here's what happened. 1. Page loaded. 2. I pressed tab, and the address bar was selected (d'oh) 3. So I clicked on the page. 4. Pressed tab, first text element selected, key-up event fired, keycode: 9 :: target type: text / target name: text 5. Pressed tab, second textara element selected, key-up event fired, keycode: 9 :: target type: textarea / target name: textarea 6. Pressed tab, dropdown list selected, key-up event fired, keycode: 9 :: target type: select-one / target name: select 7. Pressed tab, button selected, key-up event fired, keycode: 9 :: target type: button / target name: button 8. Pressed tab, submit button selected, key-up event fired, keycode: 9 :: target type: submit / target name: submit 9. Pressed tab, addressed bar selected again. Note that I followed that exact same cycle in FF 2.0.0.12 with identical results. This is the desired behavior, no? JK -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Eric Martin Sent: Friday, March 07, 2008 1:41 PM To: jQuery (English) Subject: [jQuery] Keyup differences among browsers While investigating the various key events, I've run into some interesting findings. I wanted to post them here to have others confirm/deny my findings. First off, I was working with the TAB key (keyCode: 9) and found out quickly that IE does not fire the keypress event for the TAB key. PPK has a good a href='http://www.quirksmode.org/js/keys.html'resource page/a about detecting keystrokes. Once I switched to using keyup, all of the browsers I was testing with fired on TAB, but with differing results: a href='http://www.ericmmartin.com/code/jquery/keyup.html'http:// www.ericmmartin.com/code/jquery/keyup.html/a The results: - Firefox 2 3: results mostly as expected. after 1 cycle, the tab back into the content selects the body and returns an undefined target, but still triggers a keyup event - IE7 6: results not as expected. initial tab to the first element, in this case the text input, does not trigger a keyup event - Safari 2: results as expected - Opera 9: results mostly as expected. unlike all other browsers, tabbing does not cycle through the browser controls, only through the elements on the page I thought it was interesting how each of the browsers handled tabbing differently. The lack of a keyup event in IE is frustrating...anyone know of a workaround?
[jQuery] A simple loop - but I can't do it
Hi folks, I have a form (id=sshoweditor) containing - let's say 6 - fieldsets, each containing an input element. The fieldsets have a unique ID - fs0, fs1, ... fs5. I have a function that can delete any specific fieldset. My looping problem comes now - when the fieldset is removed, I want to renumber the remaining fieldsets. $(#fs+ej).highlightFade({color:'yellow',speed:2000,iterator:'sinusoidal'}).animate({opacity: 1.0}, 1000).fadeOut(500).remove(); var n = parseInt($(#howmany).attr(value))-1; $(#howmany).attr(value,n); var z = 0; $(#sshoweditor fieldset).each(function(t){ ( { id : fs + z} ); z=z+1; }); My code doesn't throw an error - but it doesn't produce a result either. Can someone guide me here. Thanks Bruce
[jQuery] Re: How to know if the entire page has loaded, AFTER it has loaded? [advanced]
Sure, here you go: http://www.lawcrime.com/ JK -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Chris J. Lee Sent: Friday, March 07, 2008 10:13 AM To: jQuery (English) Subject: [jQuery] Re: How to know if the entire page has loaded, AFTER it has loaded? [advanced] This is great! Could you possibly show me an example of this online? On Mar 7, 12:12 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote: This may be out of left field from what you're asking but I wrote a script called onImagesLoaded, with a tolerance setting. I used this to fire the jquery.flash.js script only after most of the images had been downloaded. Some sites I've coded were overly image-heavy with the Flash at the top of the page, so it would tend to make an ugly user-experience. If they're of any value to you, here they are: // Fire a specific event once all images are loaded. function onImagesLoaded(fn,tolerance) { // Ensure we have a valid function. if (!$.isFunction(fn)) return; var images = $('img').filter(function(el,i) { return !this.complete; }); if (images.length) { window.$loadedImageCount = images.length; window.$imagesLoadedTolerance = $.toInt(tolerance); if (!window.$onImagesLoaded) window.$onImagesLoaded = []; window.$onImagesLoaded.push(fn); images.one('load',imageHasLoaded); } else fn(); } // Each time an image is loaded, check to see if we can fire the event. function imageHasLoaded(e) { // Ensure we still have functions to execute. if (!window.$onImagesLoaded) return; // Reduce the number of images left. try { window.$loadedImageCount--; } catch(ex) {} // If we've reached 0 or the tolerance, fire the events. if ((window.$loadedImageCount||0) = (window.$imagesLoadedTolerance||0)) { for (var i=0;iwindow.$onImagesLoaded.length;i++) { if ($.isFunction(window.$onImagesLoaded[i])) window.$onImagesLoaded[i](); } window.$onImagesLoaded = null; } } -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Karl Rudd Sent: Friday, March 07, 2008 4:31 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: How to know if the entire page has loaded, AFTER it has loaded? [advanced] Use the good old load event. $(window).load(function () { // run code }); ( fromhttp://docs.jquery.com/Events/load) Karl Rudd On Fri, Mar 7, 2008 at 11:10 PM, Iair Salem [EMAIL PROTECTED] wrote: Sorry about not being so clear: what I exactly want is to know if window has loaded. I need to be sure if all the IMAGES had been loaded, that's why jQuery.isReady is useless for me. jquery.isReady equals true when DOM is loaded, but not the images. I hope someone could help me. Iair Salem. PD: Please Google do something about the delay for a message to be seen and searchable on the group. On 7 mar, 09:11, Ariel Flesler [EMAIL PROTECTED] wrote: As far as I know, document.ready will execute functions right away if the dom is ready. Also you can use: if( jQuery.isReady ). On 6 mar, 17:46,IairSalem[EMAIL PROTECTED] wrote: Hello everyone, I have a problem The basics: $(document).ready(function(){alert(DOM Loaded)}); $(window).load(function(){alert(Full Page Images Loaded)}); But, what happens if I do this?: $(window).load(function(){ setTimeout(foo(), 2000); ); function foo(){ $(window).load(function(){alert(this alert will never occur)}); / *calling window load() after it has been called once results in nothing happening*/ } This beaviour isn't the same as $(document).ready, because $ (document).ready is handled by jQuery, and jQuery sets jQuery.isReady = true, and calls it inmediately. Maybe I'm asking for the property jQuery.isPageLoaded which would tell me if the entire page has loaded, also AFTER the page has loaded (for example in a click event). There is a dirty workaround: var isPageLoaded = false; $(window).load( function(){ isPageLoaded=true;} ); This will workaround the problem and fix it partially (because in theory this won't work when loading scripts dinamically) If you have a better solution, please share it with the group. Thank you, IairSalem
[jQuery] Re: every nth element - photo grid arranging
Here's one way: $(function(){ newRowAt = 5; inc = newRowAt - 1; $('li').each(function(i){ if(newRowAt == i + 1){ $(this).css('clear','left'); newRowAt += inc; } }); }); - jason On Mar 7, 4:52 pm, Shelane [EMAIL PROTECTED] wrote: I did this: $('ul li:nth-child(5n)').css(clear,both); It's still having a strange output: http://education.llnl.gov/sme/photos.lasso On Mar 7, 1:33 pm, Shelane [EMAIL PROTECTED] wrote: I basically want to create a grid of items from a list. For example I want a new row after every 4th element. So I will have all of these elements doing a float left, but I need to do a clear:all after each 4th element. The end goal is to be able to do a sortable or drag and drop to reorder these items (pictures arranged in an album). I'd kind of like to do something like Flickr (if you've seen how they rearrange photos in an album). Has anyone done anything like that? I'm hoping the new UI version might lend aid in the final product.