[jQuery] Re: format number
Doh...thank you Karl for saving my behind. Parse Int won't work...coffee hadn't kicked in yet. Cheers, - Jonathan On Mon, Oct 5, 2009 at 6:58 PM, Karl Swedberg k...@englishrules.com wrote: On Oct 5, 2009, at 11:43 AM, Jonathan Sharp wrote: You can run a parseint on the number: var myInt = parseInt( '15,000', 10); Cheers, - Jonathan http://jqueryminute.com Oops. that's not such a good idea. It'll return 15. ;-) There are probably much better ways of doing this, but one way is to use a regex replace: var someFormattedNumber = '15,000'; +someFormattedNumber.replace(/\D/g,'') --Karl Karl Swedberg www.englishrules.com www.learningjquery.com
[jQuery] Re: Quick question on image loading
Hi Eric, The browser will replace the image first before loading it. What you can do to preload the image is as follows: var newBackgroundImage = '/new/image/url.png'; $('img /') .attr('src', newBackgroundImage) .bind('load', function() { $('div').css('background-image', 'url(' + newBackgroundImage + ')'); }); This starts by creating a new image element and setting the source of it to the background image which will start loading it in the browser. Then we bind to the image's load event which is triggered when the image has finished loading. In the load callback function you can then set the css background image of your div and the image will already be in the browser's cache and load instantly. Cheers, - Jonathan http://jqueryminute.com On Mon, Oct 5, 2009 at 2:25 AM, Erock ethetenniss...@gmail.com wrote: My question is, if I have one image as the background of a div, and I set the background of that div to another image, will html load the new image before replacing the old one or replace the old image with something ugly (say just plain white) and then load it. The reason I'm asking is, because my site isn't hosted anywhere, it's hard to tell what will happen on a non-local connection when the images actually have to be loaded. Thanks Eric
[jQuery] Re: textContent attribute problem with ie
What are you trying to do? On Mon, Oct 5, 2009 at 11:37 AM, m.ugues m.ug...@gmail.com wrote: HAllo all. This piece of code works fine in FIrefox but does not work in IE. http://pastie.org/642444 The problem is on textContent attribute that in IE is undefined. Any workaround? Kind regards Massimo UGues
[jQuery] Re: How to Add A Callback Function to a plugin
$.fn.myPlugin = function(options) {options $.extend({ callback: null }, options); // Your plugin if ( $.isFunction(options.callback) ) { options.callback.call(); } }; $('div').myPlugin({ callback: function() { // Your callback code } }); A better approach might be to simply have your plugin do a .trigger('pluginevent') which allows for multiple listeners to then use it: $.fn.myPlugin = function() { // Your plugin code $(this).trigger('myplugindidsomething'); }; $('div') .myPlugin() .bind('myplugindidsomething', function() { // Your callback code }); Cheers, - Jonathan http://jqueryminute.com On Mon, Oct 5, 2009 at 3:10 PM, bittermonkey brakes...@gmail.com wrote: How do I add a callback function to a plugin so that i can execute another function after the plugin completes its own processes. Thanks in advance.
[jQuery] Re: get reference to nested appended element
Another approach you can take is: var table = $('tabletrtdtable id=rt0/td/tr/table/td/tr/table') .appendTo( parent ) .find('table'); This creates the HTML and then appends it to the parent. Since you created a jQuery object with that fragment, calling find will locate the inner table. Cheers, - Jonathan On Tue, Apr 7, 2009 at 4:38 AM, miniswi...@gmail.com miniswi...@gmail.comwrote: hi there, see next example: parent.append(tabletrtdtable id=\rt0\//td/tr/table); table = $(#rt0); is it possible to reference the inside table directly without using the id to select it?
[jQuery] Re: Bug in globalEval function
Hi Dan, Can you post a URL to a page that includes the smallest amount of code to reproduce this issue? Cheers, - Jonathan On Tue, Apr 7, 2009 at 2:44 PM, DynamoDan dhaart...@gmail.com wrote: Hi All I've used jQuery a lot over the years, mostly in the joomla CMS context. I think I've found a bug in this function: // Evalulates a script in a global context globalEval: function( data ) { The problem is that if there is a newline inside of a string literal (single quoted) in `data`, then the script fails with an unterminated string literal error. The first thing done to `data` in this function is this (jQuery 1.2.6): data = jQuery.trim( data ); But, this trim function only removes leading and trailing whitespace using a regex, and not with the s modifier to include newlines matching the \s character class. jQuery 1.3.2 omits this call to jQuery.trim, and still exhibits the unterminated string literal error when `data` contains a newline inside of single quotes. I don't know what the solution should be for sure, but for my own purposes I've added this line to globalEval before anything is done with `data`: data = data.replace(/[\r\n\f]+/g, ' '); It works on data that contains carriage returns, newlines, or form feed characters, since these (well, at least the newline) don't work inside single quotes, when evaluated as a javascript. Love to hear if anyone else has had this problem.
[jQuery] Re: Why does my website crash in IE when fading?
Hi Chris, I'd recommend starting by commenting out all code until IE doesn't crash. Then I'd start uncommenting code in smaller blocks until you isolate what starts the IE crash. Cheers, - Jonathan On Mon, Apr 6, 2009 at 8:56 PM, zeckdude zeckd...@gmail.com wrote: My site works fine in Firefox, but it crashes in IE. I am using alot of jQuery in order to fade in content. When the user clicks on one of the above links a few times, it will crash in IE. Here is my site: http://www.idea-palette.com/ http://www.idea-palette.com/ I have absolutely no idea why the site crashes in IE. I don't even know where to begin to debug my problem. I don't have Visual Studio on my computer, but on my friends computer Visual Studio reads a message of An unhandled win32 exception occurred in iexplore.exe[] Does anyone have any ideas? -- View this message in context: http://www.nabble.com/Why-does-my-website-crash-in-IE-when-fading--tp22920819s27240p22920819.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Wrap text between two divs
jQuery doesn't select or operate on text nodes. Here's a plugin I wrote that will capture the text node and wrap it: /*! * jQuery wrapNextTextNode Plugin v1.0 * http://outwestmedia.com/ */ $.fn.wrapNextTextNode = function(wrap) { return this.each(function() { var ns = this.nextSibling; while ( ns ) { if ( ns.nodeType == 3 ) { var node = $(wrap)[0]; ns.parentNode.insertBefore(node , ns); node.appendChild( ns ); break; } ns = ns.nextSibling; } }); }; You'd use it like this: $('#1').wrapNextTextNode('div id=3/div'); Cheers, - Jonathan On Mon, Apr 6, 2009 at 9:56 PM, FameR dj.fa...@gmail.com wrote: Is there way to create element that consists html between two another elements? for exmple: from this div Some st div id=1ra/div nge foobarded div id=2div text goes here /div to: div Some st div id=1ra/div div id=3nge foobarded/div div id=2div text goes here /div or: div Some st div id=3ra nge foobarded div text goes here /div
[jQuery] Re: New to Jquery : Using it on dynmaically created divs
Hi James, Here's one way to rewrite it using jQuery: function divShowHide(divID, imgID) { var d = $('#' + divID).toggle(); $('#' + imageID).attr('src', 'Images/' + ( d.is(':visible') ? 'down' : 'up' ) + 'arrow.png' ); } Cheers, -Jonathan On Oct 23, 2008, at 8:42 AM, James2008 wrote: Hi. At the moment I've creating 2 divs for each record in a database. One to first give a title for that piece of information and the second to be a show/hide div that gives furthur information upon clicking a little arrow. I generate both divs server side on an updatepanel refresh. I have them showing/hiding at the moment using this function... function divShowHide(divID, imgID){ // Hides/Shows the second div and changes arrow appearance var divToChange = document.getElementById(divID); if(divToChange.style.display == block) { divToChange.style.display = none; document.getElementById(imgID).src = Images/downarrow.png; } else { divToChange.style.display = block; document.getElementById(imgID).src = Images/uparrow.png; } } I was wandering if I could incorporate Jquery into this function to make it do the job , or if all the divs have to be created in the head section with jquery beforehand?? I have tried using the show/hide commands in the above function using Jquery but they don't seem to work. Each of my second divs have a unique ID, I just need to know if it's possible to do it in this way?? All the examples on the site use pre-defined names for divs but as I do not know the ammount of div sets before so can't do that. They are all called div2 + a unique identifyier. Any help would be greatly appreciated. Thanks, James
[jQuery] Re: Clarification on the use of JSONP in $.ajax
Hi RWF, You can make a cross site call if the server knows how to speak JSONP. Remy Sharp (no relation) had a great blog post about this a while back: http://remysharp.com/2007/10/08/what-is-jsonp/ Cheers, -Jonathan On Oct 22, 2008, at 6:17 PM, RWF wrote: in the docs: http://docs.jquery.com/Ajax/jQuery.ajax#options it says: As of jQuery 1.2, you can load JSON data located on another domain if you specify a JSONP callback, which can be done like so: myurl? callback=?. jQuery automatically replaces the ? with the correct method name to call, calling your specified callback. Or, if you set the dataType to jsonp a callback will be automatically added to your Ajax request. * Is there an example of this? This makes it sound like I can make a cross site request to a webservice that returns a JSON object and jquery will handle the rest.
[jQuery] Re: how change external html AFTER load using $.load
Hi gtso86, Do you have a URL of the page in question? It may be that you need to call your $('#rapida ul a')... code after $.load() is finished loading the content. You could do this by using the callback argument: $.load(url, [data], function() { $('#rapida ul a')... }); Cheers, -Jonathan On Oct 22, 2008, at 5:32 PM, gtso86 wrote: Hi everybody... this morning i started a project $.load. When i load the html using $load in the main page (default.aspx) i cant interacte with using jQuery. Simple interactives like $('#rapida ul a').click(function () { var url = $(this).attr('href'); alert(url); //$(this).parents().css('border','1px solid red'); }); dont work ONLY in the loaded content. i can manipulate this content?
[jQuery] Re: Question about Shadows on the jQuery Nav Bar
Hi Elke, The dropShadow plugin wasn't used for this. It was accomplished with images and css. If you download Firefox 3 and install the excellent firebug extension (http://www.getfirebug.com) it allows you to inspect the HTML page and see what CSS styles were applied to what elements. Happy browsing! Cheers, -Jonathan On Oct 22, 2008, at 10:46 AM, plumwd wrote: Hi, I am just curious if the dropShadow plugin was used to create the shadows on the nav bar which appears on the jQuery main page at http://www.jquery.com. The nav bar I'm referring to is the one with the rounded corners and has the links for Downloads, Discussion, Documentaton, Tutorials, and the Bug Tracker. I love that effect and would like to implement something similar in a design I'm creating. Thanks! Elke
[jQuery] Re: Cycle: Direct link from another page
Hi Isaac, Do you have a link you could post? It's unclear to me exactly what the question is. Cheers, -Jonathan On Oct 22, 2008, at 6:59 PM, isaacn wrote: Is there a way to do a direct link to an arbitrary slide, from another page? I saw the demo where the link was on the same page, but this would be from somewhere that doesn't really know what slides exist (so it doesn't know which slide is where in the index.) For what it's worth, the slide itself has an ID -- #photo-x (where x is the drupal node ID, not the index of the slide); can Cycle or jQuery grab the URL that was called and match it up to the index, allowing the slide to be directly linked to? Thanks, Isaac
[jQuery] Re: how change external html AFTER load using $.load
Erik is correct that liveQuery will work, but you can also just change where you bind the click event. What you want to do is: function listar(id,tipo,busca){ $('#lista' + tipo + busca).remove(); $('#link' + tipo).after('ul id=lista' + tipo + busca + '/ul'); $('#lista' + tipo + busca).load('vars.html', {}, function() { // this is the dom element #lista + tipo + busca // $('a', this) = find all 'a' tags that are children of 'this' $('a', this).click(function () { var url = $(this).attr('title'); alert(url); }); }); $('#link' + tipo).css('border','1xp solid red'); } Cheers, -Jonathan On Oct 22, 2008, at 7:36 PM, gtso86 wrote: I create a simple test like my problem... because my real problem hosted on blocked domain for external visits. http://www.gabrieltadeu.com/teste/testes.html this example above have the same problem. i need the function $('#rapida ul a').click(function () { var url = $(this).attr('title'); alert(url); }); work with the loaded content. for repeat my probleam: click in 'MG' (this action fire the load content) now, click in 'Belo Horizonte' (this is the load content!) first alert dont appear. :( On 22 out, 21:59, Jonathan Sharp, Out West Media jquery- [EMAIL PROTECTED] wrote: Hi gtso86, Do you have a URL of the page in question? It may be that you need to call your $('#rapida ul a')... code after $.load() is finished loading the content. You could do this by using the callback argument: $.load(url, [data], function() { $('#rapida ul a')... }); Cheers, -Jonathan On Oct 22, 2008, at 5:32 PM, gtso86 wrote: Hi everybody... this morning i started a project $.load. When i load the html using $load in the main page (default.aspx) i cant interacte with using jQuery. Simple interactives like $('#rapida ul a').click(function () { var url = $(this).attr('href'); alert(url); //$(this).parents().css('border','1px solid red'); }); dont work ONLY in the loaded content. i can manipulate this content?
[jQuery] Re: Finding position among siblings
$('div').click(function() { // Will give you the index out of just the DIV tags var index = $(this).parent().find(' ' + this.tagName).index(this); // Will give you the index out of all siblings var index = $(this).parent().find(' *').index(this); }); Cheers, -Jonathan On Tue, Jul 15, 2008 at 10:57 AM, ml1 [EMAIL PROTECTED] wrote: Is there an efficient, cross browser jquery way to find a node's position among it's siblings? Ie if I have ten div nodes next to each other and the user clicks on the third one, what's the best way to tell that it's the third one? Thanks!
[jQuery] Re: internship with a programmer - wanna work for free to learn
Hi Vik, On Thu, Jul 10, 2008 at 4:41 PM, joomlafreak [EMAIL PROTECTED] wrote: ... My impression so far had been that they really are not counted much compared to your experience. It is generally mentioned by people that increasing competition has led to companies using the credentials like degree as a way of scoring the candidates but in the end it is your experience relevant to the need that counts. I think this is right on target but here's where I've seen it vary. In a large corporate setting degree tends to be a check mark for eligibility for employment. Some places take GPA into account and require transcripts (I personally think this matters considerably less than the potential employee's passions.) To contrast this, smaller companies and startups usually tend to look for the experience and care less about the degree. I cut my teeth in a start up environment and that experience has been one of the biggest influences in my career. Also smaller companies may tend to be more flexable in terms of taking on an intern and you'll benefit from a wide range of opportunities (such as programming to hardware systems to networking). Personal networking is going to be your biggest asset in this switch (hence your post here to build your network.) Since this career switch is delving into an area where you don't have previous experience and contacts, this is where the formal degree can be an asset. When you pick a school make sure it's a research oriented program as opposed to a general theory program. A highly research academic setting will give you the networking contacts that you'd need to break into the field and potentially further in without as much relevant experience. A number of startups have come out of the academic settings (*cough* google.) So even going to a university and talking with the faculty may give you the contacts needed to find companies in the early stages that would love to take you on. ... Why I am thinking otherwise, not going formal way which may be wrong completely, is that it is four years to do a degree course which is a big time period and my age factor creates a fear in my mind. I am pretty strong when I say I have taken the decision to switch my career but still it breaks in sometimes. I absolutely know what you're going through and empathize! There will be dozens upon dozens of people that will say you can't do that! and then dozens more after you do it that will say how'd you do that? Please tell me!. I've gone/going through a similar situation in changing jobs but am stepping into a situation in which I have lots of experience and contacts. Still, there are those that will tell you you're crazy. It comes down to this, you can't be afraid of things not working out and have to determine if the risk is worth the potential payoff. I agree that the four years seems like a long time but you have to ask yourself the question, in four years would I rather be an MD or working in the technology field. There will be moments of doubt along the way (I turned in 2 weeks notice and walked out that day thinking WHAT THE HECK HAVE I DONE!) but you have to remind your self at that point what you're working towards. So good luck! Cheers, -Jonathan
[jQuery] Re: AJAX not working
Hi jbhat, Can you post a URL? It's nearly impossible to debug or provide any feedback from reading the code below. Cheers, -Jonathan On Fri, Jul 11, 2008 at 2:51 PM, jbhat [EMAIL PROTECTED] wrote: I am having trouble with AJAX: In document ready i have: $.post(test.php, function(data){alert('Success');}); and test'php is just ?php ?...the alert never comes up This is just a test... In addition to the callback not working, when the php file updates a mySQL database, those updates are never made. Why could this be? I'll put all my js code below: id=0; p1uid = 0; p2uid = null; multiplayer = false; diff=3; p1=true; lock = false; intID = 0; cash = 500; hisCash = 500.5; turn=0; bid=0; hisBid=0; localturn=0; $(function() { if(multiplayer){ $('input.mult').hide(); $('select.mult').hide(); }id = $('form').attr('id'); $.post(test.php, function(data){alert('Success');}); //intID = setInterval(cycle(), 5000); }); function cycle(){ if(!lock){ localturn = turn; updateLocals(); if(turn != localturn) play(); if(turn 4) clearInterval(intID); } } function play(){ if(turn == 0 || turn == 2){ $('input.msg').val(Enter a Bid); }else if(turn == 3){ $('input.msg').val(He bid + stringify(hisBid) + . Make a move!); }else if(turn == 1){ $('input.msg').val(Waiting for opponent to bid.); }else if (turn == 4){ $('input.msg').val(He bid + stringify(hisBid) + . His turn); if(!multiplayer) compMove(); }else{ $('input.msg').val(Game Over!); }$('input.cash').val(stringify(cash)); $('input.hisCash').val(stringify(hisCash)); } function updateLocals(){ lock = true; $.post(update.php, {id: id, player: p1}, function(data){ cash = data[cash]; hisCash = data[hisCash]; turn = data[turn]; bid = data[bid]; hisBid = data[hisBid]; for(i=0; i9; i++){ position = b+i; $(position).val(data[position]); } }, json); lock = false; } function clear_with(form) { lock = true; cash = 500.5; hisCash = 500; turn = 0; for (i=0;i9; ++i) { position=b+i; form[position].value=' '; } form.cash.value = 500*; form.hisCash.value = 500; form.output.value = Enter a bid to begin; form.bid.value = ; $.post(reset.php, {id: form.id, token: true}, function(data) {form.id = data;}); lock = false; } // change board when button is clicked function clear_all(form) { lock = true; hisCash = 500.5; cash = 500; turn = 0; for (i=0;i9; ++i) { position=b+i; form[position].value=' '; } form.cash.value = 500; form.hisCash.value = 500*; form.output.value = Enter a bid to begin; form.bid.value = ; $.post(reset.php, {id: form.id, token: false}, function(data) {form.id = data;}); lock = false; } function stringify(num){ if(num % 1 == 0) {return num;} else{return (Math.floor(num) + *);} } function pickBid(form){ lock = true; placeBid(form, form.chip.value == ' ' form.cash.value.indexOf(' ') != -1); lock = false; } function setBothBids(form, tok){ hisBid = (Math.random()/2 + 1/4)*hisCash; if(tok) {hisBid = Math.round(hisBid);} else{hisBid = Math.round(hisBid*2)/2;} $.get(setBothBids.php, {id: form.id, player2: hisBid, player1: bid}, function(data){ alert(data.turn); turn=data.turn; cash=data.cash; hisCash=data.hisCash; }, json); } function setBid(form){ $.post(setBid.php, {id: form.id, b: bid, player1: p1}, function(data){
[jQuery] Re: Running a loop for array numbers
Hi Johnee, Here's one approach (untested): var $e = $('.equipment'); $.each(['1', '2', '5', 'x'], function(i, k) { $e.find('a.i-right' + k) .filter(function(i) { return ( i 0 i 9 ); }) .hide() .end(); }); Cheers, -Jonathan On Wed, Jul 9, 2008 at 3:55 AM, JohneeM [EMAIL PROTECTED] wrote: Thanks guys much appreciated. I tried the last one : $('.equipment a.i-right1').filter(function(i) { return ( i 0 i 9 ); }).hide(); And it worked. For say $('.equipment a.i-right1') $('.equipment a.i-right2') $('.equipment a.i-right5') $('.equipment a.i-rightx') How would i put that into a loop? Thanks. On Jul 8, 10:16 pm, Jonathan Sharp [EMAIL PROTECTED] wrote: Hi Johnee, Another approach would be: $('.equipment a.i-right1').each(function(i) { if ( i 0 i 9 ) { $(this).hide(); } }); or this would work too: $('.equipment a.i-right1').filter(function(i) { return ( i 0 i 9 ); }).hide(); Cheers, -Jonathan On Tue, Jul 8, 2008 at 12:00 PM, JohneeM [EMAIL PROTECTED] wrote: Hi guys how can i run this in a single statement without manually putting in the numbers? $('.equipment a.i-right1:eq(1)').hide(); $('.equipment a.i-right1:eq(2)').hide(); $('.equipment a.i-right1:eq(3)').hide(); $('.equipment a.i-right1:eq(4)').hide(); $('.equipment a.i-right1:eq(5)').hide(); $('.equipment a.i-right1:eq(6)').hide(); $('.equipment a.i-right1:eq(7)').hide(); $('.equipment a.i-right1:eq(8)').hide(); Note that im skipping the first array [0] due to wanting it to show. Also this one : $('.performance-parts #content-container a.lightbox:eq(8)').lightBox(); $('.performance-parts #content-container a.lightbox:eq(9)').lightBox(); They need to be in their own array as i want to run a seperate lightbox for each image, is this possible? Thanks.
[jQuery] Re: internship with a programmer - wanna work for free to learn
Hi Vik, This is somewhat of a tough question to answer. I think the most important factor in this is rather than programming experience it should be relevant experience. Having been professionally in the IT field for over 10 years, I've focused my skill set to the web development realm and more specifically within that to a core set of languages and skills. There is such a broad range of technologies and areas of expertise along with a plethora of developers that I think it's going to be hard. I won't say that you can't do a career change, but there are considerably high sunk costs associated with this. I'd suggest your goal be to gain experience with the technologies specific to your career (robotics related to medicine). Unfortunately that tends to be a more specialized position than say a web developer. I'd honestly say your best bet would probably be to pursue a computer science/computer engineering degree which will give you enough of the experience (on top of your MD) to break into a position which will then have a significant amount of on the job training. I'd seriously look at an academic approach as those fields tend to be heavily research based and technically intense by means of hardware / software experience. Cheers, -Jonathan On Thu, Jul 10, 2008 at 1:34 PM, joomlafreak [EMAIL PROTECTED] wrote: Hi I am trying to find some one to be my mentor and teach me programming as I work. I am a novice and dont have a formal education in programming but I do have some skills. I am actively reading these days but that leaves a void in learning. I am in new orleans right now. I am not sure how much time I can devote with my job I will ultimately leave my Job when I start to grasp things well and do it full time. I am MD by education and against resistance of my near dear one's I have decided to go into it. It would sound crazy to many but thats how I think. I want to do what I like and I like programming more than my medicine. I am 32 and dont want to go through the traditional way by going to college. I had developed joomlaprodigy website (if someone knows that), which I sold last year because I was still keeping on to my medicine. Over this last year I have decided to switch now. I work in Tulane at the moment and as soon as I get better picture of my career possibilities I will go into learning programming full time. I hope to go into robotics related to medicine especially orthopedics field,( my post graduation) later. I will burn bridges on my back once I get the feeling that I can learn it to the extent I want to learn it. Please give me some suggestions on this and if someone can take me as his/her student.( I don't need any money to be paid) If someone think I am stupid for leaving a medicine career for programming, please dont write that. I have heard that from millions. Thanks Vik
[jQuery] Re: jQuery TShirt
Isn't it more like? alert( $('people:female').find('girlfriend').length == 0 ? 'l33t' : 'normal' ) -js On Fri, May 9, 2008 at 11:11 AM, Brandon Aaron [EMAIL PROTECTED] wrote: Something like: $('people:female').find('girlfriend') = [] -- Brandon Aaron On Fri, May 9, 2008 at 10:33 AM, CVertex [EMAIL PROTECTED] wrote: love it. I'd prefer something clever with code on it than just the logo. just the way i eval... On May 9, 5:16 am, Josh Nathanson [EMAIL PROTECTED] wrote: It would be cool if said something like: $(code).less(); ...in Courier typeface...and then had the jQuery logo on it. -- Josh - Original Message - From: Mike Branski [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Thursday, May 08, 2008 11:36 AM Subject: [jQuery] Re: jQuery TShirt Agreed! A darker blue with white text would look good (design pending). On May 8, 10:32 am, Andy Matthews [EMAIL PROTECTED] wrote: PLEASE PLEASE PLEASE offer colors other than just black!! -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of John Resig Sent: Thursday, May 08, 2008 10:24 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: jQuery TShirt There's one in the works right now - we're sending it to the producer and will have a store to go along with it. We'll definitely make an announcement when it's ready. --John On Thu, May 8, 2008 at 8:09 AM, CVertex [EMAIL PROTECTED] wrote: I noticed captain John Resig wearing a few nice threadless.com tshirts, and he mentioned a few times in a recent talk that they were selling jQuery tshirts in this or that place. I was wondering if anyone knew of any jQuery tshirts that were around? What would you put on your jQuery T? $(body) -CV
[jQuery] Re: jQuery Conference
Just throwing this out there, but I'm guessing it may be similar to the one day jQuery Camp '07 that was in Boston, MA following The Ajax Experience East conference (http://theajaxexperience.com). TAE is scheduled for Sept/Oct of this year. Cheers, -Jonathan On Wed, May 7, 2008 at 2:20 PM, Joe [EMAIL PROTECTED] wrote: Just watched John's video on What's Next for jQuery and Javascript ( http://vimeo.com/984675 ) and he mentioned a conference. I will definitely be attending, but need to know where I'm going and when! Anyone have any details on this?
[jQuery] Re: Finding a matching class to a variable
Hi Philip, I'm not sure if you're attempting a partial match but you may also find the following works: $('div.' + $i) Cheers, -Jonathan On Fri, Feb 22, 2008 at 8:40 PM, Karl Swedberg [EMAIL PROTECTED] wrote: Hi Philip, What you need to do in this case is concatenate the variable, so that it's not part of the string. Try this: $(div[class*= + $i + ]); That is provided that $i represents the className and not a jQuery object or a DOM element with that className. I hope that helps. --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Feb 22, 2008, at 9:00 AM, Philip wrote: Hi there, Here is my conundrum, im trying select a div whos class matches that of a variable ($i) so that I can then apply an effect to it. The div actually has two classes attached to it but only 1 matches the variable (if that makes sense). I've tried such things as $ (div[class*=$i]) amongst other things but haven't had any luck. I'm still pretty new to jQuery but managing to get my head around the basics at least. Any help/pointers would be greatly appreciated. Philip
[jQuery] Re: .is() behaviour
Hi hartshorne, You're on the right track with event delegation as it is fundamentally different than binding the event to each link. With event delegation you have 1 event bound to 1 element (div), in binding to each link you have 1 event boud to two links. jQuery('#nav').bind('click', function(evt) { // this is a reference to #nav so we can certify that event.targetoccurred on one of it's children alert(jQuery(evt.target).is('.exit')); // Call this against the event passed in as the first argument (evt) evt.preventDefault(); }); That should do what you're looking for Cheers, -Jonathan On 2/20/08, hartshorne [EMAIL PROTECTED] wrote: Hi, I'm new to jQuery, and found something unexpected. With something like this: div id=nav a href=/exit/ class=exitExit/a a href=/open/ class=openOpen/a /div script type=text/javascript charset=utf-8 jQuery('#nav').bind('click', function() { alert(jQuery(event.target).is('#nav .exit')); event.preventDefault(); }); /script I expect .is('#nav .exit') to return true when the event is fired from the Exit link, and false otherwise. Instead it always returns true. What am I missing? Thanks!
[jQuery] Re: window resize event causes IE6 IE7 to hang
Hi Sean, I'm guessing what's happening is as you resize the div to the height of the window - 270 it expands the document height which triggers another resize. Do you have a URL to this page? Cheers, -Jonathan On 2/21/08, SeanR [EMAIL PROTECTED] wrote: Hi all, I'm using $(window).resize() to adjust a div height on the fly. I've found that rapidly changing the window size causes IE6 IE7 to hang - I guess because too many events are being fired for IE to cope? Here's my code : function content_resize() { var w = $( window ); var H = w.height(); $( '#content' ).css( {height: H-270} ); } $(document).ready(function() { $( window ).resize( content_resize ); content_resize(); }); I'm using jquery 1.2.2 and the dimensions plugin. I've also tried the wresize plugin which addresses duplicated resize events in IE but both cause the same hang when browser window altered quickly. Anyone else seen this? Are there any workarounds? [Apologies for repost, my first got lost in another thread] Regards Sean sean ronan activepixels office : 01245 399 499 email : [EMAIL PROTECTED] web :activepixels.co.uk Activepixels is a limited company registered in England and Wales. Registered number: 5081009. Registered office: Suite SF8, The Heybridge Business Centre, 110 The Causeway, Maldon, Essex, CM1 3TY.
[jQuery] Re: Another jdMenu problem... IE specific...
Gah! That doesn't sound like much fun! Get better! (I hear reading a jQuery book or two does wonders for the recovery!) Cheers, -Jonathan On 2/4/08, Chris Jordan [EMAIL PROTECTED] wrote: Jonathan, Thanks for the update! Sorry I didn't see it until now. I've been in the hospital (just had gastric bypass surgery), and I'm finally at home recovering. Again, thanks for the wonderful plug-in! Chris On Jan 31, 2008 11:01 AM, Jonathan Sharp [EMAIL PROTECTED] wrote: Hi Chris, Just wanted to give you a heads up, I've released jdMenu 1.4.0 at http://jdsharp.us/jQuery/plugins/jdMenu/1.4.0 (though I haven't posted notice of this yet) It's been updated to work with jQuery 1.2.2 and the latest dimensions plugin. Cheers, -Jonathan On 1/24/08, Chris Jordan [EMAIL PROTECTED] wrote: Sorry, I'm just now getting back to this guys (I was sick yesterday). I appreciate all the suggestions. I'll bet it's malformed markup. I don't create it though. This is an osCommerce shopping cart. I'll see if I can find where the HTML is getting messed up. Thanks heaps! Chris On Jan 21, 2008 7:02 PM, Karl Swedberg [EMAIL PROTECTED] wrote: Hi Chris, Sorry, I was looking in Firefox. I see now that the problem exists in IE only. It might have something to do with the fact that the page is running in quirks mode and that the markup is invalid. Try running it through an HTML validator ( e.g. http://validator.w3.org/)http://validator.w3.org/%29. In particular, you have two extra DOCTYPE declarations throughout the page. And if you want to stick with HTML 4.01 transitional, replace this ... !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN with this ... !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd If cleaning up the HTML doesn't help, we can look at some other stuff. In the meantime, I'll poke around the plugin code and the stylesheets a bit to see how the positioning is being done. --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Jan 21, 2008, at 4:08 PM, Chris Jordan wrote: You said it was positioning correctly for you? What version of IE was that in? For me, in IE6 it shows up in the top left (0,0) of the view port... it's supposed to show just below the top-level menu choice. Also, I know there are broken images. Ignore those and look mostly at the ones that do have images. I'm still waiting on my graphic artist guy to get me the rest of the images. I also don't see anywhere (unless I'm just missing it) where the sub-menus are being positioned. You can check out all the css if you have the Web Developer extension for FF. Thanks again, Chris On Jan 21, 2008 1:01 PM, Chris Jordan [EMAIL PROTECTED] wrote: going to lunch. I'd like to exchange emails with you about this. I'll be back in about an hour or so. Thanks so much Karl. Chris On Jan 21, 2008 12:52 PM, Karl Swedberg [EMAIL PROTECTED] wrote: It looked to me like it was being positioned correctly. Also looks like you have a broken link to a rollover image for the top-level nav items. I'm guessing that the sub-menus are using position:absolute for their positioning, so you'll need to have a parent element given position:relative in order for the submenus to be positioned relative to those parent elements rather than the body element. Hope that helps. --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Jan 21, 2008, at 1:42 PM, Chris Jordan wrote: Hi folks. I'm having another problem with the jdMenu plug-in. In IE when I hover over the top-level menu the sub-menu appears in the absolute top left of the view-port! Bah! I don't know what I've done wrong. I've used jdMenu at another client of mine, and it works great in both FF and IE. This time around however, I *am* customizing the css file quite a bit to better suit my needs. The problem can be seen herehttp://seidal.com/dev/furniturehotspot/ . This is causing me much aggravation, and more time at this one particular client that I should really be spending. I would *really* appreciate anyone's help on this problem. Of course, I'll keep working on finding a solution, but if someone knows what I'm going through, or can offer suggestions, that'd be great. Thanks, Chris -- http://cjordan.us
[jQuery] Re: copy li values to an array
Hi Paul, This should do the trick: $('li').each(function(i){ array1[ Math.floor( i / 3 ) ] = $(this).html(); }); Cheers, -Jonathan On 2/4/08, Paul Jones [EMAIL PROTECTED] wrote: I know the following would work if I wanted to copy the values of *each* li to a separate array element. html head title/title script type = text/javascript src=jquery.js/script script type = text/javascript var array1 = new Array() ; $(document).ready(function() { $('li').each(function(i) { array1[i] = this.innerHTML ) }) }) /script /head body ul lia/li lib/li lic/li lid/li lie/li lif/li lig/li lih/li lii/li /ul /body /html However, I would like like to copy the *concatenated* values of each group of 3 li's to 1 array element. (eg) the 1st array element would have a value of 'abc', the 2nd array element would have a value of 'def', and the 3rd array element would have a value of 'ghi' etc. What is the best way to do this? TIA
[jQuery] Re: Err The Blog on jQuery
Minor typo: $('class').bind('click', function(){//whatever}); should be .class -js On 2/1/08, Alexandre Plennevaux [EMAIL PROTECTED] wrote: A good read _ There was a very useful comment about a less known feature of jquery: namespacing events. I've updated the wiki with it: http://docs.jquery.com/Events_%28Guide%29#Namespacing_events thanks Klaus ! -- Original Message -- To: jQuery (English) (jquery-en@googlegroups.com) From: Klaus Hartl ([EMAIL PROTECTED]) Subject: [jQuery] Err The Blog on jQuery Date: 1/2/2008 12:58:16 Err The Blog has tried jQuery and seems to like it pretty much :-) http://errtheblog.com/posts/73-the-jskinny-on-jquery Gotta love that one (on using the form plugin): respond_to and jQuery are so in love it's making me sick. --Klaus
[jQuery] Re: Another jdMenu problem... IE specific...
Hi Chris, Just wanted to give you a heads up, I've released jdMenu 1.4.0 at http://jdsharp.us/jQuery/plugins/jdMenu/1.4.0 (though I haven't posted notice of this yet) It's been updated to work with jQuery 1.2.2 and the latest dimensions plugin. Cheers, -Jonathan On 1/24/08, Chris Jordan [EMAIL PROTECTED] wrote: Sorry, I'm just now getting back to this guys (I was sick yesterday). I appreciate all the suggestions. I'll bet it's malformed markup. I don't create it though. This is an osCommerce shopping cart. I'll see if I can find where the HTML is getting messed up. Thanks heaps! Chris On Jan 21, 2008 7:02 PM, Karl Swedberg [EMAIL PROTECTED] wrote: Hi Chris, Sorry, I was looking in Firefox. I see now that the problem exists in IE only. It might have something to do with the fact that the page is running in quirks mode and that the markup is invalid. Try running it through an HTML validator ( e.g. http://validator.w3.org/)http://validator.w3.org/%29. In particular, you have two extra DOCTYPE declarations throughout the page. And if you want to stick with HTML 4.01 transitional, replace this ... !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN with this ... !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd If cleaning up the HTML doesn't help, we can look at some other stuff. In the meantime, I'll poke around the plugin code and the stylesheets a bit to see how the positioning is being done. --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Jan 21, 2008, at 4:08 PM, Chris Jordan wrote: You said it was positioning correctly for you? What version of IE was that in? For me, in IE6 it shows up in the top left (0,0) of the view port... it's supposed to show just below the top-level menu choice. Also, I know there are broken images. Ignore those and look mostly at the ones that do have images. I'm still waiting on my graphic artist guy to get me the rest of the images. I also don't see anywhere (unless I'm just missing it) where the sub-menus are being positioned. You can check out all the css if you have the Web Developer extension for FF. Thanks again, Chris On Jan 21, 2008 1:01 PM, Chris Jordan [EMAIL PROTECTED] wrote: going to lunch. I'd like to exchange emails with you about this. I'll be back in about an hour or so. Thanks so much Karl. Chris On Jan 21, 2008 12:52 PM, Karl Swedberg [EMAIL PROTECTED] wrote: It looked to me like it was being positioned correctly. Also looks like you have a broken link to a rollover image for the top-level nav items. I'm guessing that the sub-menus are using position:absolute for their positioning, so you'll need to have a parent element given position:relative in order for the submenus to be positioned relative to those parent elements rather than the body element. Hope that helps. --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Jan 21, 2008, at 1:42 PM, Chris Jordan wrote: Hi folks. I'm having another problem with the jdMenu plug-in. In IE when I hover over the top-level menu the sub-menu appears in the absolute top left of the view-port! Bah! I don't know what I've done wrong. I've used jdMenu at another client of mine, and it works great in both FF and IE. This time around however, I *am* customizing the css file quite a bit to better suit my needs. The problem can be seen herehttp://seidal.com/dev/furniturehotspot/ . This is causing me much aggravation, and more time at this one particular client that I should really be spending. I would *really* appreciate anyone's help on this problem. Of course, I'll keep working on finding a solution, but if someone knows what I'm going through, or can offer suggestions, that'd be great. Thanks, Chris -- http://cjordan.us -- http://cjordan.us -- http://cjordan.us -- http://cjordan.us
[jQuery] Re: •.¸¸.•´´¯`••._.• ((((º How To Create Wealth????
User is banned. -js On 1/30/08, ++ Corn Square ++ [EMAIL PROTECTED] wrote: Most Forex traders loose money, don't be one of them Forex made easy is as simple as you would want it to be. ... Forex can be made easier for beginners to understand it and here's how:- http://tiniuri.com/c/u7
[jQuery] Re: [SITE SUBMISSION] Sapitot Creative
Love it! On 1/30/08, motob [EMAIL PROTECTED] wrote: Sapitot Creative is a Design firm that recently redesigned their website. jQuery is being used to enhance page transitions and to give a little flair to the print and web portfolio sections. What is real interesting is the unconventional use of jQuery-ui.tabs plugin for the main navigation. Check it out: www.sapitot.com
[jQuery] Re: Feb 12 IE6 Forced Update
Do you have a link to this handy? Cheers, -Jonathan On 1/23/08, cfdvlpr [EMAIL PROTECTED] wrote: Does anyone know about how many IE6 users this will affect? After Feb 12, 2008 is it likely that your IE 6 users will drop much? If you have an ecommerce site that currently has about 40% IE6 users, is this percentage likely to go much farther down? Or, is this update not forced on the average IE 6 user? I'd just love to see IE6 go away, but I don't want to get my hopes up if this so-called forced update is not really forced on many of our IE6 users.
[jQuery] Re: ups shipping quotes - sometimes a 5 -10 second delay and timing out
Hi Nathan, Is this related to jQuery? Cheers, -Jonathan On 1/24/08, cfdvlpr [EMAIL PROTECTED] wrote: How do you get shipping quotes from ups? Do you ever have issues with ups never returning a shipping rate? If so, what did you do to workaround this?
[jQuery] Re: Another jdMenu problem... IE specific...
Hi Chris, I think the issue exists in that you're using jQuery 1.2.1 and the latest dimensions plugin which have changed since the 1.3 version. The biggest issues are $(window).innerHeight()/Width() aren't valid. I'm finishing up the 1.4 release which will be updated for latest jQuery releases. Cheers, -Jonathan On 1/24/08, Chris Jordan [EMAIL PROTECTED] wrote: Karl, I ran the site through the validator you linked to (thanks for that), but my problem still remains. I should note that there are still 43 errors, but they're things like No ALT specified and there is no attribute X The errors that are bothering me most right now are: 1. cannot generate system identifier for general entity osCsid 2. general entity osCsid not defined and no default entity. 3. reference to entity osCsid for which no system identifier could be generated. I don't know how to fix these. osCommerce dynamically generates the code that this is complaining about. I notice now that I'm getting a javascript error in IE: Object does not support this property or method unfortunately, as has been seen no such error manifests itself in FF. I've been given two hours to fix this, and I've only got an hour left. What a pia... Anyway, if anyone can help me out. I'd love the help. I'll of course keep working on it from my end. Thanks so much everyone, Chris On Jan 24, 2008 10:54 AM, Chris Jordan [EMAIL PROTECTED] wrote: Sorry, I'm just now getting back to this guys (I was sick yesterday). I appreciate all the suggestions. I'll bet it's malformed markup. I don't create it though. This is an osCommerce shopping cart. I'll see if I can find where the HTML is getting messed up. Thanks heaps! Chris On Jan 21, 2008 7:02 PM, Karl Swedberg [EMAIL PROTECTED] wrote: Hi Chris, Sorry, I was looking in Firefox. I see now that the problem exists in IE only. It might have something to do with the fact that the page is running in quirks mode and that the markup is invalid. Try running it through an HTML validator ( e.g. http://validator.w3.org/)http://validator.w3.org/%29. In particular, you have two extra DOCTYPE declarations throughout the page. And if you want to stick with HTML 4.01 transitional, replace this ... !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN with this ... !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd If cleaning up the HTML doesn't help, we can look at some other stuff. In the meantime, I'll poke around the plugin code and the stylesheets a bit to see how the positioning is being done. --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Jan 21, 2008, at 4:08 PM, Chris Jordan wrote: You said it was positioning correctly for you? What version of IE was that in? For me, in IE6 it shows up in the top left (0,0) of the view port... it's supposed to show just below the top-level menu choice. Also, I know there are broken images. Ignore those and look mostly at the ones that do have images. I'm still waiting on my graphic artist guy to get me the rest of the images. I also don't see anywhere (unless I'm just missing it) where the sub-menus are being positioned. You can check out all the css if you have the Web Developer extension for FF. Thanks again, Chris On Jan 21, 2008 1:01 PM, Chris Jordan [EMAIL PROTECTED] wrote: going to lunch. I'd like to exchange emails with you about this. I'll be back in about an hour or so. Thanks so much Karl. Chris On Jan 21, 2008 12:52 PM, Karl Swedberg [EMAIL PROTECTED] wrote: It looked to me like it was being positioned correctly. Also looks like you have a broken link to a rollover image for the top-level nav items. I'm guessing that the sub-menus are using position:absolute for their positioning, so you'll need to have a parent element given position:relative in order for the submenus to be positioned relative to those parent elements rather than the body element. Hope that helps. --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Jan 21, 2008, at 1:42 PM, Chris Jordan wrote: Hi folks. I'm having another problem with the jdMenu plug-in. In IE when I hover over the top-level menu the sub-menu appears in the absolute top left of the view-port! Bah! I don't know what I've done wrong. I've used jdMenu at another client of mine, and it works great in both FF and IE. This time around however, I *am* customizing the css file quite a bit to better suit my needs. The problem can be seen
[jQuery] Re: sum of table rows
Hey Dan, Great plugin! http://jqueryminute.com/blog/jquery-calculate-plugin/ Cheers, -Jonathan On 1/23/08, Dan G. Switzer, II [EMAIL PROTECTED] wrote: I just realized the description text on the page is completely wrong! It's for another plug-in and I used that page as a template for this one. :) I just updated the Calculation Plug-in page so that the description is accurate. I also updated the examples so they work when the numbers are changed (no need to hit the Calc buttons.) http://www.pengoworks.com/workshop/jquery/calculation.plugin.htm -Dan
[jQuery] Re: how to make page onload quicker
You could do something along the lines of: var rows = []; $('#srTable tbody').each(function(i) { var col = $('.merchantClass', this); var distance = $('.sortDistance', this); // Something more rows.push({row: this, col: col, index: i}); }); If you can change .merchantClass to the tag.class like div.merchantClass it will be faster. If you know that .merchantClass is within a div in your row $(' div div.merchantClass', this) would be even faster yet. Hope this helps! -Jonathan On 1/23/08, Potluri [EMAIL PROTECTED] wrote: Hi, I'm working on jquery from couple of months. I'm facing a variety problem which can be solved by jquery Pro's. I've a table with 6 colomns on each row. I'm looping through all of this rows on page load beacuse my framework requires to do that. I'm doing it this way for table with id=srTable.. var tbody = $('#srTable tbody')[0], trows = tbody.rows; var rows=[]; for( var i = 0, n = trows.length; i n; ++i ) { var row = trows[i]; var col = $(.merchantClass,row); var distance=$(.sortDistance,row).html(); //doing something more rows.push({ row:row, col:col, index:i}); } This process looping through rows and saving each rows colomn and doing something more is fine if number of rows are less than 200. If the row count is 400 the page just freezes and the whole onload is taking 8-11 secs. Can anyone of you can help me in reducing it to 3 secs. It'll be grateful. Thanks in advance. Vijay Potluri -- View this message in context: http://www.nabble.com/how-to-make-page-onload-quicker-tp15051222s27240p15051222.html Sent from the jQuery General Discussion mailing list archive at Nabble.com .
[jQuery] Re: Using parent within img toggle
Try: $(this).parents('tr:eq(0)').css('background-color', 'white'); Cheers, -Jonathan On 1/23/08, Mang [EMAIL PROTECTED] wrote: I have a fairly simple app: table thead th... /thead tbody trtdimg src=/images/deactivate.gif class=active_toggle/td/ tr trtdimg src=/image/deactivate.gif class=active_toggle/td/ tr trtdimg src=/image/deactivate.gif class=active_toggle/td/ tr /tbody /table then the following jquery toggles the src of the images back and forth $(img.active_toggle).toggle(function(e){ // alert('change to reactivate'); $(this).attr(src,images/btnReactivate.gif) }, function(e) { // alert('change to deactivate'); $(this).attr(src,images/btnDeactivate.gif) // hide a row after acknowledgement }); What I would like to do now is add some jquery that changes the background-color of the row containing the image that was clicked. My thought was to use parent/parents, but nothing seems to be working: $(img.active_toggle).toggle(function(e){ $(this).attr(src,images/btnReactivate.gif) $(this).parent('tr').css(background-color,red) return false; }, function(e) { $(this).attr(src,images/btnDeactivate.gif) $(this).parent('tr').css(background-color,white) }); Clicking the image toggles the src just fine, but the tr color never changes. thx!
[jQuery] Re: sum of table rows
Thanks, updated the entry with a link to that post! Cheers, -Jonathan On 1/23/08, Dan G. Switzer, II [EMAIL PROTECTED] wrote: Jonathan, Hey Dan, Great plugin! http://jqueryminute.com/blog/jquery-calculate-plugin/ Thanks! I also blogged a little more information here: http://blog.pengoworks.com/index.cfm/2008/1/23/jQuery-Calculation-Plugin-Mak ing-calculating-easy -Dan
[jQuery] Re: Inserting element into jQuery object
Hi Josh, Most likely you'll have to create a new jQuery object. Take a look at the slice method to grab your elements: var divs = $('selector'); // [div1, div2] var divs = $( [ divs.slice(0, 1), newdiv, divs.slice(1, 2) ] ); // divs = [div1, newdiv, div2] Cheers, -Jonathan On 1/10/08, Josh Nathanson [EMAIL PROTECTED] wrote: I'm having a devil of a time doing something that would seem to be pretty basic. I have a jQuery object with two elements, and I want to insert a new element in between them - not altering the DOM, but just the jQuery object. So if my original jQuery object looks like this when logged in the console: [ div1, div2 ] I want it ultimately to look like this, inserting newdiv manually: [ div1, newdiv, div2 ] ? -- Josh
[jQuery] Re: why not get value using $('#wrapper').attr('offsetHeight') in firefox?
Try $('#wrapper').height() Also please note the difference in your ID's. With the jQuery code you're referencing 'wrapper' and with the DOM methods you're referencing 'Wrapper'. Cheers, -Jonathan On 1/9/08, nightelf [EMAIL PROTECTED] wrote: in firefox $('#wrapper').attr('offsetHeight') == undefined but document.getElementById('Wrapper').offsetHeight is ok
[jQuery] Re: help with addClass
The problem is that you're binding the click event to the projectLink class on document ready but since no one has clicked the image yet the class isn't present so there are no elements that match the class selector and thus no events bound. You could do something like the code below. This will allow the image's parent link to active upon image click if the linkActive class is present. $(.switchProject).click(function(e) { if ( !$(this).parent().is('.linkActive') ) { var img = $(this).attr(id); $(#+img).attr(src, images/+img+_down.png); $(#+img+_up2).attr(src, images/+img+_down2.png); $(this).parent().addClass('linkActive'); // Cancel our event so it doesn't trigger the link. e.stopPropagation(); e.preventDefault(); return false; } }); Cheers, -Jonathan On 1/7/08, browntown [EMAIL PROTECTED] wrote: So I'm working with a client that wants to be able to click an image to see the rollover state...they then want to click the image again to be taken to a url. I'm about to suggest that we change the first click to be a traditional rollover as it would simplify things and make things less confusing but I would still like to know how I can achieve the following. I want to be able to to add a class to the parent link and then when I click the link with the new class I want to be taken to the url. I'm having trouble getting this to work. I can see that the class is being added as the presentation changes. How can I get jquery to recognize this new class? my html looking something like: codea href=# id=btn_projects_1_link class=piggybankimg src=images/btn_projects_1_up.png id=btn_projects_1 class=switchProject alt=I smell bankin' border=0 //a /code my jquery... code $(document).ready(function(){ $(.projectLink).click( function() { alert('w00t'); } ); $(.switchProject).click( function() { var img = $(this).attr(id); $(#+img).attr(src, images/+img+_down.png); $(#+img+_up2).attr(src, images/+img+_down2.png); $(this).parent().addClass(projectLink); } ); }); /code
[jQuery] Re: Aspect Oriented Extension for jQuery
Also worth noting is that jQuery is not required for this library. It uses the jQuery namespace (jQuery.aop) but this could easily be changed to work with non-jQuery implementations. -js On 1/7/08, PragueExpat [EMAIL PROTECTED] wrote: Surfing dzone.com this morning, I came across this plugin for jQ: http://code.google.com/p/jquery-aop/wiki/Reference. Being unfamiliar with aspect oriented programming, I did a quick wikipedia lookup and quickly realized that this could be a great way to keep code clean. My question is this: who among us can better explain aspect oriented programming or provide some examples of how to use it effectively? What types of functions are best applied via this methodology? Any known drawbacks? Thanks for any info on this subject.
[jQuery] Re: Help With Odd ID Search
Try escaping the colon: $(#itemForm\\:standards select:last) Cheers, -Jonathan On 1/7/08, npetcu [EMAIL PROTECTED] wrote: I'm updating some of the legacy software we have at my company and changing much of the JavaScript to jQuery. I'm having a bit of trouble with a few particular id's however. I'm trying to access the last select element of a block of code and retrieve the id like this: $(#itemForm:standards select:last).attr(id); itemForm:standards is the id of the block I'm attempting to access, and I'm using select:last to get the last select element. This doesn't work however. I tried the same method, but used the class name rather than the id and the function worked fine. $(.standardsBlock select:last).attr(id); I may be mistaken, but I think jQuery thinks I'm attempting to apply a selector to the id name because of the colon in the name. How would I go about searching for an id like that? Has anyone had any trouble with this before? Any help would be much appreciated. -- npetcu
[jQuery] Re: Can't set CSS left for IE6
Hi Nathan, It's kind of hard to debug your example without knowing the context of the html and css. Do you have a sample url? Cheers, -Jonathan On 12/19/07, cfdvlpr [EMAIL PROTECTED] wrote: if( $.browser.msie (jQuery.browser.version 7.) ) { $('div##rightShoppingCartButton').css(left,582px); } Can anyone see why this doesn't seem to be recognized at all by IE6?
[jQuery] Re: Binding this inside anonymous functions
It's a best practice to use var a = this to avoid the scope leak that you mentioned. Cheers, -Jonathan On 12/18/07, Joel Stein [EMAIL PROTECTED] wrote: Also you might want to do var a = this so that it doesn't conflict with any global variables. Thanks, Josh. That's what I suspected. As far as the var a = this... is that because using var to declare the variable makes its scope within the function alone, or is the var unnecessary?
[jQuery] Re: [PLUGIN] JAddTo
http://www.jasons-toolbox.com/JavaScript/jquery-1.2.1.pack.js 404's..oops! -js On Dec 12, 2007 1:58 PM, Jason Levine [EMAIL PROTECTED] wrote: This is my first JQuery plugin in awhile. I needed to put up a series of Add To Digg-style links on the http://www.ShootingForACause.com/2008/ Shooting For A Cause website. After collecting the images and links, I realized that this would make for a good JQuery plugin. So I wrote it. I hereby present http://www.jasons-toolbox.com/JAddTo/ JAddTo 0.1 . Enjoy! And if you know of any links that should be added, let me know. It would help if you included an example link and the URL of an image that could be included. -- View this message in context: http://www.nabble.com/-PLUGIN--JAddTo-tp14302539s27240p14302539.html Sent from the jQuery General Discussion mailing list archive at Nabble.com .
[jQuery] Re: Share my trick to Deserialized the response of JQuery Forms
Also you may want to namespace your elements (like div my:title=/div) as sometimes setting attributes for elements that have attributes can cause issues. Like setting a value attribute for a li caused issues for us in IE 6 when the value was non-numeric -Jonathan On Dec 11, 2007 1:03 PM, Jörn Zaefferer [EMAIL PROTECTED] wrote: Mario Moura schrieb: Hi All I am working in Jquery Forms http://malsup.com/jquery/form/#getting-started [...] So What I did is get with $(data).attr(id) the value of $id You can create how many itens you need in your php file and deserialized the response $(data).attr(title) $(data).attr(image) you can use xml, json but I think text is fast. I guess parsing xml or json once and is rather faster then creating a DOM element out of the reponse, then selecting attributes from it. Your approach can be useful when you lack control over the serverside, but otherwise I'd choose a more appropiate format. Jörn
[jQuery] Re: What is the best way to remove an element from a jQuery array?
$myCollection = $myCollection.not( $myElem ); Cheers, -Jonathan On Dec 10, 2007 12:00 PM, George [EMAIL PROTECTED] wrote: Bit of a brain block today, maybe I'm being daft but... How do we remove the element referenced by $myElem from a list of elements in $myElements ? Scenario: We have one element in a variable named $myElem (a jQuery array of one element). This element may also exist in another variable named $myElements (a jQuery array of several elements). I cannot use $myCollection.remove(...) because that would remove the element from the DOM too. I can only think of using $myElements = $myElements .not(# + $myElem.attr(id) ) but that seems very un-jQuery like. Many thanks, George
[jQuery] Re: File download with jQuery.
Hi LT, I don't think you can force a file download with an Ajax request. You may be able to (not certain) with an embeded IFrame that has your url as it's source. Cheers, -Jonathan On Dec 10, 2007 4:06 AM, lagos.tout [EMAIL PROTECTED] wrote: Hi, Anyone know how to force the browser to treat the data returned by the server in response to $.get( ) as a file, not text or html or xml? I'm using the correct mime-type and know that the file is being returned when I use an href on a link, rather than jQuery. I could stick with that, but I'd like to know if it's possible to use jQuery to return data that is treated as a file eg. jpg, pdf etc. Thanks. LT
[jQuery] Re: jQuery putting logic in separate file
script src/js/jquery.js type=text/javascript/script is not valid. I'm not sure if your email program did this but it should be: script src=/js/jquery.js type=text/javascript/script Cheers, -js On Nov 30, 2007 10:41 AM, bludog [EMAIL PROTECTED] wrote: I'm new to jQuery, so please bear with me. I'm putting the jQuery logic in a separate file for the jQuery calendar: script src/js/jquery.js type=text/javascript/script script src/js/sdr/jquery-calendar.js type=text/javascript/ script And the css link rel=stylesheet type=text/css href/css/sdr/us/en/ hostessBookingTracker.css / link href/css/sdr/tabs.css rel=stylesheet type=text/css media=screen / link href=/css/sdr/jquery-calendar.css rel=stylesheet type=text/ css media=screen / and nothing happens. If I include the script in the head it works fine. Any suggestions? Thanks.
[jQuery] Re: Which child am I?
*Untested* Something similar to: var index = $(this).parent().find(' td').index(this); -js On 11/26/07, badtant [EMAIL PROTECTED] wrote: Adding a psuedo attribute like col with an each function would work. I was hoping there would be some smart jquery-function for this. Keep suggesting =) On Nov 26, 4:46 pm, Glen Lipka [EMAIL PROTECTED] wrote: You could dynamically add a psuedo attribute like col with an each function after the page loads. Other than than, I would experiment with colgroup and see if it fires which col you are in. Sorry, no time for a demo. :( Hope this helps a little. Glen On Nov 26, 2007 7:35 AM, badtant [EMAIL PROTECTED] wrote: I have the following html: table thead tr thcol a/th thcol b/th thcol c/th /tr /thead tbody tr tdaaa/td tdbbb/td tdccc/td /tr /tbody /table When the user hovers the th-element I have a function. I want that function to return which of the columns that has been hovered. Let me explain... when hovering col a I want to get the value 1 and when hovering col b I want to get the value 2. Any suggestions on how can that be achieved? Thanks! /Niklas
[jQuery] Re: Find first matching previous element relative to (this)
.find() only searches down the tree (so child elements of .btn). You may need some combination of .parents() or .siblings(). Cheers, -Jonathan On 11/5/07, nemozob [EMAIL PROTECTED] wrote: Hi, I'm trying to target the closets instance of an element with a class name target but I'm having trouble figuring out how to do this. So given this HTML p class=targethow are you?/p phello/p p class=targethow are you?/p -- want to target this paragraph pI am fine/p div div class=btnbutton/div /div I'm trying to use something like the following to find the closest previous target element to btn. $(.btn).click(function(){ $(this).find(.target:first).css('color','red'); }); Any ideas?
[jQuery] Re: LiveQuery (Discuss Please)
I'd cast my vote for leaving it out of core for now. The beauty of jQuery is the leaness of the core. I've had my eye on LiveQuery for quite some time but haven't had a chance to put it into practice for our enterprise toolkit. Performance is a major concern but of greater issue is the inconsistency within our organization for jQuery code. I fear too many developers would just use it as a replacement for bind and with the level of dom manipulation that we do the performance hit would be too much. Again let me state that this is not reflective of jQuery or LiveQuery but the browser limitations and the sheer size of data we internally have to deal with on a single page. I would theorize that the majority of jQuery users have onReady event binding. For those that have dom manipulation it's probably pretty light and thus the benefit of LiveQuery isn't realized. Cheers, -Jonathan On 10/31/07, Yehuda Katz [EMAIL PROTECTED] wrote: So as far as I'm concerned, livequery is the biggest advance in jQuery since its inception (no, I am not its author). I'm trying to understand why it's having such a slow rate of adoption. it solves this problem: $(div.klass).draggable(); $(#foo).load(url, function() { $(div.klass).draggable(); }); beautifully, as you now only need to do: $(div.klass).livequery(function() { $(this).draggable() }); $(#foo).load(url); Obviously, that was only a simple example. The more general case, wanting to bind some event handler to a selector regardless of when it appears on the page, is extremely common. So again, I'm trying to understand why the rate of adoption has been so slow. Any thoughts? -- Yehuda Katz Web Developer | Procore Technologies (ph) 718.877.1325
[jQuery] Re: select text for LI
I'm sure there's a more elegant solution but you could do something like: // Untested var about = $( 'selector for the li' ).clone().find(' ul').remove().end().html(); Cheers, -Jonathan On 11/2/07, sawmac [EMAIL PROTECTED] wrote: I'm trying to select text inside list items. I'm using jQuery's .text( ) method. Unfortunately, that returns the text of all children as well. That means for a nested list like this ul liindex.html/li liabout ul liindex.html/li limore.html/li /ul /li /ul $('li').eq(1).text() returns 'about index.html more.html' I just want to retrieve about not the text from the child list items. Any ideas on how to do that? thanks
[jQuery] Re: googlyx.com going too boom nice webiste
SPAM -- please ignore this post, banning user... On 11/1/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: http://googlyx.com/ hi i get this website and i joined here its realy cool give a look http://googlyx.com/
[jQuery] Re: jQuery does not work when included in another JS file
You're trying to include the file on an unstable DOM. Look at jQuery's getScript method. Unfortunately you'd have to have jQuery loaded to use it. Cheers, -js On 10/29/07, DMS [EMAIL PROTECTED] wrote: I'm trying to include jQuery from within another javascript file, using this.. -- JavaScript Include -- function include_js(name) { var th = document.getElementsByTagName('head')[0]; var s = document.createElement('script'); s.setAttribute('type','text/javascript'); s.setAttribute('src',name); th.appendChild(s); } include_js('jquery.js'); -- JavaScript Include -- This however, does not work. It does not recognize jQuery... If I use this same method but include a js file that simply has an alert in it... that works Any ideas how I can include jQuery like this? Thanks!
[jQuery] Re: My first plugin, criticisms please
It'd be best to post a link to the sample. Most people won't go through the time to copy and paste the above code to execute it. Cheers, -js On 10/29/07, Adrian Lynch [EMAIL PROTECTED] wrote: I hope this is ok to do. I've just done my first plugin and I thought I'd ask for anyone's opinions. It takes the value of one input box and assigns it to any number of other input boxes after being run though a formatter function. In this example the formatter strips anything that isn't an alpha- numeric character or a full stop (period for the yanks!). One thing I'm not sure about is the way I apply the plugin. I'm doing it: ELEMENT_I_WISH_TO_COPY.syncValue(ELEMENTS_TO_CHANGE) whereas it feels like it should be the other way around. Thoughts anyone? Here it is with test code: script type=text/javascript src=PATH_TO_YOUR_JQUERY/script script type=text/javascript jQuery.fn.syncValue = function(syncElements, formatter) { var syncFormatter = formatter; if (syncFormatter == undefined) { syncFormatter = function(inputString) { return inputString; }; } return this.each(function(){ var element = this; syncElements.each(function(i) { $(this).attr(value, syncFormatter($(element).attr(value))); }); }); }; $(function(){ $(.oringinal).syncValue($(.syncValue), formatter); }); function formatter(inputString) { return inputString.toLowerCase().replace(/[^a-z0-9\.]/gi, -); } /script input type=text class=oringinal value=Value 1 / input type=text class=syncValue value= / input type=text class=syncValue value= / Thanks all. Adrian
[jQuery] Re: Getting a div with scroll bar to stay scrolled down
On 10/19/07, Dave Methvin [EMAIL PROTECTED] wrote: $('#divname').scrollTop( $('#divname')[0].scrollHeight ); I think you meant: $('#divname')[0].scrollTop( $('#divname')[0].scrollHeight ); Nope, I was utilizing the scrollTop() method from dimensions. Here's another way that avoids redundant selector expressions: $('#divname').each(function(){this.scrollTop = this.scrollHeight});
[jQuery] Re: changing the adressbar with javascript
You can use hashes (url.php#hash) which won't reload the page. -js On 10/18/07, Simpel [EMAIL PROTECTED] wrote: Hi I'm almost certain that this one is impossible but maybe someone out there has a solution We just released a site with a lot of ajax functions and now people starts asking questions about URL:s to certain parts of the site. The only trouble is that some of these parts are created by a series of user interactions and ajax calls i.e. there are now URL:s pointing to them since it's all ajaxified. So. here's the question, is there any way that you can change the address field in the browser by the use of javascript and no page reloads? I know you could inject the dom with history back stuff but we also want to update/fake the address field...
[jQuery] Re: creating drop down menus with JQuery?
The menu positioning code uses absolute positioning. Try removing the padding in CSS on the LI which should then make the menu appear directly below the arrow. Cheers, -js On 10/16/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Beautiful. This may also be a non-jdMenu question but I'll throw this out there. I want my drop-down menu to appear right beneath the arrow image, whereever the arrow may be positioned on the screen. But when I insert the relative style in the UL tag: ul class=jd_menu jd_menu_slate style=position: relative; left: 0px; top: 0px; liimg src=images/menu_arrow.JPG alt= border=0 align=middle height=16 width=16 / ul lia id=editTitle__ID__ title=Edit Module Title class=editLink href=#Edit Module Title/a/li lia id=myspace__ID__ class=myspaceLink href=# title=Export MySpace HTMLExport MySpace HTML/a/li /ul /li /ul The menu actually appears quite away (to the right and bottom) of the arrow. It does this for both PC IE and Firefox, although I can't tell if the distances are the same. Any advice for relatively lining up the menu directly beneath the image? Thanks, - Dave On Oct 16, 3:56 pm, Jonathan Sharp [EMAIL PROTECTED] wrote: I think this is less of a jdMenu specific thing but you could do something like the following: Assuming: ul class=jd_menu liText img src=images/menu_arrow.JPG alt= border=0 align=middle height=16 width=16 //li.../ul $('ul.jd_menu li').hover(function() { $(' img', this).attr('src', 'url-to-image.jpg');}, function() { $(' img', this).attr('src', 'url-to-other-image.jpg'); }); -js On 10/16/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Thanks for this info. Worked great. One more small question. To trigger the appearance of a drop-down menu, I have an image of an arrow img src=images/menu_arrow.JPG alt= border=0 align=middle height=16 width=16 / but when the user rolls over the image, I'd like the source of the image to change to something else to indicate the menu is active. How do I do this with jdMenu? - Dave On Oct 16, 2:28 pm, Jonathan Sharp [EMAIL PROTECTED] wrote: $('ul.jd_menu').jdMenu({ activateDelay: 100 }); Should work, here are the other options: showDelay: 150 hideDelay: 550 Sorry there isn't any documentation yet. -js On 10/16/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hey Chris, Thanks for this recommendation. One thing I'm noticing when playing with this is that when I roll over the item that is supposed to trigger the appearance of the drop down menu, there is a one second delay getting the menu to appear. Is this a setting somewhere that can be adjusted? I'd like it to be instant. Here's my code: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/ TR/REC-html40/strict.dtd html head meta http-equiv=Content-Type content=text/html; charset=utf-8 link rel=stylesheet href=styles/jdMenu.css? type=text/css / script type=text/javascript src=scripts/jquery.js/script script type=text/javascript src=scripts/lib/bgiframe.js/ script script type=text/javascript src=scripts/lib/dimensions.js/ script script type=text/javascript src=scripts/lib/jdMenu.js/script link href=styles/jdMenu.slate.css rel=stylesheet type=text/ css / script type=text/javascript $(document).ready( function () { // Load up the drop-down menus $('ul.jd_menu').jdMenu(); } ); /script /head body table trtd class=contextMenu ul class=jd_menu jd_menu_slate liimg src=images/menu_arrow.JPG alt= border=0 align=middle height=16 width=16 / ul lia id=editTitle title=Edit Module Title class=editLink href=#Edit Module Title/a/li lia id=myspace class=myspaceLink href=# title=Export MySpace HTMLExport MySpace HTML/a/li /ul /li /ul /td/tr /table /body /html On Oct 15, 5:16 pm, Chris Jordan [EMAIL PROTECTED] wrote: check out jdMenu http://jdsharp.us/jQuery/plugins/jdMenu/. It's pretty cool. Chris On 10/15/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, Is there a plug
[jQuery] Re: creating drop down menus with JQuery?
Do you have a URL of a sample page? -js On 10/17/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I tried setting all the padding attributes in the jdMenu.slate.css file to zero, but still no luck -- the menu appears away (to the bottom and right) of the graphic). On your web site, you mention the plug-in supports relative positioning. Is there an example somewhere on the site? I can just model my code off the example. Thanks for your replies, - Dave On Oct 17, 9:29 am, Jonathan Sharp [EMAIL PROTECTED] wrote: The menu positioning code uses absolute positioning. Try removing the padding in CSS on the LI which should then make the menu appear directly below the arrow. Cheers, -js On 10/16/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Beautiful. This may also be a non-jdMenu question but I'll throw this out there. I want my drop-down menu to appear right beneath the arrow image, whereever the arrow may be positioned on the screen. But when I insert the relative style in the UL tag: ul class=jd_menu jd_menu_slate style=position: relative; left: 0px; top: 0px; liimg src=images/menu_arrow.JPG alt= border=0 align=middle height=16 width=16 / ul lia id=editTitle__ID__ title=Edit Module Title class=editLink href=#Edit Module Title/a/li lia id=myspace__ID__ class=myspaceLink href=# title=Export MySpace HTMLExport MySpace HTML/a/li /ul /li /ul The menu actually appears quite away (to the right and bottom) of the arrow. It does this for both PC IE and Firefox, although I can't tell if the distances are the same. Any advice for relatively lining up the menu directly beneath the image? Thanks, - Dave On Oct 16, 3:56 pm, Jonathan Sharp [EMAIL PROTECTED] wrote: I think this is less of a jdMenu specific thing but you could do something like the following: Assuming: ul class=jd_menu liText img src=images/menu_arrow.JPG alt= border=0 align=middle height=16 width=16 //li.../ul $('ul.jd_menu li').hover(function() { $(' img', this).attr('src', 'url-to-image.jpg');}, function() { $(' img', this).attr('src', 'url-to-other-image.jpg'); }); -js On 10/16/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Thanks for this info. Worked great. One more small question. To trigger the appearance of a drop-down menu, I have an image of an arrow img src=images/menu_arrow.JPG alt= border=0 align=middle height=16 width=16 / but when the user rolls over the image, I'd like the source of the image to change to something else to indicate the menu is active. How do I do this with jdMenu? - Dave On Oct 16, 2:28 pm, Jonathan Sharp [EMAIL PROTECTED] wrote: $('ul.jd_menu').jdMenu({ activateDelay: 100 }); Should work, here are the other options: showDelay: 150 hideDelay: 550 Sorry there isn't any documentation yet. -js On 10/16/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hey Chris, Thanks for this recommendation. One thing I'm noticing when playing with this is that when I roll over the item that is supposed to trigger the appearance of the drop down menu, there is a one second delay getting the menu to appear. Is this a setting somewhere that can be adjusted? I'd like it to be instant. Here's my code: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/ TR/REC-html40/strict.dtd html head meta http-equiv=Content-Type content=text/html; charset=utf-8 link rel=stylesheet href=styles/jdMenu.css? type=text/css / script type=text/javascript src=scripts/jquery.js/script script type=text/javascript src=scripts/lib/bgiframe.js/ script script type=text/javascript src=scripts/lib/dimensions.js/ script script type=text/javascript src=scripts/lib/jdMenu.js/script link href=styles/jdMenu.slate.css rel=stylesheet type=text/ css / script type=text/javascript $(document).ready( function () { // Load up the drop-down menus $('ul.jd_menu').jdMenu(); } ); /script /head body table trtd class=contextMenu ul class=jd_menu jd_menu_slate liimg src=images/menu_arrow.JPG alt= border=0 align=middle height
[jQuery] Re: How do I completely overwrite an event?
If you're using jquery-1.2+ you can do the following to just wipe out your events: $('#BLAH').bind('click.myfn', function() { ... }); $('#BLAH').unbind('click.myfn').bind('click.myfn', function() { ... }); This will only replace your event (myfn can be whatever you want) otherwise if you do unbind('click') it will remove all click events. Cheers, -js On 10/16/07, Karl Rudd [EMAIL PROTECTED] wrote: That's correct. If you want to overwrite the existing event you'll have to unbind it first. To use your example: $('##BLAH').click(function(){window.status+='a';}); $('##BLAH').unbind('click').click(function(){window.status+='b';}); Karl Rudd On 10/17/07, nick [EMAIL PROTECTED] wrote: It seems that jquery is appending new events to any existing event handler. eg: $('##BLAH').click(function(){window.status+='a';}); $('##BLAH').click(function(){window.status+='b';}); Clicking 'BLAH' you get 'ab' on the status bar instead of 'a'??
[jQuery] Re: Stopping event propagation on non-standard event types
I'll take a shot at that as I've been using some custom events in components being built and it'd be a nice behavior to have. And allow for a decoupling of callbacks that we have with developers currently. Cheers, -js On 10/17/07, Jörn Zaefferer [EMAIL PROTECTED] wrote: Jonathan Sharp schrieb: $(window) .bind('testEvent', function(e) { alert('1'); e.stopPropagation(); e.preventDefault(); return false; }) .bind('testEvent', function() { alert('2'); }) .trigger('testEvent'); The above code doesn't stop the testEvent from triggering the second alert. Is the propagation prevention just for standard events such as 'click', etc.? Yep. jQuery makes no attempt to implement any of those two for custom events. But its an interesting idea and not too hard to implement. If you want to give an implementation a try, you'd have to start at this line: data.unshift( this.fix({ type: type, target: element }) ); You could provide implementations for preventDefault and stopPropagation here. The jQuery.event.handle method would have to be modified to check if one of those two was called and cancel event handling when dealing with triggered events. -- Jörn
[jQuery] Re: creating drop down menus with JQuery?
Now that I think about it, the offsets only apply to sub menus. Try this instead. I quickly tested it so I think it has a chance at working. ul.jd_menu ul { margin-left: -8px; margin-top: -13px; } Cheers, -js On 10/17/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: To give you an update on this, I tried to exaggerate the effect, I put -100 for both offsetX and offsetY, $('ul.jd_menu').jdMenu({ offsetX: -100, offsetY: -100, activateDelay: 20, hideDelay: 20 }); but it didn't seem to move the menu http://groups.google.com/group/jquery-en/browse_thread/thread/4793fc4e34ebb5c1 - Dave On Oct 17, 1:22 pm, Jonathan Sharp [EMAIL PROTECTED] wrote: Try passing in with your defaults (using either positive or negative numbers) and see if that helps at all. offsetX: 4, offsetY: 2, Cheers, -js On 10/17/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I do. It is http://elearningrd.info/portal/test.php - Dave On Oct 17, 10:09 am, Jonathan Sharp [EMAIL PROTECTED] wrote: Do you have a URL of a sample page? -js On 10/17/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I tried setting all the padding attributes in the jdMenu.slate.css file to zero, but still no luck -- the menu appears away (to the bottom and right) of the graphic). On your web site, you mention the plug-in supports relative positioning. Is there an example somewhere on the site? I can just model my code off the example. Thanks for your replies, - Dave On Oct 17, 9:29 am, Jonathan Sharp [EMAIL PROTECTED] wrote: The menu positioning code uses absolute positioning. Try removing the padding in CSS on the LI which should then make the menu appear directly below the arrow. Cheers, -js On 10/16/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Beautiful. This may also be a non-jdMenu question but I'll throw this out there. I want my drop-down menu to appear right beneath the arrow image, whereever the arrow may be positioned on the screen. But when I insert the relative style in the UL tag: ul class=jd_menu jd_menu_slate style=position: relative; left: 0px; top: 0px; liimg src=images/menu_arrow.JPG alt= border=0 align=middle height=16 width=16 / ul lia id=editTitle__ID__ title=Edit Module Title class=editLink href=#Edit Module Title/a/li lia id=myspace__ID__ class=myspaceLink href=# title=Export MySpace HTMLExport MySpace HTML/a/li /ul /li /ul The menu actually appears quite away (to the right and bottom) of the arrow. It does this for both PC IE and Firefox, although I can't tell if the distances are the same. Any advice for relatively lining up the menu directly beneath the image? Thanks, - Dave On Oct 16, 3:56 pm, Jonathan Sharp [EMAIL PROTECTED] wrote: I think this is less of a jdMenu specific thing but you could do something like the following: Assuming: ul class=jd_menu liText img src=images/menu_arrow.JPG alt= border=0 align=middle height=16 width=16 //li.../ul $('ul.jd_menu li').hover(function() { $(' img', this).attr('src', 'url-to-image.jpg');}, function() { $(' img', this).attr('src', 'url-to-other-image.jpg'); }); -js On 10/16/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Thanks for this info. Worked great. One more small question. To trigger the appearance of a drop-down menu, I have an image of an arrow img src=images/menu_arrow.JPG alt= border=0 align=middle height=16 width=16 / but when the user rolls over the image, I'd like the source of the image to change to something else to indicate the menu is active. How do I do this with jdMenu? - Dave On Oct 16, 2:28 pm, Jonathan Sharp [EMAIL PROTECTED] wrote: $('ul.jd_menu').jdMenu({ activateDelay: 100 }); Should work, here are the other options: showDelay: 150 hideDelay: 550 Sorry there isn't any documentation yet. -js On 10/16/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hey Chris, Thanks for this recommendation. One thing I'm noticing when playing
[jQuery] Re: Stopping event propagation on non-standard event types
On 10/17/07, Jörn Zaefferer [EMAIL PROTECTED] wrote: Jonathan Sharp schrieb: I'll take a shot at that as I've been using some custom events in components being built and it'd be a nice behavior to have. And allow for a decoupling of callbacks that we have with developers currently. Gives me some interesting ideas for veto-based validation events. Think of an ajaxForm method that triggers a validation event and cancels the submit accordingly. Mike actually implemented something similar long ago in the form plugin, but I guess it lacked the decoupled model of custom events to get adopted. Be sure to share your implementation! I will for sure! -- Jörn
[jQuery] Re: creating drop down menus with JQuery?
$('ul.jd_menu').jdMenu({ activateDelay: 100 }); Should work, here are the other options: showDelay: 150 hideDelay: 550 Sorry there isn't any documentation yet. -js On 10/16/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hey Chris, Thanks for this recommendation. One thing I'm noticing when playing with this is that when I roll over the item that is supposed to trigger the appearance of the drop down menu, there is a one second delay getting the menu to appear. Is this a setting somewhere that can be adjusted? I'd like it to be instant. Here's my code: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/ TR/REC-html40/strict.dtd html head meta http-equiv=Content-Type content=text/html; charset=utf-8 link rel=stylesheet href=styles/jdMenu.css? type=text/css / script type=text/javascript src=scripts/jquery.js/script script type=text/javascript src=scripts/lib/bgiframe.js/ script script type=text/javascript src=scripts/lib/dimensions.js/ script script type=text/javascript src=scripts/lib/jdMenu.js/script link href=styles/jdMenu.slate.css rel=stylesheet type=text/ css / script type=text/javascript $(document).ready( function () { // Load up the drop-down menus $('ul.jd_menu').jdMenu(); } ); /script /head body table trtd class=contextMenu ul class=jd_menu jd_menu_slate liimg src=images/menu_arrow.JPG alt= border=0 align=middle height=16 width=16 / ul lia id=editTitle title=Edit Module Title class=editLink href=#Edit Module Title/a/li lia id=myspace class=myspaceLink href=# title=Export MySpace HTMLExport MySpace HTML/a/li /ul /li /ul /td/tr /table /body /html On Oct 15, 5:16 pm, Chris Jordan [EMAIL PROTECTED] wrote: check out jdMenu http://jdsharp.us/jQuery/plugins/jdMenu/. It's pretty cool. Chris On 10/15/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, Is there a plug-in that allows for menu creatio in JQuery? Specifically, I'm looking for something where when you roll over an arrow graphic, a menu will pop up beneath it. I do not need submenus to pull out over individual menu items. Thanks for any advice, - Dave --http://cjordan.us
[jQuery] Re: creating drop down menus with JQuery?
I think this is less of a jdMenu specific thing but you could do something like the following: Assuming: ul class=jd_menu liText img src=images/menu_arrow.JPG alt= border=0 align=middle height=16 width=16 //li.../ul $('ul.jd_menu li').hover(function() { $(' img', this).attr('src', 'url-to-image.jpg'); }, function() { $(' img', this).attr('src', 'url-to-other-image.jpg'); }); -js On 10/16/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Thanks for this info. Worked great. One more small question. To trigger the appearance of a drop-down menu, I have an image of an arrow img src=images/menu_arrow.JPG alt= border=0 align=middle height=16 width=16 / but when the user rolls over the image, I'd like the source of the image to change to something else to indicate the menu is active. How do I do this with jdMenu? - Dave On Oct 16, 2:28 pm, Jonathan Sharp [EMAIL PROTECTED] wrote: $('ul.jd_menu').jdMenu({ activateDelay: 100 }); Should work, here are the other options: showDelay: 150 hideDelay: 550 Sorry there isn't any documentation yet. -js On 10/16/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hey Chris, Thanks for this recommendation. One thing I'm noticing when playing with this is that when I roll over the item that is supposed to trigger the appearance of the drop down menu, there is a one second delay getting the menu to appear. Is this a setting somewhere that can be adjusted? I'd like it to be instant. Here's my code: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/ TR/REC-html40/strict.dtd html head meta http-equiv=Content-Type content=text/html; charset=utf-8 link rel=stylesheet href=styles/jdMenu.css? type=text/css / script type=text/javascript src=scripts/jquery.js/script script type=text/javascript src=scripts/lib/bgiframe.js/ script script type=text/javascript src=scripts/lib/dimensions.js/ script script type=text/javascript src=scripts/lib/jdMenu.js/script link href=styles/jdMenu.slate.css rel=stylesheet type=text/ css / script type=text/javascript $(document).ready( function () { // Load up the drop-down menus $('ul.jd_menu').jdMenu(); } ); /script /head body table trtd class=contextMenu ul class=jd_menu jd_menu_slate liimg src=images/menu_arrow.JPG alt= border=0 align=middle height=16 width=16 / ul lia id=editTitle title=Edit Module Title class=editLink href=#Edit Module Title/a/li lia id=myspace class=myspaceLink href=# title=Export MySpace HTMLExport MySpace HTML/a/li /ul /li /ul /td/tr /table /body /html On Oct 15, 5:16 pm, Chris Jordan [EMAIL PROTECTED] wrote: check out jdMenu http://jdsharp.us/jQuery/plugins/jdMenu/. It's pretty cool. Chris On 10/15/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, Is there a plug-in that allows for menu creatio in JQuery? Specifically, I'm looking for something where when you roll over an arrow graphic, a menu will pop up beneath it. I do not need submenus to pull out over individual menu items. Thanks for any advice, - Dave --http://cjordan.us- Hide quoted text - - Show quoted text -
[jQuery] Re: Using multiple versions of jQuery on the same page
A URL would be helpful for debugging. -js On 10/15/07, airslim [EMAIL PROTECTED] wrote: Actually it does make sense... but its not working, for my case : var jq = jQuery.noConflict(true); throws an arror with firebug - jQuery is not a constructor.
[jQuery] Re: jdmenu and new dimensions issue?
Howdy, I'm jumping in late to the conversation here. As Brandon pointed out there were some updates to dimensions/jQuery core that need to be updated in the plugin. I have a rewrite nearing completion which I'm working hard at trying to have completed and published by Ajax Experience at the end of October. Let me take a moment and appologize to those of you who have contacted me but haven't gotten a response. With this plugins growth and popularity I'm getting more emails than I can respond to. I unfortunately haven't had the time available to commit to this over the past few months due to family, personal and work commitments. Cheers, -js On 9/25/07, Eridius [EMAIL PROTECTED] wrote: A demo of the issue is at: www.kaizendigital.com/index2.php Note you have to use FF right now cause IE is even more broken. if you hover over products, you will get the error. can't test out a unpack till later tonight. Brandon Aaron wrote: Okay ... sorry for the confusion. I'm just trying to figure out if it is actually a compatibility issue with dimensions or just jQuery 1.2. So if you use jQuery 1.2 + older dimensions it works as expected but when you add UI and new dimensions it breaks? Could you use the unpacked source to get a more meaningful error? Could you upload a demo of the issue? -- Brandon Aaron On 9/25/07, Eridius [EMAIL PROTECTED] wrote: I know it work with the older version the jdmenu comes with however i also am using the jQuery UI which needs the newer version and i can't use both versions. Brandon Aaron wrote: You can get the older version of dimensions here: http://jquery.com/plugins/project/dimensions If you could test it out, that would help a lot. Thanks! -- Brandon Aaron On 9/25/07, Eridius [EMAIL PROTECTED] wrote: I don't know which version it comes with by default but it does work with that version but not he version with jQuery UI and not sure which version that is since the file does not have a version number just the rev number that i gave you. Brandon Aaron wrote: Does it work with Dimensions 1.1.2? -- Brandon Aaron On 9/25/07, Eridius [EMAIL PROTECTED] wrote: has anyone been able to use jdmenu 1.3 with jquery 1.2.1 and dimensions Rev: 3238 Built on 2007-09-11 for jQuery 1.2+? Brandon Aaron wrote: What issue are you referring to? -- Brandon Aaron On 9/23/07, Eridius [EMAIL PROTECTED] wrote: Does anyone know if the issue with the new dimensions(the one with the jQuery UI) is being worked out with jdmenu cause i need to use both or is there a menu system like jdmenu under development for release in the jQuery UI? -- View this message in context: http://www.nabble.com/jdmenu-and-new-dimensions-issue--tf4506665s15494.html#a12852921 Sent from the JQuery mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/jdmenu-and-new-dimensions-issue--tf4506665s15494.html#a12880089 Sent from the JQuery mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/jdmenu-and-new-dimensions-issue--tf4506665s15494.html#a12880333 Sent from the JQuery mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/jdmenu-and-new-dimensions-issue--tf4506665s15494.html#a12881445 Sent from the JQuery mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/jdmenu-and-new-dimensions-issue--tf4506665s15494.html#a12881853 Sent from the JQuery mailing list archive at Nabble.com.
[jQuery] Re: jQuery camp: any closer to a location decision?
Are there any details in terms of times? I'm attempting to schedule a flight and need to know if I have time to catch on Saturday night. Cheers, -js On 9/15/07, John Resig [EMAIL PROTECTED] wrote: It's very likely that this will be taking place at Harvard University, thus, it'll be on any number of bus and subway lines, making for easy transportation. --John On 9/15/07, Su [EMAIL PROTECTED] wrote: Or at any rate, something a little narrower than two possible cities? *grin* I want to try and get myself to this, but need to do figure out logistics a bit as a car rental is probably out of the question.
[jQuery] PERFORMANCE TIP: removeClass()
*Do not do:* $(...).removeClass('a').removeClass('b').removeClass('c'); *Instead do:* $(...).removeClass('a b c'); Same applys to addClass() I had 15 classes I had to remove and Firefox was a champ at chained removeClass calls, IE was taking 760ms! -js
[jQuery] Re: PERFORMANCE TIP: removeClass()
I'm not sure how it compares but the case I'm talking about isn't simply removing all classes. I'm removing a subset of the classes and I don't arbitrarily know what other classes may be on the element. -js On 9/19/07, seedy [EMAIL PROTECTED] wrote: just curious how would that compare to $(...).attr('class',''); Jonathan Sharp-2 wrote: *Do not do:* $(...).removeClass('a').removeClass('b').removeClass('c'); *Instead do:* $(...).removeClass('a b c'); Same applys to addClass() I had 15 classes I had to remove and Firefox was a champ at chained removeClass calls, IE was taking 760ms! -js -- View this message in context: http://www.nabble.com/PERFORMANCE-TIP%3A-removeClass%28%29-tf4482293s15494.html#a12781851 Sent from the JQuery mailing list archive at Nabble.com.
[jQuery] Re: PERFORMANCE TIP: removeClass()
Here's a rough outline of the code/style in question. My plugin will position an element in one of 16 predefined locations and add a css class pertaining to that location (eg. location1). It knows nothing about the element it's positioning. When it adds the location css class it first has to remove any existing location classes (16 total) as an element could have been previously positioned. The location css classes have no style but are used as selectors for an element. .location0 img.foo { left: 0px; } .location1 img.foo { left: 10px; } The final code in question is along the lines of: $(element).removeClass('location0 location1 ... location15').addClass('location' + n); -js On 9/19/07, Andy Matthews [EMAIL PROTECTED] wrote: I might argue that if you're having to add/remove 15 classes, that your time could be better spent optimizing your display code. andy -- *From:* jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Jonathan Sharp *Sent:* Wednesday, September 19, 2007 11:55 AM *To:* jquery-en@googlegroups.com *Subject:* [jQuery] PERFORMANCE TIP: removeClass() *Do not do:* $(...).removeClass('a').removeClass('b').removeClass('c'); *Instead do:* $(...).removeClass('a b c'); Same applys to addClass() I had 15 classes I had to remove and Firefox was a champ at chained removeClass calls, IE was taking 760ms! -js
[jQuery] Re: [NEWS] jQuery's Fearless Leader on Ajaxian
I'm confused! ...he's not 10ft tall? Is he a mere mortal? -js On 8/24/07, Rey Bango [EMAIL PROTECTED] wrote: jQuery's fearless leader John Resig is in the news today on Ajaxian.com. The post is about John's recent chat over at Google on Best Practices in Javascript Library Design. The cool thing is that its a video presentation so you get to see the man in action!! http://ajaxian.com/archives/best-practices-in-javascript-library-design Rey
[jQuery] Re: auto scrool
While this isn't exactly what you're looking for it would give you a base to build upon if you were to write your own. It would have the calculations for scrolling as well as some timing events. http://jdsharp.us/jQuery/plugins/AutoScroll/ Cheers, -Jonathan On 8/23/07, rayfidelity [EMAIL PROTECTED] wrote: Hi, I have to find a solution for auto scroll. I'm thinking of an iframe and a script which would scroll a page without user interaction. When it would reach the end of the document (page) it would start again from the top (or go backwards up). Has anyone found something similar? Thanks! BR
[jQuery] Clear element's style in IE?
I'm using this to clear an element's style (as set by developer's) and it works great in FF but not IE. Any thoughts? $('[EMAIL PROTECTED]').attr('style', ''); Cheers, -js
[jQuery] Re: Iterating over 1000 items - optimizing jquery
This can be reduced to this: $(document).ready(function() { function doPlusMinus(event) { qty_field = $(this).parent('td').find('[EMAIL PROTECTED]'); var num = $(qty_field).val(); $(qty_field).val( num + (event.data === true ? 1 : (num 0 ? -1 : 0)) ); } // Find our input fields, append a minus plus image (create minus image, add plus image after minus image) $('[EMAIL PROTECTED],[EMAIL PROTECTED]') .after( $('img src=images/buttons/button_minus.gif alt=- class=decrement /') .bind('click', false, doPlusMinus) .after( $('img src=images/buttons/button_plus.gif alt=+ class=increment /').bind('click', true, doPlusMinus) ) ); $(table.summarytable tr:even).addClass(odd); }); Cheers, -js On 8/21/07, seedy [EMAIL PROTECTED] wrote: You shouldn't need to use the .each $('td [EMAIL PROTECTED]@type=text]').after('stuff') will append to all elements that match the selector, no need to go into a loop with each. Dan Eastwell wrote: Hi, I'm doing an order form for a bookstore. The order form has over 500 items in it, so jquery runs slowly. There is no way I can change the number of items, it's a given and a piece of business 'logic'. The jquery I have comprises four simple functions to add increment/decrement buttons to the order form to increase quantities, and a jquery addClass call to add pajama/zebra stripes to the table. There are two quantity fields (again for business reasons), so that's over a 1000 items. http://test2.danieleastwell.co.uk/test2/master_order_test.html The problem is it causes a 'script hanging' error IE7 on, I'm guessing, slower machines (not mine), and takes ~10secs in Firefox2 (with firebug/validation tools) to load. Is there any way I can optimize this to load any more quickly, or do I need to give up on scripting to add the items and their functionality? Many thanks, Dan. $(document).ready(function() { addPlusMinus(td [EMAIL PROTECTED]@type=text]); addPlusMinus(td [EMAIL PROTECTED]@type=text]); increment(#order_form img.increment); decrement(#order_form img.decrement); $(table.summarytable tr:even).addClass(odd); }); function addPlusMinus(input_text){ $(input_text).each( function(){ $(this).after( images/buttons/button_minus.gif images/buttons/button_plus.gif ); }); } function increment(image_button) { $(image_button).bind(click, function() { qty_field = $(this).parent(td).find([EMAIL PROTECTED]); var numValue = $(qty_field).val(); numValue++; $(qty_field).val(numValue); }); } function decrement(image_button) { $(image_button).bind(click, function() { qty_field = $(this).parent(td).find([EMAIL PROTECTED]); var numValue = $(qty_field).val(); if (numValue 0 ) { numValue--; } $(qty_field).val(numValue); }); } -- Daniel Eastwell Portfolio and articles: http://www.thoughtballoon.co.uk Blog: http://www.thoughtballoon.co.uk/blog -- View this message in context: http://www.nabble.com/Iterating-over-1000-items---optimizing-jquery-tf4306183s15494.html#a12258350 Sent from the JQuery mailing list archive at Nabble.com.
[jQuery] Re: Iterating over 1000 items - optimizing jquery
Sending code via e-mail stinks! The basic logic for the after is: // Append our images $(...).after( // Create a new image element $('img src=images/buttons/button_minus.gif alt=- class=decrement /') // Bind your click event to it .bind('click', false, doPlusMinus) // Add the sceond image element after it .after( // You may be able to substitue add (to select this element for this object) for this after call // Create your element and bind the event to it $('img src=images/buttons/button_plus.gif alt=+ class=increment /').bind('click', true, doPlusMinus) ) ) Cheers, -js On 8/21/07, Jonathan Sharp [EMAIL PROTECTED] wrote: This can be reduced to this: $(document).ready(function() { function doPlusMinus(event) { qty_field = $(this).parent('td').find('[EMAIL PROTECTED]'); var num = $(qty_field).val(); $(qty_field).val( num + ( event.data === true ? 1 : (num 0 ? -1 : 0)) ); } // Find our input fields, append a minus plus image (create minus image, add plus image after minus image) $('[EMAIL PROTECTED],[EMAIL PROTECTED]') .after( $('img src=images/buttons/button_minus.gif alt=- class=decrement /') .bind('click', false, doPlusMinus) .after( $('img src=images/buttons/button_plus.gif alt=+ class=increment /').bind('click', true, doPlusMinus) ) ); $(table.summarytable tr:even).addClass(odd); }); Cheers, -js On 8/21/07, seedy [EMAIL PROTECTED] wrote: You shouldn't need to use the .each $('td [EMAIL PROTECTED]@type=text]').after('stuff') will append to all elements that match the selector, no need to go into a loop with each. Dan Eastwell wrote: Hi, I'm doing an order form for a bookstore. The order form has over 500 items in it, so jquery runs slowly. There is no way I can change the number of items, it's a given and a piece of business 'logic'. The jquery I have comprises four simple functions to add increment/decrement buttons to the order form to increase quantities, and a jquery addClass call to add pajama/zebra stripes to the table. There are two quantity fields (again for business reasons), so that's over a 1000 items. http://test2.danieleastwell.co.uk/test2/master_order_test.html The problem is it causes a 'script hanging' error IE7 on, I'm guessing, slower machines (not mine), and takes ~10secs in Firefox2 (with firebug/validation tools) to load. Is there any way I can optimize this to load any more quickly, or do I need to give up on scripting to add the items and their functionality? Many thanks, Dan. $(document).ready(function() { addPlusMinus(td [EMAIL PROTECTED]@type=text]); addPlusMinus(td [EMAIL PROTECTED]@type=text]); increment(#order_form img.increment); decrement(#order_form img.decrement); $(table.summarytable tr:even).addClass(odd); }); function addPlusMinus(input_text){ $(input_text).each( function(){ $(this).after( images/buttons/button_minus.gif images/buttons/button_plus.gif ); }); } function increment(image_button) { $(image_button).bind(click, function() { qty_field = $(this).parent(td).find([EMAIL PROTECTED]); var numValue = $(qty_field).val(); numValue++; $(qty_field).val(numValue); }); } function decrement(image_button) { $(image_button).bind(click, function() { qty_field = $(this).parent(td).find([EMAIL PROTECTED]); var numValue = $(qty_field).val(); if (numValue 0 ) { numValue--; } $(qty_field).val(numValue); }); } -- Daniel Eastwell Portfolio and articles: http://www.thoughtballoon.co.uk Blog: http://www.thoughtballoon.co.uk/blog -- View this message in context: http://www.nabble.com/Iterating-over-1000-items---optimizing-jquery-tf4306183s15494.html#a12258350 Sent from the JQuery mailing list archive at Nabble.comhttp://nabble.com/ .
[jQuery] Re: Do my emails make it to the list?
I did some more research into google groups and there isn't a threshold or a way to set after x time period user is allowed to post. Please be patient as the group has grown to over 3100 members. We'll be approving new accounts as posts are made. I understand how frustrating it can be to have your posts moderated at first. We'll make sure that legitimate members are approved but it may take a day or two from your first post. Initially the group was unmoderated for new members but we were having an issue with significantly off topic posts for pharmaceutical products and services that I'm offended to think they see the jQuery community needing! (We're the elite upper society, we need no such gobbly goop!) Moreover it's unfortunate that the handful of spamming accounts joining requires that new accounts be moderated but so far I've banned 3 accounts and caught a number of messages that would not fall into the family friendly nature of this group. So please be patient as we approve you as you start contributing. Cheers, -Jonathan On 8/17/07, Giovanni Battista Lenoci [EMAIL PROTECTED] wrote: Jonathan Sharp ha scritto: The reason there's a delay is that new members posts are moderated to fight spam. After x number of valid posts the moderation restriction is removed. I've removed this restriction for your account. Cheers, -js How much is X? I wrote a few post (like 5 o 6) and 3 of them gone lost (don't know if nobody answered) . In thunderbird I cant's messages I send (why?), then when someone answer on my post in tree view I see a new messagge with RE:{subject}. Thank you
[jQuery] Re: Avoiding anonymous functions - enhancement suggestion
On 8/17/07, John Resig [EMAIL PROTECTED] wrote: I've thought of this, as well. I also wanted to add a hook to allow: $(...).click(.toggle()) However, I'm currently leaning away from it (embedding code in strings is messy) in favor of another solution that I'm working on: $(...).onclick().toggle().end(); I've been working on implementing Dave Methvin's approach...there's just a few details remaining... $(...).onclick().readMind(); This will further be simplified as you'll be able to do: $(function(){ $.readMind(); }); Which will result in a final reduction to: $(); I'll send an announcment once I'm done... -js
[jQuery] Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names
On 8/16/07, Stephan Beal [EMAIL PROTECTED] wrote: On Aug 16, 7:39 pm, Mitch [EMAIL PROTECTED] wrote: *snip* Simon Willison apparently has a similar hang-up about jQuery. And, like i am in my hate-hate relationship with Python, he's in the minority. Minor detail, it wasn't Simon Willson who made that comment, it as Thor Larholm (http://larholm.com/about-2/) I think one aspect of Thor's argument can be proved true with a grain of salt and that is learning jQuery isn't a replacement for learning JS/DOM for SOME people. Two different situations to take into account: 1) Average j(an|o)e want's to spice up h(er|is) page and add a cool tabbed interface, a jQuery minute(TM) later and they're done 2) Application developer is building an enterprise solution/product and utilizing jQuery. jQuery greatly speeds up development but underlying knowledge of JS/DOM is of the utmost importance. Having come from a strong JS background prior to jQuery, jQuery doesn't replace my thought process in regards to the DOM, it enhances it taking development time from hours of tedius coding to a jQuery minute(TM). The knowledge of the pure form is (I'll go as far as to say) required. So I can see his argument for not having those he's mentoring learn it, but that doesn't mean he shouldn't use it. This can go back to the argument in CS majors of students complaining that they have to learn memory management/heaps/stacks/registeres/etc when Java doesn't use any of them. The thing that ends up distinguishing good from great programmers is their underlying knowledge of the abstraction layers they're using. Thus we're right back at Simon Wilson's argument for learning the underlying black box. -js http://jQueryMinute.com (my host is having some network problems...)
[jQuery] Re: Do my emails make it to the list?
The reason there's a delay is that new members posts are moderated to fight spam. After x number of valid posts the moderation restriction is removed. I've removed this restriction for your account. Cheers, -js On 8/15/07, barophobia [EMAIL PROTECTED] wrote: I can see my emails in the Gmail interface but it doesn't seem that they're actually making it to everyone else. Please respond (off list). Thanks, Chris.
[jQuery] Re: Do my emails make it to the list?
No, probably not. Your messages are posted, just not immediately. We're pretty good at moderating posts quickly. Sometimes googlegroups seems a little lagged. Cheers, -js On 8/15/07, Göran Törnquist [EMAIL PROTECTED] wrote: Is that the reason why I haven't had any responses to my post (and repost) about problems with 3D Carousel? /Göran The reason there's a delay is that new members posts are moderated to fight spam. After x number of valid posts the moderation restriction is removed. I've removed this restriction for your account. Cheers, -js On 8/15/07,* barophobia* [EMAIL PROTECTED] wrote: I can see my emails in the Gmail interface but it doesn't seem that they're actually making it to everyone else. Please respond (off list). Thanks, Chris. -- This message has been scanned for viruses and dangerous content by *MailScanner* http://www.mailscanner.info/, and is believed to be clean. -- - Göran Törnquist Stockby Hantverksby 4 181 75 Lidingö 0733-86 04 70 -- This message has been scanned for viruses and dangerous content by *MailScanner* http://www.mailscanner.info/, and is believed to be clean.
[jQuery] Re: new Plugin every: jQuery-oriented setTimeout and setInterval
I'm going to throw my suggestion in: $(...).oneTime(); $(...).everyTime(); $(...).stopTime(); Cheers, -js P.S. I approved your account so there shouldn't be a delay anymore. On 8/14/07, Blair Mitchelmore [EMAIL PROTECTED] wrote: Maybe it's just my jealousy of pattern matching and multi-methods that makes me want that particular solution. I definitely think that jQuery is getting big enough that some form of plugin hierarchy would be nice. (Though I'm perhaps a tad too modest to want a namespace for myself. perhaps $(...).timer.start() ?) I recall from last summer there was some discussion of namespacing of plugins and john didn't seem to think it would be a huge technological hurdle but it didn't really go anywhere. Personally, I think that direct namespacing like that removes some of the brevity and simplicity of jQuery. Though perhaps an importing system could be used. jQuery.import(timer); jQuery(...).stop(); // stops timer events not animations But this is all a discussion better suited for the dev list. -blair On Aug 14, 9:52 am, Stephan Beal [EMAIL PROTECTED] wrote: On Aug 14, 3:34 pm, Blair Mitchelmore [EMAIL PROTECTED] wrote: (Though I think the next step in improving how plugins interoperate is allowing multiple plugins to operate under the same name by having the plugin provide some sort of argument test to determine if the provided arguments are valid and then using that plugin on a case by case basis) i think namespaces would be a better idea, e.g.: $(...).blair.start(...); $(...).blair.stop(...) i don't know if that type of thing is possible using the current jQ code. That sounds like a good question for the list.
[jQuery] Re: Check this, if you've got the time
I'd recommend booglyboogly since that's what happens when you click on the X -js On 8/2/07, Paul Caton [EMAIL PROTECTED] wrote: That's neat! Now you need a good name for it. Come to think of it, it looks a bit like table tennis - maybe you could call it Ping-Pong, something like that. ;-)
[jQuery] Re: Two words for Jquery
super fly. On 8/1/07, Richard D. Worth [EMAIL PROTECTED] wrote: On 8/1/07, Mario Moura [EMAIL PROTECTED] wrote: BJ AJ (Before JQuery) (After JQuery) Meet BJ :-( Meet AJ :-) - Richard
[jQuery] Re: Are there any particular ways to debug jQuery code?
Why simply write bug free code! -js On 7/26/07, cfdvlpr [EMAIL PROTECTED] wrote: Firebug is awesome for debugging your Jquery code using firefox. But, how do you debug problems that occur in IE and IE only?
[jQuery] Re: Firebug shows Too Much Recursion errors after clicking OK in alert box
This could also be written as: $('a').click(function() { if ($(this).parents('#nav').size() == 0) { alert('...'); return false; } }); -js On 7/25/07, Erik Beeson [EMAIL PROTECTED] wrote: You don't need to wrap the parameter to not in $(...). Maybe try: $(a).not(#nav a).click(function() { alert('...'); return false; }); --Erik On 7/25/07, RwL [EMAIL PROTECTED] wrote: Not sure if this is my code's problem or Firefox's... I don't seem to be throwing any JS errors in MSIE. Here's what I'm doing: $(a).not($(#nav a)).click(function() { alert('Sorry, links are disabled in this demo except those under Profile Navigation.'); return false; }); The selectors seem to be doing just what I want; the alert gets thrown as expected, but when you OK the alert Firebug suddenly throws in anwhere from 15-40 Too Much Recursion errors with no other details. Sorry, I think I should probably be able to solve this with some Google searches but I'm not quite getting a clear enough picture yet.
[jQuery] Re: switch between two class - Basic Issue
The issue lies in that you're trying to bind your click event to .collapsibleopen at document ready time. The .collapsibleopen class won't be available until the user clicks to have it added. I think below is more of what you're after... $('.collapsible .collapsed .collapsibleopen').bind('click', function() { $(this).toggleClass('collapsible').toggleClass('collapsed').toggleClass('collapsibleopen'); }); Cheers, -js On 7/25/07, Mario Moura [EMAIL PROTECTED] wrote: Hi Folks I am trying switch between two class Is it possible? $(document).ready(function(){ $(.collapsible .collapsed).click(function(){ $(this).removeClass().addClass(collapsibleopen); }); $(collapsibleopen).click(function(){ $(this).removeClass().addClass(collapsible collapsed); }); }); My first switch works but when I click in collapsibleopen (change from the previous click) didnt change. I have many .collapsible .collapsed classes so I cant change all at the same time. Ideas? Regards -- Mário
[jQuery] Re: switch between two class - Basic Issue
Do you have a url to a sample page we could look at? -js On 7/25/07, Mario Moura [EMAIL PROTECTED] wrote: Thanks Jonathan Almost but still not working $('.collapsible .collapsed').bind('click', function() { $(this).toggleClass('collapsible').toggleClass('collapsed').toggleClass('collapsibleopen'); }); I said too I have many .collapsible .collapsed classes so I cant change all at the same time. Ideas? So when I use your idea my All tree open and if I click again all close. Works fine in main root. Can I set in $(this) to apply this JQuery only in the real clicked element? I am trying some XPath Selectors. Could you help me? Cheers ;) Mario 2007/7/25, Jonathan Sharp [EMAIL PROTECTED]: The issue lies in that you're trying to bind your click event to .collapsibleopen at document ready time. The .collapsibleopen class won't be available until the user clicks to have it added. I think below is more of what you're after... $('.collapsible .collapsed .collapsibleopen').bind('click', function() { $(this).toggleClass('collapsible').toggleClass('collapsed').toggleClass('collapsibleopen'); }); Cheers, -js On 7/25/07, Mario Moura [EMAIL PROTECTED] wrote: Hi Folks I am trying switch between two class Is it possible? $(document).ready(function(){ $(.collapsible .collapsed).click(function(){ $(this).removeClass().addClass(collapsibleopen); }); $(collapsibleopen).click(function(){ $(this).removeClass().addClass(collapsible collapsed); }); }); My first switch works but when I click in collapsibleopen (change from the previous click) didnt change. I have many .collapsible .collapsed classes so I cant change all at the same time. Ideas? Regards -- Mário -- Mário Alberto Chaves Moura [EMAIL PROTECTED] 31-9157-6000
[jQuery] Re: Find missing HTML tags
I think you're going to have to attack that server side as the html is interperted browserside into the dom tree which automatically closes tags as necessairy. -js On 7/19/07, sozzi [EMAIL PROTECTED] wrote: I have a rather odd problem where I am looking for potentially missing html tags due to truncation and need to close them. I am displaying a short summaries for an overview of published articles by showing a title and the first 30 words. Unfortunately sometimes the article starts with an OL or UL and the closing tags get truncated. Is there a way to find missing closing tags within a div and close them automatically? I don't need a final solution, any hint where to start would be great, preferably client-side (jQuery) until I get it sorted on the server-side Thanks
[jQuery] Re: AJAX download progress
Gordon, That's really slick! -js On 7/18/07, Gordon [EMAIL PROTECTED] wrote: Finally got my net access on my dev machine back. :) Here's my code. var myTrigger; var progressElem = $('#progressCounter'); $.ajax ({ type: 'GET', dataType: 'xml', url : 'somexmlscript.php' , beforeSend : function (thisXHR) { myTrigger = setInterval (function () { if (thisXHR.readyState 2) { var totalBytes = thisXHR.getResponseHeader('Content-length'); var dlBytes = thisXHR.responseText.length; (totalBytes 0)? progressElem.html (Math.round((dlBytes / totalBytes) * 100) + %): progressElem.html (Math.round(dlBytes / 1024) + K); } }, 200); }, complete: function () { clearInterval (myTrigger); }, success : function (response) { // Process XML } }); It produces the desired results in Firefox 1.5, Safari3/Win and Opera 9. But Internet Explorer produces no result at all. It doesn't even throw an error. While it's not strictly necessary for there to be a download progress report I'd personally like to see it used far more often in AJAX apps than it actually is, and I really want to make this code 1005 cross-browser. On Jul 18, 2:59 pm, Gordon [EMAIL PROTECTED] wrote: Okay, I've got some code now that works well in all the major browsers except for IE. I can't post the code just now but I'll put it up as soon as I get proper net access back on the other computer. Oddly it doesn't throw any errors in IE, it simply doesn't produce any results. Gordon wrote: I have been thinking about how to do this all morning. At first I thought it wouldn't be possible because the XHR object doesn't seem to have a property for the amount of data downloaded. But I have come up with a possible work around. I have jotted some pseudocode down and am researching how well this approach might work, but unfortunately something's gone wrong with the firewall at work and my ability to browse and find practical solutions is badly compromised just now. Anyway, here's my pseudocode: On (XHR enters stage 3) { Create an interval timer; } On (XHR enters stage 4) { Destroy timer; } On (Timer event) { If (fetching XML) Get ResponseXML length; else Get ResponseText length; If (Content-length header set) return (percent downloaded); else return (bytes downloaded); } Gordon wrote: I am trying to figure out a way of displaying how far along an AJAX download is. Assuming I know the size of the file being downloaded (this will require the server to send a content-length header) then if I can check the number of bytes downloaded thus far I should be able to work out the download progress. So what I need to know, how can you get the value of the content- length header if it is set, and how can you check the number of bytes sent periodically? I can then display a percentage for the case where both are known, or simply a count of downloaded bytes when I don't know the content length.
[jQuery] Re: Setting DOM values (non-attributes)
Take a look at the dimensions plugin. (www.visualjquery.com - Plugins - Dimensions) -js On 7/12/07, John Farrar [EMAIL PROTECTED] wrote: I want to achieve this with jQuery. document.getElementById('postedText').scrollTop = document.getElementById('postedText').scrollHeight - document.getElementById('postedText').clientHeight; Did I miss it in the docs? John Farrar
[jQuery] Re: Interested in porting another DOM creation plugin?
Turns out he works for the same company I do... I'll see what I can do... -js On 7/12/07, Jörn Zaefferer [EMAIL PROTECTED] wrote: This looks really interesting: http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/ Of course his proposal for porting doesn't quite work out with jQuery, but a port that is integrated into jQuery's API would be really cool. -- Jörn Zaefferer http://bassistance.de
[jQuery] Re: Fwd: [jQuery] Re: allow no more than 3 checkboxes checked
You're missing your return statement in this revised version (for the noob's: which is needed to cancel the event) -js On 7/10/07, Sean Catchpole [EMAIL PROTECTED] wrote: On 7/10/07, cfdvlpr [EMAIL PROTECTED] wrote: That works very well. Could you also grey out the unchecked checkboxes after 3 are checked? $.fn.limit = function(n) { var self = this; this.click(function(){ (self.filter(:checked).length==n)? self.not(:checked).attr(disabled,true).addClass(disabled): self.not(:checked).attr(disabled,false).removeClass(disabled); }); } $(input:checkbox).limit(3); ~Sean
[jQuery] Re: Some fun with jQuery
I absolutely love it! That is so slick! -js On 7/6/07, Remy Sharp [EMAIL PROTECTED] wrote: Since it's Friday - here's something I made for fun with jQuery: Have you ever looked at a picture on the Internet, say on Flickr or Facebook, and thought it would look great with a speech bubble with your own commentary? I wrote a jQuery based bookmarklet that allows you add speech bubbles to any page on the web, and share it with friends via the 'copy' link. http://leftlogic.com/lounge/articles/speech-bubbles/ Here's an example: http://tinyurl.com/2cqgd5 Let me know what you think, Remy.
[jQuery] Re: Selectors Context
On 6/20/07, Jörn Zaefferer [EMAIL PROTECTED] wrote: Jonathan Sharp wrote: On 6/20/07, *Jörn Zaefferer* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Jonathan Sharp wrote: I have the following: $('div class=foo').find('.foo').doSomething(); Why not simply this? Well, the actual implementation is a little more complex. But basically it can be expanded to: $('div class=foo/divdiv class=bar/div').foo().bar(); $.fn.foo = function() { return this.find('.foo').each(function() { ... }; }; $.fn.bar = ...etc. Okay, in that case you should give filter a try, instead of find. find looks for descendants, while filter works on the current level. Doh! Thank you... -js
[jQuery] Re: mouseout seems to occur while still in div
(untested) You need to do: $('div.a').mouseout(function(e) { if (e.target == this) { $(this).children('span.b').hide(); } }); Cheers, -js On 6/13/07, wswilson [EMAIL PROTECTED] wrote: Here is my code: html head script src=jquery.js type=text/javascript/script script type=text/javascript $(function() { $('div.a span.b').hide(); $('div.a h1').mouseover(function() {$(this).next('span.b ').show();}); $('div.a').mouseout(function() {$(this).children('span.b ').hide();}); }); /script style type=text/css .a h1, span.b { display: inline; } /style /head body div class=a h1text/h1 span class=btext/span /div /body /html I am expecting that span.b will only show when I mouseover the h1 and then hide when I leave div.a. However, it hides as soon as I leave h1. How is mouseout on div.a called when I still seem to be in div.a? Thanks!
[jQuery] Re: dynamic jdMenu help
Hi Christ, I hope I can clear up some of the confusion and frustration. jdMenu binds unbinds it's events on each show/hide which allows for easy updating of a dynamic menu. The documentation is lacking quite a bit so I appologize. I realized that this works best for sub-menus as opposed to a top level menu so what you'll need to do is call $(...).jdMenu() at the end of your ajax call after you've appended your MenuLists. Cheers, -Jonathan On 6/4/07, Chris Jordan [EMAIL PROTECTED] wrote: Hi folks, I'm in need of some help using jdMenu. I've got a nice menu up and running using ver. 1.2.1, but it's static: meaning that I've hard coded the un-ordered lists that make up the menu contents. What I need now is a way for my app to build the menu on the fly depending on what screen the user is currently viewing. The app makes extensive use of ajax and so is only loaded one time at the beginning. I've tried having an empty ul element that contains the jdMenu class, like this: ul id=MainToolbar class=jd_menu jd/ul and then making an ajax call to the server which builds the rest of the list elements and then does an empty().append(MenuLists); upon returning, but that didn't work. I've tried just building the what I need in JavaScript into some variable that I then do an append() with, but that's not working either. Does anybody have any thoughts on this? Does anyone thing they can help? Thanks, Chris
[jQuery] Re: dynamic jdMenu help
On 6/5/07, Chris Jordan [EMAIL PROTECTED] wrote: On Jun 5, 8:53 am, Jonathan Sharp [EMAIL PROTECTED] wrote: Hi Christ, Oh, and I am a great guy... but I don't walk on water, Jonathan... lol! :o) Oops! I don't think my coffee had kicked in yet! (Nope I wasn't trying to take the Lords' name in vain!) Cheers, -Jonathan I hope I can clear up some of the confusion and frustration. jdMenu binds unbinds it's events on each show/hide which allows for easy updating of a dynamic menu. The documentation is lacking quite a bit so I appologize. I realized that this works best for sub-menus as opposed to a top level menu so what you'll need to do is call $(...).jdMenu() at the end of your ajax call after you've appended your MenuLists. Cheers, -Jonathan On 6/4/07, Chris Jordan [EMAIL PROTECTED] wrote: Hi folks, I'm in need of some help using jdMenu. I've got a nice menu up and running using ver. 1.2.1, but it's static: meaning that I've hard coded the un-ordered lists that make up the menu contents. What I need now is a way for my app to build the menu on the fly depending on what screen the user is currently viewing. The app makes extensive use of ajax and so is only loaded one time at the beginning. I've tried having an empty ul element that contains the jdMenu class, like this: ul id=MainToolbar class=jd_menu jd/ul and then making an ajax call to the server which builds the rest of the list elements and then does an empty().append(MenuLists); upon returning, but that didn't work. I've tried just building the what I need in JavaScript into some variable that I then do an append() with, but that's not working either. Does anybody have any thoughts on this? Does anyone thing they can help? Thanks, Chris
[jQuery] Re: Colon Operator
I can't speak for John, but I asked about this about a month ago and he was saying it was slated for the 1.2 release. -js On May 31, 2:46 pm, Klaus Hartl [EMAIL PROTECTED] wrote: Rick Faircloth wrote: Let's hope so... I want him to be in business when I need him... I'm getting up in age, you know. ;o) Rick PS - I didn't know xml files had colons! The colon in XML files, e.g. in tags to be precise, denotes a namespace the particular element belongs to. There is a special selector for namespaces (CSS 3). The following would select an element named bar belonging to the namespace foo (foo:bar/): foo|bar http://www.w3.org/TR/css3-selectors/#typenmsp The given example: $('xsl|template') But I don't know if jQuery currently supports this. It has been discussed but I can't remember the outcome. -- Klaus