Re: [jQuery] Why do i need a delay in $(document).ready when using the center plugin ?
Choan C. Gálvez schrieb: On 10/24/06, Truppe Steven [EMAIL PROTECTED] wrote: i'm using the center plugin to center images inside a div. But i have to call it with a timeout like this: $(document).ready(function(){ setTimeout(doCenter(),1000); }); function doCenter(){ $(.jqcenter).each(){ $(this).center(); } } I do not really understand why i need a timeout here because DOM should allready be ready inside of $(document).ready(). That's correct. The Problem with this is that it fails for some reason in certain cases, so that the image is misplaced. To me it looks like that in these cases the function is called to early because if i refresh the page it look fine. If i replace setTimeOut and call the function direct with doCenter() it does not work at all. Do i have a general understanding problem or what am i doing wrong ? While the DOM is complete when `ready` fires, the images may not have completely loaded, so you cannot access its dimensions. When you refresh the page, the images are already in the cache. So, while `document.ready` is what we want in 99,9% of the cases, it seems it's not in yours. Go with `$(window).load`. Centering an image? Why not using little CSS and you are done...: img { display: block; margin: 0 auto; } Or if you leave the element as inline element and a have a container for the image: div { text-align: center; } -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Another update for form.js
Hi Mike! before: Callback method to be invoked before the form is submitted. default value: null after:Callback method to be invoked after the form has been successfully submitted. default value: null Could you add some documentation about the parameters for those callbacks? -- Jörn Zaefferer http://bassistance.de -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] scrolling window when draggable leaves viewport?
Hi there, is it possible to get a scrolling feature for any drag/droppable? For Example: If you leave the viewport with an object and the document body is longer or wider than the viewport, the document scrolls connected to the mouse position. You can see a good example at this YUI demo: http://developer.yahoo.com/yui/examples/dragdrop/ontop.html?mode=dist Is somebody working on it or did I miss it in the documentation? Or is there a simple way to implement this feature? regards ecki (maybe this mail appears 2x, my first attempt didn't appear in the mailing list) ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] OT: Anyone know of a good tree control
Kevin, that looks great! I bet those dotted numbers could be dynamically generated too! The numbers are useful when displaying the tree without JS. And while we are at it, remove the two buttons, or rather display them only when scripts are enabled. -- Jörn Zaefferer http://bassistance.de -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] jEditable question
Hi all, I have recently discovered jquery and jeditable. When using jeditable, I discovered two things: - Using firefox 1.0.8 jeditable does not return. I can edit my text and the changes are saved in the database. However, after hitting the enter butting (and thus submitting the changes), the busy icon is show forever, it does not return. This is also true for the demos on jeditable the site. Does ayone know how to fix this? - Instead of a string, I would rather have some json structure returned from my backend with an optional error message. Anyone already done this? Barry ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jEditable question
Barry, I've added some code to show an error message. Quite ugly solution though: I catch all returned text, and look for the following string '[error]', if it's found, I revert the form field text and alert the error. The trick is to format the error texts well (ie containing the search string). A more elegant solution would be something parameterized or something like JSON, but this worked for me: /* show the saving indicator */ $(self).html(options.indicator); $(self).load(settings.url, p, function(str) { self.editing = false; var curTxt = $(self).html(); /* check for error and revert if found. if(curTxt.indexOf('[ERROR]') != -1 ) { self.innerHTML = self.revert; alert(curTxt); } }); Cheers, Miel -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Barry Nauta Sent: dinsdag 24 oktober 2006 11:06 To: discuss@jquery.com Subject: [jQuery] jEditable question Hi all, I have recently discovered jquery and jeditable. When using jeditable, I discovered two things: - Using firefox 1.0.8 jeditable does not return. I can edit my text and the changes are saved in the database. However, after hitting the enter butting (and thus submitting the changes), the busy icon is show forever, it does not return. This is also true for the demos on jeditable the site. Does ayone know how to fix this? - Instead of a string, I would rather have some json structure returned from my backend with an optional error message. Anyone already done this? Barry ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] new plugin: SIFR (Flash Image Replacement)
I will give this a spin at work - thanks Gilles! On 22/10/06, Webunity | Gilles van den Hoven [EMAIL PROTECTED] wrote: Hi guys, http://gilles.jquery.com/sifr/ enjoy ;) ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Another update for form.js
Could you add some documentation about the parameters for those callbacks? Hi Jörn, The inline docs have more details about the callback args. I only posted the bit that itemized the available options. Thanks. Mike ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Window Dialogues
It is allready pretty big in filesize, but i wanted as much flexibility as possible, meaning you can set: isDraggable, isResizable, hasTitlebar, hasStatusbar etc.etc. I think i can have a demo ready tomorrow late in the evening. Cool. Thanks Gilles! ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Expressions: Search for children within context
Two thoughts: $( '* dt', context ); OR Just put an ID on the particulat dl that you want to use as the context. :) $( dl#foo dt ); - Brian Hi jQueryians, how do I search for a children within a context? In other words, how to translate this: $(context).children(dt)... into something like this: $(/dt, context) The latter one does unfortuanetely not work... -- Jörn Zaefferer http://bassistance.de ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] ajaxError and response content
hi, server responses with like status header 500 will trigger ajaxerrors. is it possible to get the response content of such errors? i think that would actualy be nice. so one could check these responses before falling back to a generic message as in the documentation example: $(#msg).ajaxError(function(){ $(this).append(liError requesting page./li); }); -robert ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] url and uri
Can somebody explain me how to read url's uri whit jquery... I want to change thing when ?id=1 etc with jquery. Enquest ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] jQuery and OOP
Hi, I am new to jQuery, and I have a question concerning object oriented programming. I have created a sample scenario. In the HTML code I add a button: input type=button value=Count id=btnCounter / In js, I create a class called Counter. In the constructor I add an event handler to the click event of the button. The function I specify as the handler is a method of the Counter class. I also store the button and the nr (the current value of the counter) as an object property. function Counter() { $('#btnCounter').click(this.count); this.button = $('#btnCounter'); this.nr = 0; } In the count method I set the incremented value of the counter to the text of the button. Counter.prototype = { count: function() { this.button.attr('value', this.nr++); } } And I need to create the object in the load event: $(window).load(function() { new Counter(); }); If I try to run the code I get: 'this.button has no properties'. I know that the 'this' in the count method will be the target of the event (the button). But that is not what I need, it is the reference of the Counter object. If I rewrite the constructor I can make it work: function Counter() { var oThis = this; $('#btnCounter').click( function() { oThis.count(); } ); this.button = $('#btnCounter'); this.nr = 0; } But this is quite ugly :(. Is there a nicer way to achieve this? Thx ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Why do i need a delay in $(document).ready when using the center plugin ?
The problem is that i need to center it vertical and horizontal. And i haven't found a crossbrowser way of doing that. The $(window).load works fine !! Truppe Steven ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Window Dialogues
Oh yeah! Get er done Gilles! w00t! I asked for that awhile back as well. I love that plugin for Prototype. [EMAIL PROTECTED] wrote: Anyone know of any good movable, expandable and minimzable window dialogs (like http://prototype-window.xilinus.com/index.html for Prototype) I am allready working on that, it's about 70% ready. All i need is some extra time to work on it :p It is allready pretty big in filesize, but i wanted as much flexibility as possible, meaning you can set: isDraggable, isResizable, hasTitlebar, hasStatusbar etc.etc. I think i can have a demo ready tomorrow late in the evening. -- Gilles ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Why do i need a delay in $(document).ready when using the center plugin ?
Steven,maybe this page will be of some assistance toyouhttp://www.pmob.co.uk/pob/hoz-vert-center.htmgiuliano On 24/10/06, Truppe Steven [EMAIL PROTECTED] wrote: The problem is that i need to center it vertical and horizontal. And ihaven't found a crossbrowser way of doing that.The $(window).load works fine !!Truppe Steven___ jQuery mailing listdiscuss@jquery.comhttp://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Expressions: Search for children within context
Hi Brian! Two thoughts: $( '* dt', context ); Wouldn't that select all elements within context first, and then all dt children of those elements? Just put an ID on the particulat dl that you want to use as the context. :) $( dl#foo dt ); The context is the current jQuery selection which I use from within a plugin method. Therefore I can't rely on an ID. Anyway, thanks for your suggestions. -- Jörn Zaefferer http://bassistance.de -- GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist! NEU: Jetzt bis zu 16.000 kBit/s! http://www.gmx.net/de/go/dsl ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Expressions: Search for children within context
Two thoughts: $( '* dt', context ); Wouldn't that select all elements within context first, and then all dt children of those elements? That would select all dt elements that are a child of some element, which can (should) only be a dl element. If you had nested dls there it would also pick the deeper nested dt elements. -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Why do i need a delay in $(document).ready when using the center plugin ?
Truppe Steven schrieb: The problem is that i need to center it vertical and horizontal. And i haven't found a crossbrowser way of doing that. The $(window).load works fine !! My first email doesn't get trough and there was an error of mine anyway...: Here's how I would do centering which degrades much better withouth JavaScript: Standards CSS, supported by all modern browsers: div.image { display: table-cell; width: 400px; height: 400px; vertical-align: middle; text-align: center; } IE extra CSS (dynamic property): div.image img { margin-top: expression(this.offsetHeight this.parentNode.offsetHeight ? parseInt((this.parentNode.offsetHeight - this.offsetHeight) / 2) + 'px' : '0'); } That way everything stays in the style sheet (where it belongs in my opinion). I'm not a big friend of presentational JavaScript... -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jEditable question
On Oct 24, 2006, at 12:06, Barry Nauta wrote: - Using firefox 1.0.8 jeditable does not return. I can edit my text and the changes are saved in the database. However, after hitting the enter butting (and thus submitting the changes), the busy icon is show forever, it does not return. This is also true for the demos on jeditable the site. Does ayone know how to fix this? 1.0.8 is already a bit old. Will downgrade from 1.5.x series and try it out. - Instead of a string, I would rather have some json structure returned from my backend with an optional error message. Anyone already done this? As you said, returning JSON object is backend job. Currently jEditable itself does not have methods for handling JSON responses. I have plans to add call user defined callback methods though. This would do the job. -- Mika Tuupola http://www.appelsiini.net/~tuupola/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jEditable question
1.0.8 is already a bit old. Will downgrade from 1.5.x series and try it out. It is indeed ;-) Nevertheless it would be great if this can be fixed. By the way, you do not mention that it works with IE on your website. It does work on XP SP2 with version 6.0.2900and some more version digits As you said, returning JSON object is backend job. Currently jEditable itself does not have methods for handling JSON responses. I have plans to add call user defined callback methods though. This would do the job. That would be great! Barry ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jEditable question
On Oct 24, 2006, at 14:43, Robert Wagner wrote: how about that: if an error occours, let the server send a 500 header and the error message as a content. header(HTTP/1.1 500 Internal Server Error); print(this cannot be done.); Agreed. I find error headers to be more elegant and universal solution than sending ERROR string in a reply. Will implement this soon(ish). -- Mika Tuupola http://www.appelsiini.net/~tuupola/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] A question about ajaxStart and Stop
You mean, initilized? Not executed ... right?Does not work for me.On 10/24/06, Ⓙⓐⓚⓔ [EMAIL PROTECTED] wrote:anywhere, it just has to be executed before the ajax call!Start simple, make sure your jq works in other contexts. On 10/23/06, Mats Lindblad [EMAIL PROTECTED] wrote: But where do I initilize it? In $(document).ready() ? or can I do it anywhere? I've tried all of the above and it just wont work. On 10/22/06, Ⓙⓐⓚⓔ [EMAIL PROTECTED] wrote: it's great, and easy, and you don't often need it. they are not for creating ajax requests or for dealing with responses! it's just a magical hook that can show that an ajax call has started or that all the ajax calls are done. most people seem to just do a little css to show that an ajax request is going on. Then remove the little effect when it is done. my first ajaxstart and stop just changed the background color a bit. On 10/22/06, Mats Lindblad [EMAIL PROTECTED] wrote: I have tried to get it to work and I am not sure that I am using it right so if anyone could explain to me how I am supposed to use it? Where do I initilize it, what do I attach it to? It just will not work for me. I am using jQuery 1.0.2 Rev: 413 -- If there's anything more important than my ego around, I want it caught and shot now. -- Zaphod ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- If there's anything more important than my ego around, I want it caught and shot now.-- Zaphod ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/--Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ___jQuery mailing listdiscuss@jquery.com http://jquery.com/discuss/-- If there's anything more important than my ego around, I want it caught and shot now. -- Zaphod ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jEditable question
On Tuesday 24 October 2006 15:58, Mika Tuupola wrote: On Oct 24, 2006, at 14:43, Robert Wagner wrote: how about that: if an error occours, let the server send a 500 header and the error message as a content. header(HTTP/1.1 500 Internal Server Error); print(this cannot be done.); Agreed. I find error headers to be more elegant and universal solution than sending ERROR string in a reply. Will implement this soon(ish). Just my $0.02: I find this odd. Imagine that you want some processing to be done based on the input (i.e. server side email address checking) (We all agree that any validation also needs to be performed at the serverside, right?). If the provided email address appears to be incorrect, I would never think about throwing a 500 server error A small JSON object with an error/exception message would seem much more logical to me... ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] url and uri
Check this recent thread for more info on this: http://www.nabble.com/method-plugin-for-getting-query-string-vars--tf2481232.html#a6939213 ___ SEAN O code enquest wrote: Can somebody explain me how to read url's uri whit jquery... I want to change thing when ?id=1 etc with jquery. Enquest ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/url-and-uri-tf2500859.html#a6973507 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery and OOP
Do you really need an object at all? This (pun intended) would do the same thing as all the code you listed: $(function() { var $btn = $('#btnCounter'), nr = 0; $btn.click( function() { $btn.attr( 'value', nr++ ); }); }); -Mike From: Kolman Nándor I am new to jQuery, and I have a question concerning object oriented programming. I have created a sample scenario. In the HTML code I add a button: input type=button value=Count id=btnCounter / In js, I create a class called Counter. In the constructor I add an event handler to the click event of the button. The function I specify as the handler is a method of the Counter class. I also store the button and the nr (the current value of the counter) as an object property. function Counter() { $('#btnCounter').click(this.count); this.button = $('#btnCounter'); this.nr = 0; } In the count method I set the incremented value of the counter to the text of the button. Counter.prototype = { count: function() { this.button.attr('value', this.nr++); } } And I need to create the object in the load event: $(window).load(function() { new Counter(); }); If I try to run the code I get: 'this.button has no properties'. I know that the 'this' in the count method will be the target of the event (the button). But that is not what I need, it is the reference of the Counter object. If I rewrite the constructor I can make it work: function Counter() { var oThis = this; $('#btnCounter').click( function() { oThis.count(); } ); this.button = $('#btnCounter'); this.nr = 0; } But this is quite ugly :(. Is there a nicer way to achieve this? ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery and OOP
Nice question, Kolman. AFAIK, and I would love to hear different, is that this (ha ha) is the proper way to do it in Ecmascript languages. In fact, in 'neater' OOP languages like Java the same problem would occur if you had two parallel sets of objects, as we have here with the DOM and user-constructed objects; each instance needs to somehow reference its partner instance. It seems to be a limitation of OOP that there is no 'natural' way to do this. Chris On 10/24/06, Kolman Nándor [EMAIL PROTECTED] wrote: Hi, I am new to jQuery, and I have a question concerning object oriented programming. I have created a sample scenario. In the HTML code I add a button: input type=button value=Count id=btnCounter / In js, I create a class called Counter. In the constructor I add an event handler to the click event of the button. The function I specify as the handler is a method of the Counter class. I also store the button and the nr (the current value of the counter) as an object property. function Counter() { $('#btnCounter').click(this.count); this.button = $('#btnCounter'); this.nr = 0; } In the count method I set the incremented value of the counter to the text of the button. Counter.prototype = { count: function() { this.button.attr('value', this.nr++); } } And I need to create the object in the load event: $(window).load(function() { new Counter(); }); If I try to run the code I get: 'this.button has no properties'. I know that the 'this' in the count method will be the target of the event (the button). But that is not what I need, it is the reference of the Counter object. If I rewrite the constructor I can make it work: function Counter() { var oThis = this; $('#btnCounter').click( function() { oThis.count(); } ); this.button = $('#btnCounter'); this.nr = 0; } But this is quite ugly :(. Is there a nicer way to achieve this? Thx ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Window Dialogues
Looks horrid in IE7 while the fake window is being built. On 10/24/06, Ⓙⓐⓚⓔ [EMAIL PROTECTED] wrote: Wow that is pretty! But so big and unpleasantly written! I look forward to a jq version! On 10/23/06, Yehuda Katz [EMAIL PROTECTED] wrote: Anyone know of any good movable, expandable and minimzable window dialogs (like http://prototype-window.xilinus.com/index.html for Prototype) -- Yehuda Katz Web Developer | Wycats Designs (ph) 718.877.1325 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery and OOP
That is really nice and handy you wrote :), but I am writing a complex ajax application. I just created a simple scenario to show what I want. So yes, I really need it. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Geary Sent: Tuesday, October 24, 2006 4:23 PM To: 'jQuery Discussion.' Subject: Re: [jQuery] jQuery and OOP Do you really need an object at all? This (pun intended) would do the same thing as all the code you listed: $(function() { var $btn = $('#btnCounter'), nr = 0; $btn.click( function() { $btn.attr( 'value', nr++ ); }); }); -Mike From: Kolman Nándor I am new to jQuery, and I have a question concerning object oriented programming. I have created a sample scenario. In the HTML code I add a button: input type=button value=Count id=btnCounter / In js, I create a class called Counter. In the constructor I add an event handler to the click event of the button. The function I specify as the handler is a method of the Counter class. I also store the button and the nr (the current value of the counter) as an object property. function Counter() { $('#btnCounter').click(this.count); this.button = $('#btnCounter'); this.nr = 0; } In the count method I set the incremented value of the counter to the text of the button. Counter.prototype = { count: function() { this.button.attr('value', this.nr++); } } And I need to create the object in the load event: $(window).load(function() { new Counter(); }); If I try to run the code I get: 'this.button has no properties'. I know that the 'this' in the count method will be the target of the event (the button). But that is not what I need, it is the reference of the Counter object. If I rewrite the constructor I can make it work: function Counter() { var oThis = this; $('#btnCounter').click( function() { oThis.count(); } ); this.button = $('#btnCounter'); this.nr = 0; } But this is quite ugly :(. Is there a nicer way to achieve this? ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery and OOP
It is somewhat ugly but it is JavaScript. Perhaps it would be helpful if jQuery had a method like Prototype's bind or Dojo's hitch. Is there a reason why jQuery doesn't have something similar? -- Brandon Aaron On 10/24/06, Kolman Nándor [EMAIL PROTECTED] wrote: Hi, I am new to jQuery, and I have a question concerning object oriented programming. I have created a sample scenario. In the HTML code I add a button: input type=button value=Count id=btnCounter / In js, I create a class called Counter. In the constructor I add an event handler to the click event of the button. The function I specify as the handler is a method of the Counter class. I also store the button and the nr (the current value of the counter) as an object property. function Counter() { $('#btnCounter').click(this.count); this.button = $('#btnCounter'); this.nr = 0; } In the count method I set the incremented value of the counter to the text of the button. Counter.prototype = { count: function() { this.button.attr('value', this.nr++); } } And I need to create the object in the load event: $(window).load(function() { new Counter(); }); If I try to run the code I get: 'this.button has no properties'. I know that the 'this' in the count method will be the target of the event (the button). But that is not what I need, it is the reference of the Counter object. If I rewrite the constructor I can make it work: function Counter() { var oThis = this; $('#btnCounter').click( function() { oThis.count(); } ); this.button = $('#btnCounter'); this.nr = 0; } But this is quite ugly :(. Is there a nicer way to achieve this? Thx ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jEditable question
2006/10/24, Barry Nauta [EMAIL PROTECTED]: On Tuesday 24 October 2006 15:58, Mika Tuupola wrote: On Oct 24, 2006, at 14:43, Robert Wagner wrote: how about that: if an error occours, let the server send a 500 header and the error message as a content. header(HTTP/1.1 500 Internal Server Error); print(this cannot be done.); Agreed. I find error headers to be more elegant and universal solution than sending ERROR string in a reply. Will implement this soon(ish). Just my $0.02: I find this odd. Imagine that you want some processing to be done based on the input (i.e. server side email address checking) (We all agree that any validation also needs to be performed at the serverside, right?). that was my attempt too at first. error checking = application logic = write my own structures etc. but then think about error handling as a very basic thing that is already implementet in webserver, ajax functions etc. why not using this infrastructure? it's straightforward, ready to use... -robert ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jEditable question
that was my attempt too at first. error checking = application logic = write my own structures etc. but then think about error handling as a very basic thing that is already implementet in webserver, ajax functions etc. why not using this infrastructure? it's straightforward, ready to use... I certainly do not think about error handling as a very basic thing, I think it is heavily underestimated. The problem for me is that treating simple business logic as server errors might be straightforward, but imHo, it is not clean. Using JSON structures is still using the full capabilities of AJAX, I just wouldn't use webservers way of telling that it has encountered un unrecoverable error while all there is is a small check that fails. This is a non-portable, non-reusable solution (talking about the email checking funtionality, used as example), but I guess for smaller things it will do. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jEditable question
On Oct 24, 2006, at 17:54, Robert Wagner wrote: Just my $0.02: I find this odd. Imagine that you want some processing to be done based on the input (i.e. server side email address checking) (We all that was my attempt too at first. error checking = application logic = write my own structures etc. I always try to write reusable code and not force users to one specific implementation (for example hardcoding effects into jEditable). I also like to keep things simple. Checking for HTTP response codes is universal approach. I do however see cases when it is not the best solution and another approach such as JSON object is more suitable. I see two possible solutions here. 1) Add an configuration option what kind of response jEditable expects. This requires less coding from end user. Bad thing is it adds bloat to jEditable since all different response types need their own handlers inside plugin code. 2) Add user defined callback (and/or callbefore) handlers. Requires more coding from the end user but everyone can write their own implementation for their own needs. Those who don't need special implementations can still use the easy defaults. Any other suggestions? -- Mika Tuupola http://www.appelsiini.net/~tuupola/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery and OOP
Mike's approach can be expanded to a complex ajax application. Closures and element properties are natural ways to associate instance data with elements in jQuery. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kolman Nándor Sent: Tuesday, October 24, 2006 10:49 AM To: jQuery Discussion. Subject: Re: [jQuery] jQuery and OOP That is really nice and handy you wrote :), but I am writing a complex ajax application. I just created a simple scenario to show what I want. So yes, I really need it. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Geary Sent: Tuesday, October 24, 2006 4:23 PM To: 'jQuery Discussion.' Subject: Re: [jQuery] jQuery and OOP Do you really need an object at all? This (pun intended) would do the same thing as all the code you listed: $(function() { var $btn = $('#btnCounter'), nr = 0; $btn.click( function() { $btn.attr( 'value', nr++ ); }); }); -Mike From: Kolman Nándor I am new to jQuery, and I have a question concerning object oriented programming. I have created a sample scenario. In the HTML code I add a button: input type=button value=Count id=btnCounter / In js, I create a class called Counter. In the constructor I add an event handler to the click event of the button. The function I specify as the handler is a method of the Counter class. I also store the button and the nr (the current value of the counter) as an object property. function Counter() { $('#btnCounter').click(this.count); this.button = $('#btnCounter'); this.nr = 0; } In the count method I set the incremented value of the counter to the text of the button. Counter.prototype = { count: function() { this.button.attr('value', this.nr++); } } And I need to create the object in the load event: $(window).load(function() { new Counter(); }); If I try to run the code I get: 'this.button has no properties'. I know that the 'this' in the count method will be the target of the event (the button). But that is not what I need, it is the reference of the Counter object. If I rewrite the constructor I can make it work: function Counter() { var oThis = this; $('#btnCounter').click( function() { oThis.count(); } ); this.button = $('#btnCounter'); this.nr = 0; } But this is quite ugly :(. Is there a nicer way to achieve this? ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Updating multiple select fields at once
I've got a page which allows a user to set profiles for hours of the day. There are a LOT of dropdowns on this page and I've had some users which say they want to set all the dropdowns to a specific value. Setting them all manually would take a few minutes of time. So the users want to know if they can set all to a certain value at one time. I'm already using jQuery on this site for various things. I'm wondering if I can add one more dropdown which might read Set all values to: [select box] [go]. The only select boxes on this page are in the app so I suppose I could get all select boxes and set the option to the value of the All dropdown. I'm going to try to do it myself, but does anyone have an idea how to accomplish this? !//-- andy matthews web developer certified advanced coldfusion programmer ICGLink, Inc. [EMAIL PROTECTED] 615.370.1530 x737 --//- ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Window Dialogues
One that's already done in a way. Uses the pre-existing thickbox though. http://bryanbuchs.com/tb_dialog/ wycats wrote: Anyone know of any good movable, expandable and minimzable window dialogs (like http://prototype-window.xilinus.com/index.html for Prototype) -- Yehuda Katz Web Developer | Wycats Designs (ph) 718.877.1325 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/Window-Dialogues-tf2499177.html#a6976612 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Updating multiple select fields at once
How about something like this? jQuery.fn.selectOption = function(v) { return jQuery.each(function(){ for ( var i=0; i this.options.length; i++ ) if ( this.options[i].value == v ) { this.selectedIndex = i; return; } }; }; $(#GlobalSelectGoButton).click(function(){ $(select). not(#GlobalSelect). selectOption($(#GlobalSelect).value()); }; I don't know what it would do with a multiple-select. If there isn't a matching value you might want to think about what it should do there; I just leave the current selection alone. Also, I _think_ that the currently selected option's value should be available through .value() but haven't tried it. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andy Matthews Sent: Tuesday, October 24, 2006 12:29 PM To: [jQuery] Subject: [jQuery] Updating multiple select fields at once I've got a page which allows a user to set profiles for hours of the day. There are a LOT of dropdowns on this page and I've had some users which say they want to set all the dropdowns to a specific value. Setting them all manually would take a few minutes of time. So the users want to know if they can set all to a certain value at one time. I'm already using jQuery on this site for various things. I'm wondering if I can add one more dropdown which might read Set all values to: [select box] [go]. The only select boxes on this page are in the app so I suppose I could get all select boxes and set the option to the value of the All dropdown. I'm going to try to do it myself, but does anyone have an idea how to accomplish this? !//-- andy matthews web developer certified advanced coldfusion programmer ICGLink, Inc. [EMAIL PROTECTED] 615.370.1530 x737 --//- ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Window Dialogues
Probably not what Yehuda is looking for. My Dialog is essentially a replacement for window.confirm() calls. Dan Atkinson wrote: One that's already done in a way. Uses the pre-existing thickbox though. http://bryanbuchs.com/tb_dialog/ wycats wrote: Anyone know of any good movable, expandable and minimzable window dialogs (like http://prototype-window.xilinus.com/index.html for Prototype) -- Yehuda Katz Web Developer | Wycats Designs (ph) 718.877.1325 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/Window-Dialogues-tf2499177.html#a6976914 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Drop Down Menu
Hello there: Is there a reliable Drop-Down menu plug-in for JQuery? I've created a quick example here: *http://tinyurl.com/y4qsx5* So far, I cannot figure out how to postpone the SlideUp effect when the mouse goes over the drop down menu itself. Please help, thank you. Roso * * ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] A question about ajaxStart and Stop
by execute I meant execute the bind, not execute the function that was bound You got it right. Perhaps you need to put it up on the web with a link... this extremely simple one works for me: $(html) .ajaxStart(function(){ $(this).background(blue);}) .ajaxStop(function(){ $(this).background(transparent);}); On 10/24/06, Mats Lindblad [EMAIL PROTECTED] wrote: You mean, initilized? Not executed ... right? Does not work for me. On 10/24/06, Ⓙⓐⓚⓔ [EMAIL PROTECTED] wrote: anywhere, it just has to be executed before the ajax call! Start simple, make sure your jq works in other contexts. On 10/23/06, Mats Lindblad [EMAIL PROTECTED] wrote: But where do I initilize it? In $(document).ready() ? or can I do it anywhere? I've tried all of the above and it just wont work. On 10/22/06, Ⓙⓐⓚⓔ [EMAIL PROTECTED] wrote: it's great, and easy, and you don't often need it. they are not for creating ajax requests or for dealing with responses! it's just a magical hook that can show that an ajax call has started or that all the ajax calls are done. most people seem to just do a little css to show that an ajax request is going on. Then remove the little effect when it is done. my first ajaxstart and stop just changed the background color a bit. On 10/22/06, Mats Lindblad [EMAIL PROTECTED] wrote: I have tried to get it to work and I am not sure that I am using it right so if anyone could explain to me how I am supposed to use it? Where do I initilize it, what do I attach it to? It just will not work for me. I am using jQuery 1.0.2 Rev: 413 -- If there's anything more important than my ego around, I want it caught and shot now. -- Zaphod ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- If there's anything more important than my ego around, I want it caught and shot now. -- Zaphod ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- If there's anything more important than my ego around, I want it caught and shot now. -- Zaphod ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Updating multiple select fields at once
I got this taken care of. jQuery makes it SOOO easy. function changeAll() { var theValue = $('#setallvalues').val(); $('select').val(theValue); } !//-- andy matthews web developer certified advanced coldfusion programmer ICGLink, Inc. [EMAIL PROTECTED] 615.370.1530 x737 --//- -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Andy Matthews Sent: Tuesday, October 24, 2006 11:29 AM To: [jQuery] Subject: [jQuery] Updating multiple select fields at once I've got a page which allows a user to set profiles for hours of the day. There are a LOT of dropdowns on this page and I've had some users which say they want to set all the dropdowns to a specific value. Setting them all manually would take a few minutes of time. So the users want to know if they can set all to a certain value at one time. I'm already using jQuery on this site for various things. I'm wondering if I can add one more dropdown which might read Set all values to: [select box] [go]. The only select boxes on this page are in the app so I suppose I could get all select boxes and set the option to the value of the All dropdown. I'm going to try to do it myself, but does anyone have an idea how to accomplish this? !//-- andy matthews web developer certified advanced coldfusion programmer ICGLink, Inc. [EMAIL PROTECTED] 615.370.1530 x737 --//- ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jEditable question
Mika In order to keep the code as reusable as possible, i'd just go for the custom callback method, and leave the way of handling the response to the user. That way, i (and perhaps others) will be able to implement quick and dirty error handling, and others can go with JSON or anything else. That way, the jEditable code stays as clean as possible, without too much extra's. Leave writing custom handlers to the ones using them ;) Cheers, Miel Just my $0.02: I find this odd. Imagine that you want some processing to be done based on the input (i.e. server side email address checking) (We all that was my attempt too at first. error checking = application logic = write my own structures etc. I always try to write reusable code and not force users to one specific implementation (for example hardcoding effects into jEditable). I also like to keep things simple. Checking for HTTP response codes is universal approach. I do however see cases when it is not the best solution and another approach such as JSON object is more suitable. I see two possible solutions here. 1) Add an configuration option what kind of response jEditable expects. This requires less coding from end user. Bad thing is it adds bloat to jEditable since all different response types need their own handlers inside plugin code. 2) Add user defined callback (and/or callbefore) handlers. Requires more coding from the end user but everyone can write their own implementation for their own needs. Those who don't need special implementations can still use the easy defaults. Any other suggestions? -- Mika Tuupola http://www.appelsiini.net/~tuupola/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ winmail.dat___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jEditable question
2006/10/24, Mika Tuupola [EMAIL PROTECTED]: On Oct 24, 2006, at 17:54, Robert Wagner wrote: Just my $0.02: I find this odd. Imagine that you want some processing to be done based on the input (i.e. server side email address checking) (We all that was my attempt too at first. error checking = application logic = write my own structures etc. I always try to write reusable code and not force users to one specific implementation (for example hardcoding effects into jEditable). I also like to keep things simple. Checking for HTTP response codes is universal approach. I do however see cases when it is not the best solution and another approach such as JSON object is more suitable. I see two possible solutions here. 1) Add an configuration option what kind of response jEditable expects. This requires less coding from end user. Bad thing is it adds bloat to jEditable since all different response types need their own handlers inside plugin code. 2) Add user defined callback (and/or callbefore) handlers. Requires more coding from the end user but everyone can write their own implementation for their own needs. Those who don't need special implementations can still use the easy defaults. i think the 2nd one is best. every one with special needs should be able to implement it by overriding the default ajax options. that said, these options must be handed over... like here :) http://wiki.script.aculo.us/scriptaculous/show/Ajax.InPlaceEditor where options are merged with ajaxOptions and important ones (onComplete ..) are even direct setable. -robert Any other suggestions? -- Mika Tuupola http://www.appelsiini.net/~tuupola/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Why doesnt this work ?
Not quite sure (total javascript noob here :) ), but i think the contains method is meant to be fired on an element, not on an attribute value (and any String for that matter) Guru's, correct me if i'm wrong ;) Something like this should work: (not tested btw) var arrowSrc = $(arrow).src(); if(arrowSrc.indexOf(right) == -1 ) //do this else //do that -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] namens stargate Verzonden: di 24-10-2006 21:01 Aan: jQuery Discussion. Onderwerp: [jQuery] Why doesnt this work ? Hello jQuery guru's :) could someone tell me why this code doesnt work ? -CODE var arrow = $(#draghandle).find(img); if($(arrow).src().contains(right) != ){ $(arrow).src(Modules/User_Manager/images/arrow_down.gif); } else { $(arrow).src(Modules/User_Manager/images/arrow_right.gif); } -CODE Error-Message: $(arrow).src().contains is not a function Thx and sorry for my stupidy :) Ralf ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ winmail.dat___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Drop Down Menu
There ya go, thanks a lot Kevin. Will have to use that solution instead. I would like to know how to access and manipulate core internal methods and variables. More documentation on that would be extremely welcomed. Thanks again, Roso [EMAIL PROTECTED] wrote: The problem is that the user mouses out of the primary nav item (Help, Options) before acquiring the list items under it. You might consider treating the top level as an unordered list as well, with nested unordered lists serving as the drop downs. This way, the user's pointer is in essence still over the top-level item while perusing the drop down lists. For example: http://beta.ksscholl.com/jquery/suckerfish.html You would obviously need to style the items as necessary for your application. Kevin -- Original message -- From: [EMAIL PROTECTED] [EMAIL PROTECTED] Pause plug-in doesn't seem to do the job here. http://tinyurl.com/y4qsx5 Anybody has an idea of how to build a reliable (memory-leak free, cross-browser) plug-in? Thanks. Roso ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Why doesnt this work ?
well for a noob this was a great guess and hitting solution ;) Thx a lot Miel! Not quite sure (total javascript noob here :) ), but i think the contains method is meant to be fired on an element, not on an attribute value (and any String for that matter) Guru's, correct me if i'm wrong ;) Something like this should work: (not tested btw) var arrowSrc = $(arrow).src(); if(arrowSrc.indexOf(right) == -1 ) //do this else //do that -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] namens stargate Verzonden: di 24-10-2006 21:01 Aan: jQuery Discussion. Onderwerp: [jQuery] Why doesnt this work ? Hello jQuery guru's :) could someone tell me why this code doesnt work ? -CODE var arrow = $(#draghandle).find(img); if($(arrow).src().contains(right) != ){ $(arrow).src(Modules/User_Manager/images/arrow_down.gif); } else { $(arrow).src(Modules/User_Manager/images/arrow_right.gif); } -CODE Error-Message: $(arrow).src().contains is not a function Thx and sorry for my stupidy :) Ralf ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] accordian with text fade out
Hey all, Got the accordion script from another site (cant remember where exactly) and modified it to fit my needs, But now I need to have the text fade in once a tab is opened and fade out then close when an other tab is clicked. Here is the link with out the fadeIn/fadeout: http://ierev.informationexperts.com/ Ive made this change which more or less works (need to set the content to not visible to start) for opening a tab: code $(d).children(contents).slideDown(showSpeed, function(){--running, $(this).children(maincontents).fadeIn(500);}); /code I figured Id do something like below to close tab, but is not working as expected: code $(active).children(maincontents).fadeOut(250, function(){$(items).children(contents).not(':hidden').slideUp(250, function(){--running;});}); /code Any suggestion would be great. Thanks, Benjamin Sterling KenzoMedia.com ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] S.L.O.W.
Could you post a link? -- Brandon Aaron On 10/24/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Does anybody know why it takes at least 2 seconds for a page with jQuery to load in IE? That is not the same in Firefox where it seems to work much faster. To make it clear, IE is slow when you click from one page to another within the same Web site when the page and all javascripts, css, images are already cached, not at the first page load or a page refresh where you can expect a little bit of delay. Is there any way to timestamp jQuery? Thanks. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Tabs plugin: custom structure
Hi all, from the beginning the plugin was relying on a certain HTML structure div id=container ul ... ul div id=tab-1 ... /div ... /div For some more flexibility and being able to apply somewhat advanced styling I have added another option: tabSelector Default is as-is state: 'div' (start point is the container that holds the tabs links and content). But if you want a structure that is more deeply nested you can initialize your tabs like that: $('#container').tabs({ tabSelector: 'divdiv' }); and have a structure like this: div id=container ul ... ul div div id=tab-1 ... /div ... div /div Used together with fade and autoheight for example such a structure allows for fading the tabs content and still have a border around it that won't fade - if I remember correctly, Jörn once or twice asked for something like this (hi Jörn!). Have a look at the last example here: http://stilbuero.de/jquery/tabs/ Hence you could use an ordered list or whatever for your tabs: div id=container ul ... ul ol li id=tab-1 ... /li ... ol /div $('#container').tabs({ tabSelector: 'olli' }); Be careful when you want to use another unordered list ;-) $('#container').tabs({ tabSelector: 'ul:eq(1)li' }); Not sure if this is the way to go, but it was the only possibility without breaking all the usages out there. But this gives the most flexibility I think. Also not sure if name for the option is well chosen? Suggestions welcome... Now on to the documentation... Cheers, Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Tabs plugin: custom structure
Hence you could use an ordered list or whatever for your tabs PS: Make it something useful ;-) -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Tabs plugin: custom structure
So using an unordered list for the tabs , we could paint the tabs using the sliding doors technique...good idea KlausOn 24/10/06, Klaus Hartl [EMAIL PROTECTED] wrote: Hence you could use an ordered list or whatever for your tabsPS: Make it something useful ;-)-- Klaus___jQuery mailing list discuss@jquery.comhttp://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] triggering an event
I was wondering having done: $(.foo).click(function (e) {alert (foo);}); Can I force the click event to fire manually, or do I resort to var x = function (e) {alert (foo);} $(#foo).click(x); ele = $(#foo).get(0) x.call( ele, {target:ele}); Adam ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] triggering an event
Adam van den Hoven wrote: Can I force the click event to fire manually, or do I resort to I think you can do this with the apply call, although i am unsure how ;) P.s. nice surname ;) ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] triggering an event
Adam van den Hoven schrieb: I was wondering having done: $(.foo).click(function (e) {alert (foo);}); Can I force the click event to fire manually, or do I resort to var x = function (e) {alert (foo);} $(#foo).click(x); ele = $(#foo).get(0) x.call( ele, {target:ele}); Hi Adam, fire an event manually like that: $(.foo).click(); -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] triggering an event
I was wondering having done: $(.foo).click(function (e) {alert (foo);}); Can I force the click event to fire manually, or do I resort to var x = function (e) {alert (foo);} $(#foo).click(x); ele = $(#foo).get(0) x.call( ele, {target:ele}); You can use either of these (they do the same thing): $(#foo).click(); $(#foo).trigger(click); -Mike ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] triggering an event
Can I force the click event to fire manually? To trigger an event you can use...wait for it...trigger(). :-) $(foo).trigger(click); Or you can call click with no arguments: $(foo).click(); As with a real click, the this will be pointing to the element. I'm not sure about the details of the first (event) argument in these cases. However, you can tell a real click from a fake click by passing trigger some arguments: $(foo).trigger(click, [other, stuff, here]); $(.foo).click(function (e, p1, p2) { if ( p2 == stuff ) alert(I was triggered, not clicked.); else alert(Finally, an honest click.); }); So is this some sort of van den Hoven family reunion around here? :-) ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Blurry Text using JQuery... But only in IE - WORKAROUND
My problem is that the text in the JTicker plugin is coming in blurry. Yeah it is a bug in IE but you can workaround it by explicitly setting the background color of the blurry elements (to any color other than transparent) George -- View this message in context: http://www.nabble.com/Blurry-Text-using-JQuery...-But-only-in-IE-tf2503213.html#a6981095 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] jQuery Talk at Ajaxian
John's talk at the jQuery conference was excellent, and a good package of arguments for the serious jQuery evangelist. I'm not sure whether the slides are available online, but I'd take a look at them when they become available. -- Yehuda KatzWeb Developer | Wycats Designs(ph)718.877.1325 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Short question on how to pass parameters from html to javascript functions
Truppe Steven schrieb: Hello, i have some javascript that i execute inside a $(document).ready to init stuff need to be done if javascript is available. now i want to pass parameters somehow. My first thought was just to use an standart attribute like a href=.. class=isearchforthis lang=myparams. But this seems to be no good solution because i want my documents do be valid xhtml strict ... So my new approach is to use a pseudo class to like a href=.. class=doStuff mode1 for example. So the mode1 class is just a pseudo class that i used to determine which mode to use. The code look like this: /$(window).load(function() { $(.doStuff).each(function(){ var cl = $(this).attr('class'); if(cl.test('paramMode1')) { }else if(cl.test('paramMode2')) { }else { // default mode } }); }); /If i want to specifie more than just a mode parameter are there any other ways to pass parameters to my function that does not break xhtml validation ?/ /best regards, Truppe Steven Hi Truppe, first of all, I wouldn't even call it a pseudo class, because the class attribute is not only intended for styling purposes: The class attribute has several roles in HTML: * As a style sheet selector (when an author wishes to assign style information to a set of elements). * For general purpose processing by user agents. http://www.w3.org/TR/html401/struct/global.html#h-7.5.2 So you may feel comfortable with the solution you took. Now to your question: What about sticking to the one additional class and using a hash map to gather other parameters from that with the class as key...: { mode1: [param1, param2, param3], mode2: [param1, param2, param3] } Something like this. Of course there is an overhead of creating and maintaining this hash map and including it in the page but you could even load it via XHR as JSON... -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] .appendTemplated plugin (my first!)
In my perfect world, all data I get from a server will be JSON, and I can format it how I please. Doing that with jQuery is somewhat verbose at the moment, leaving me with awesome code like this: var headlines = $(Journals.HeadlinesContainer); for(i in json){ var li = $.LI({ Class: json[i].ContainerFileName }); var a = $.A().href(json[i].Url); headlines.append(li.append(a.append($.TEXT(json[i].Title; } The Yahoo UI extensions (Jack Slocum rocks) have a neat Template class that makes this a little easier, so I went ahead and jQueryfied it. My function now looks like: $(Journals.HeadlinesContainer).appendTemplated( 'li class=#{ContainerFileName}a href=#{Url}#{Title}/a/li', json ); Which is way nicer, IMO. :) Have a look at the demo here: http://mubble.net/jquery/jquery.template.html The template plugin itself is here: http://mubble.net/jquery/jquery.template.js For large results sets, you can pass a { 'compiled' : true } to the appendTemplated function, which turns the template into a javascript function rather than running a regex on every iteration. -Kurt ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery and OOP
A technique you might find slightly less ugly is passing 'this' as an argument when you bind the event. If I recall correctly, jQuery has the ability to pass an arbitrary number of additional arguments as an additional argument array to the event bind function. function Counter() { $('#btnCounter').click(this.count,[this]); this.button = $('#btnCounter'); this.nr = 0; } In the count method I set the incremented value of the counter to the text of the button. Counter.prototype = { count: function(e,self) { self.button.attr('value', self.nr++); } } -- blair Kolman Nándor wrote: Hi, I am new to jQuery, and I have a question concerning object oriented programming. I have created a sample scenario. In the HTML code I add a button: input type=button value=Count id=btnCounter / In js, I create a class called Counter. In the constructor I add an event handler to the click event of the button. The function I specify as the handler is a method of the Counter class. I also store the button and the nr (the current value of the counter) as an object property. function Counter() { $('#btnCounter').click(this.count); this.button = $('#btnCounter'); this.nr = 0; } In the count method I set the incremented value of the counter to the text of the button. Counter.prototype = { count: function() { this.button.attr('value', this.nr++); } } And I need to create the object in the load event: $(window).load(function() { new Counter(); }); If I try to run the code I get: 'this.button has no properties'. I know that the 'this' in the count method will be the target of the event (the button). But that is not what I need, it is the reference of the Counter object. If I rewrite the constructor I can make it work: function Counter() { var oThis = this; $('#btnCounter').click( function() { oThis.count(); } ); this.button = $('#btnCounter'); this.nr = 0; } But this is quite ugly :(. Is there a nicer way to achieve this? Thx ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jEditable question
1) Add an configuration option what kind of response jEditable expects. This requires less coding from end user. Bad thing is it adds bloat to jEditable since all different response types need their own handlers inside plugin code. Yep, this doesn't sound right to me... Sometimes you just have to make choices for the user, this sounds like a compromise which is in noones advantadge 2) Add user defined callback (and/or callbefore) handlers. Requires more coding from the end user but everyone can write their own implementation for their own needs. Those who don't need special implementations can still use the easy defaults. This would be great. I personally think that the little bit of extra coding largely makes up for the flexibility and reusability that this approach offers. Barry ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Function from jquery_auto
Hello, i find this fine Plugin: http://sputnik.pl/code/javascript/jquery_auto can i use the Auto-submitting SELECTs Function solo? not in the Plugin, i write this, works no: $(document).ready(function() { $('SELECT.Submit').bind('change', this.on_change); function change() { if (this.value) this.form.submit(); } }); -- Viele Grüße, Olaf --- [EMAIL PROTECTED] http://olaf-bosch.de www.akitafreund.de --- ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Drop Down Menu
look at http://be.twixt.us/jquery/suckerFish.php olivvv [EMAIL PROTECTED] wrote: Hello there: Is there a reliable Drop-Down menu plug-in for JQuery? I've created a quick example here: *http://tinyurl.com/y4qsx5* So far, I cannot figure out how to postpone the SlideUp effect when the mouse goes over the drop down menu itself. Please help, thank you. Roso * * ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Drop Down Menu
it works except when the item is clicked on, the menu does not retract (un-pop) I had the same problem with my css menu, until I added the snippet: $(.menu ul).click(function(){$(.menu).hide().animate({ height: 'show'}, 100)}); to snap the menu away from the cursor, thus making it no longer hovering. On 10/24/06, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: look at http://be.twixt.us/jquery/suckerFish.php olivvv [EMAIL PROTECTED] wrote: Hello there: Is there a reliable Drop-Down menu plug-in for JQuery? I've created a quick example here: *http://tinyurl.com/y4qsx5* So far, I cannot figure out how to postpone the SlideUp effect when the mouse goes over the drop down menu itself. Please help, thank you. Roso * * ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/