[jQuery] Re: Creating DOM elements on the fly
It's already built in. For your example: var inputBox = $('input').attr(type, text).attr(id, someText); Or even: var inputBox = $('input type=text id=someText'); Karl Rudd On 8/17/07, Anurag [EMAIL PROTECTED] wrote: Hi, I am a jQuery beginner. I am working on an application for which I need to create DOM elements on the fly. Previously I was using document.createElement() and document.createTextNode() but that's not concise and looks odd along with jQuery code. So I wrote a tiny 3 line plugin jquery.new.js. It's more of a hit and trial outcome. jQuery.new = function(element) { return $(document.createElement(element)); } I wrapped the new element that was created with the jQuery object so I can chain functions. For example: var inputBox = $.new(input).attr(type, text).attr(id, someText); Is there a better way to do this? Or does jQuery already have this functionality inbuilt?
[jQuery] pngfix and css background images problem
Hi all, check the background of this page on FF and in IE: http://www.ortelli.net/temp/woo/ The footer background works well in IE: it's a background image, not repeated. For the header and the main content the background is vertically repeated and the transparency/background is not applied... Very strange behaviour... any idea? You can download the full package here: http://www.ortelli.net/temp/woo/woo.zip Thanks in advance :P
[jQuery] Re: Creating DOM elements on the fly
The jQuery function $() can parse HTML, as can the various DOM functions (append, prepend, appendTo, etc): $('input id=foo type=text/').appendTo('#myForm'); --Erik On 8/16/07, Anurag [EMAIL PROTECTED] wrote: Hi, I am a jQuery beginner. I am working on an application for which I need to create DOM elements on the fly. Previously I was using document.createElement() and document.createTextNode() but that's not concise and looks odd along with jQuery code. So I wrote a tiny 3 line plugin jquery.new.js. It's more of a hit and trial outcome. jQuery.new = function(element) { return $(document.createElement(element)); } I wrapped the new element that was created with the jQuery object so I can chain functions. For example: var inputBox = $.new(input).attr(type, text).attr(id, someText); Is there a better way to do this? Or does jQuery already have this functionality inbuilt?
[jQuery] |OT| Re: Documentation on $('#foo')[0] or $('#foo').get(0) ??
On Aug 16, 11:57 pm, Michael Geary [EMAIL PROTECTED] wrote: $('#foo')[0] Will throw error if there is no match, IIRC. No, it won't. It is not an error to fetch a nonexistent array element Thanks for a nice explanation. I'm sorry for jumping without reading it properly. Glad to help - but no apology needed! You should see some of the bloopers I've posted myself... :-) Thanks for a new word blooper (learning English in jQuery list:-)) -- ?php echo 'Just another PHP saint'; ? Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/
[jQuery] Re: stupid dev tricks: marking current page links
On Aug 16, 7:16 pm, Stephan Beal [EMAIL PROTECTED] wrote: We've all attempted several different ways of highlighting navigation links which point to the current page. Often times we mark the page via our PHP by adding a class (e.g. currentPage) to the navigation link which points to the current page, or some such. Here's a slightly different approach... snip FWIW, we have been using http://www.sitepoint.com/print/css- anthology-tips-tricks-4 Figure 4.20 technique for a longtime and then switched back to currentPage class technique for it's simplicity. -- ?php echo 'Just another PHP saint'; ? Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/
[jQuery] Re: Creating DOM elements on the fly
On Aug 17, 2:10 am, Karl Rudd [EMAIL PROTECTED] wrote: It's already built in. For your example: var inputBox = $('input').attr(type, text).attr(id, someText); Karl, Question, I've still learning jQuery, so please forgive me as I am not 100% sure if I will poise the question correctly. When you do something like above, is the element already in DOM or just saved in a variable inputBox? ready to be added (i.e. appended) to DOM at some later point? For example, if that is the case, what is the next step to add it to DOM? Something like Erik showed? $(inputBox).appendTo('#myForm'); Thanks Karl. -- HLS
[jQuery] Re: Jquery cant manipulate inline TinyMCE. Why?
Mário, As I far as I remember this is because your element having the ID MyIdOnInlineDOM is duplicated when loading the inline page ant thus $j('#MyIdOnInlineDOM') fails to reach your element. HTH, Olive
[jQuery] Re: Dynamic Form Validation?
I suppose that you need a custom rule due to validation plugin don't support relations between fields. With jQuery.YAV (http://jquery.com/plugins/project/jquery_yav) I can do: input id=t1 name=t1 type=text class=equal alt={params:'some_value', require: 'pre-condition', condition: {name:'mycond', type:'implies', id:'t2', msg:'Please this field if required if you write a t1 value'}} / input id=t2 name=t2 type=text class=required alt={require:'post-condition',condition:{name:'mycond'}}/ And My JS code: $(#theform).yav(); Example (write some_value in the first field): http://projects.sevir.org/storage/yav/implies.html I like validation plugin but I want better more complexes rules of jQuery.YAV :-) howa escribió: Hello, anyone has idea how to do dynamic form validation? e.g. using http://bassistance.de/jquery-plugins/jquery-plugin-validation/ input name=t1 type=text / input name=t2 type=text / I only want to check for required field for t2 ONLY if t1 is equal to some value e.g. If t1 = test, then t2 cannot be null, else never mind abt t2 has any idea? -- Best Regards, José Francisco Rives Lirola sevir1ATgmail.com SeViR CW · Computer Design http://www.sevir.org Murcia - Spain
[jQuery] .reset() methods for forms
Hello there. As I mentioned in my comment at http://www.learningjquery.com/2007/08/clearing-form-data#comment-9943 I think it would be useful to have a reset method in the core, along the lines of: $.fn.extend({ reset: function() { return this.each(function() { $(this).is('form') this.reset(); } } }); For a small amount of extra code in the core, people could then reset their forms and carry on the chain ala. $('form').foo().reset().bar(). -- Best wishes, Dave Cardwell http://davecardwell.co.uk/javascript/jquery/
[jQuery] Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names
Stephan Beal escribió: On Aug 16, 7:39 pm, Mitch [EMAIL PROTECTED] wrote: An interesting point - don't recommend jQ IF the point of your work is teaching JavaScript. In my courses, I teach using Web Services with JavaScript, AJAX techniques, and others HTML Rich Application techniques so my target is not JavaScript learning because it is more difficult teach to a student ALL the differents *hacks* for any browsers (events attach, get XMLHttpRequest, ) so I teach jQuery. I teach the difficulties of cross-browsing, the problems, and then I show the more clean jQuery method. All the students keeps the mouth opened when they can see how anything is more easy :-) -- Best Regards, José Francisco Rives Lirola sevir1ATgmail.com SeViR CW · Computer Design http://www.sevir.org Murcia - Spain
[jQuery] Re: pngfix and css background images problem
As far as I know ALL png fixes out there utilize the AlphaImageLoader tag found only in IE. This also means that you can't use a background-repeat tag... a limitation of all png fixes I know of Note: you'll use a png fix, if you have images with alpha transparency. Try excluding the images in your main header from the png fix.. If the background image doesn't not have transparencies why not use a jpg or something Roberto Ortelli wrote: Very strange behaviour... any idea? -- View this message in context: http://www.nabble.com/pngfix-and-css-background-images-problem-tf4283879s15494.html#a12195384 Sent from the JQuery mailing list archive at Nabble.com.
[jQuery] Totally new to this...
Totally new to this and code ignorant but I did try to build a template webpage with the functions I want to have, so http://www.qbox.gr/test_asxeto/sitetest.html here it is... (I did use 2 different/irrelavent scripts but I think that I could add in terms of content and fx and lose on KBytes just by using one framework). Since these are my baby steps in jQuery I did gave it a http://www.qbox.gr/test_asxeto/jq_test/dragJq.html try but stumbled again in programming... Basicaly I would like to know if my first experiment is 100% achivable through jQuery and if so, if I can't manage to set it on my own - where/who can help me... (gone through the tutorial but I'm a give me an example sort of guy - then I build on what I know and ask for more :-D) -- View this message in context: http://www.nabble.com/Totally-new-to-this...-tf4282816s15494.html#a12191581 Sent from the JQuery mailing list archive at Nabble.com.
[jQuery] Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names
2007/8/16, Glen Lipka [EMAIL PROTECTED]: As a non-programmer, (HTML/CSS only) I understand lt() and gt() mainly because of lt; and gt;. I think those are very easy. The place I get confused a little is when you can say $(p:gt(4)) and $(p).gt(4) and get the same thing. Why both? I suppose the answer is because some people like it one way and some the other. I like this methods and I'm using them a lot. They are very handful when I must to do some operation on subset of elements: $(p:gt(4)).show().gt(10).css(color,red); Or, if you need to operate multiple time on same collection: var my_coll = $(p); my_coll.gt(3).css(color,red); my_coll.lt(3).css(color,blue); This stuff cannot be done by solely in selector expression. -- Dragan Krstić krdr http://krdr.ebloggy.com/
[jQuery] Re: pngfix and css background images problem
Hello, As far as I know ALL png fixes out there utilize the AlphaImageLoader tag found only in IE. This also means that you can't use a background-repeat Argh ok... thanks for your answer -- Roberto
[jQuery] Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names
$(p:gt(4)).show().gt(10).css(color,red); Or, if you need to operate multiple time on same collection: var my_coll = $(p); my_coll.gt(3).css(color,red); my_coll.lt(3).css(color,blue); This stuff cannot be done by solely in selector expression. I'm pretty sure this can be done with filter. In fact, a cursory test with firebug on jQuery.com suggests it can: $('p'); [p, p, p.surprise, p, p.download_link, p.download_link, p, p, p] $('p:gt(2)'); [p, p.download_link, p.download_link, p, p, p] $('p:gt(2)').gt(4); [p] $('p:gt(2)').filter(':gt(4)'); [p] I'm all in favor of removing gt/lt/eq in favor of the selector version with filter. --Erik
[jQuery] Re: Creating DOM elements on the fly
On Aug 17, 2:49 am, Karl Rudd [EMAIL PROTECTED] wrote: In the examples I gave the new element is saved to the variable inputBox. So to add it to the DOM you will do something like what Erik wrote, that is: inputBox.appendTo('#myForm'); The above appends it (that is, adds it as the last element) to an element with id=myForm. Got it! Seeing the syntax helps. Much appreciated! I ask because this idea hits home with a major consideration in my current plans for one particular area for using jQuery, which begged the question: Is the VARIABLE autonomous? Meaning, is this following valid? var inputBox = $('input').attr(type, text).attr(id, someText); . . inputBox.appendTo('#myForm'); inputBox.appendTo('#myForm'); inputBox.appendTo('#myForm'); In my testing, that doen't work. It only adds the first one. The only way I can get that to work is to instantiate new variables. Of course, good JS coding can modularize a function generator., however it somewhat defeats the intended purpose - Create Once - Use Many Times! A practical example where I was intended to use dynamic creation of DOM elements was for our questionnaire (WCQ) web form generation. The WCQ Editor allows for device independent creation of questionnaires from a single source definition WCQ file. For example: ; ACTIONNUMBER 1 ACTION DISPLAY PROMPT @[EMAIL PROTECTED] @USER.FIRSTNAME@ NEXT Default ; ACTIONNUMBER 2 ACTION QUESTION PROMPT Leave mail on the server when picking mail via POP3? TYPE YesNo DESTINATION POP3SNOOP ; ACTIONNUMBER 3 ACTION QUESTION PROMPT What are your contact email addresses (upto 5 allowed)? TYPE Text DESTINATION EMAILADDRESS(5) MAX 70 NEXT Default ; ACTIONNUMBER 4 ACTION END NEXT Default For Console users, a text based interactive question/answer dialog is created from the WCQ file. For Web users, the server creates JS and forms. My goal was to pull the JS creation from the server and move new generalized JS/jQuery code to the client. The feed would be a JSON structure feed in via .getJSON(WCQ_URL) So for ACTIONNUMBER #3, that has the multi-input destination: PROMPT What are your contact email addresses (upto 5 allowed)? DESTINATION EMAILADDRESS(5) which defines 5 fields, if I was going to do this with jQuery, you can then see what I am talking about. This would be wrong, right? function MakeEmailField(n) { var inputBox = $('input').attr(type, text).attr(id, email); for (i =0; i n; i++) { inputBox.appendTo('#myForm'); } } I would need to move the variable creation inside the loop. function MakeEmailField(n) { for (i =0; i n; i++) { var inputBox = $('input').attr(type, text).attr(id, email); inputBox.appendTo('#myForm'); } } Conceptually, it makes a big difference, probably has some significance with memory as well. :-) -- HLS
[jQuery] Re: Creating DOM elements on the fly
Meaning, is this following valid? var inputBox = $('input').attr(type, text).attr(id, someText); . . inputBox.appendTo('#myForm'); inputBox.appendTo('#myForm'); inputBox.appendTo('#myForm'); In my testing, that doen't work. It only adds the first one. A single node can't appear twice in the DOM. But you can easily clone a node. http://docs.jquery.com/DOM/Manipulation#clone.28_deep_.29 First, let's call your variable $inputBox instead of inputBox so I won't get confused. :-) (A common - and helpful - convention is to use a $ prefix on a variable containing a reference to a jQuery object, as a reminder that it's a jQuery object.) Then, do a deep clone of $inputBox each time you want to append it: $inputBox.clone(true).appendTo('#myForm'); $inputBox.clone(true).appendTo('#myForm'); I think that should do the trick. -Mike
[jQuery] Re: Creating DOM elements on the fly
You don't really want multiple fields with the same ID though, do you? I think .clone() will help you: function MakeEmailField(n) { var inputBox = $('input').attr(type, text); for (i =0; i n; i++) { inputBox.clone().attr(id,email+i).appendTo('#myForm'); } } The initial $('input') bit creates a DOM node. Adding it the first time adds it to the DOM, but adding it subsequent times is actually moving it. If you did: inputBox.appendTo('#myForm1'); inputBox.appendTo('#myForm2'); inputBox.appendTo('#myForm1'); I think you would find that the element would bounce back and forth (with adequate between those calls obviously). Sorting DOM nodes works the same way. You grab a reference to them, sort them outside of the DOM, and reinsert them all back in the same place they came from. They'll come out sorted because reinserting them (via append() or some such) is actually doing more of a move: $('#parent').children().sort().appendTo('#parent'); If you don't do the finally .appendTo(), you will have sorted them in memory, but not in the DOM. Anyways, a little off topic there. I hope that answers your question. --Erik On 8/17/07, Pops [EMAIL PROTECTED] wrote: On Aug 17, 2:49 am, Karl Rudd [EMAIL PROTECTED] wrote: In the examples I gave the new element is saved to the variable inputBox. So to add it to the DOM you will do something like what Erik wrote, that is: inputBox.appendTo('#myForm'); The above appends it (that is, adds it as the last element) to an element with id=myForm. Got it! Seeing the syntax helps. Much appreciated! I ask because this idea hits home with a major consideration in my current plans for one particular area for using jQuery, which begged the question: Is the VARIABLE autonomous? Meaning, is this following valid? var inputBox = $('input').attr(type, text).attr(id, someText); . . inputBox.appendTo('#myForm'); inputBox.appendTo('#myForm'); inputBox.appendTo('#myForm'); In my testing, that doen't work. It only adds the first one. The only way I can get that to work is to instantiate new variables. Of course, good JS coding can modularize a function generator., however it somewhat defeats the intended purpose - Create Once - Use Many Times! A practical example where I was intended to use dynamic creation of DOM elements was for our questionnaire (WCQ) web form generation. The WCQ Editor allows for device independent creation of questionnaires from a single source definition WCQ file. For example: ; ACTIONNUMBER 1 ACTION DISPLAY PROMPT @[EMAIL PROTECTED] @USER.FIRSTNAME@ NEXT Default ; ACTIONNUMBER 2 ACTION QUESTION PROMPT Leave mail on the server when picking mail via POP3? TYPE YesNo DESTINATION POP3SNOOP ; ACTIONNUMBER 3 ACTION QUESTION PROMPT What are your contact email addresses (upto 5 allowed)? TYPE Text DESTINATION EMAILADDRESS(5) MAX 70 NEXT Default ; ACTIONNUMBER 4 ACTION END NEXT Default For Console users, a text based interactive question/answer dialog is created from the WCQ file. For Web users, the server creates JS and forms. My goal was to pull the JS creation from the server and move new generalized JS/jQuery code to the client. The feed would be a JSON structure feed in via .getJSON(WCQ_URL) So for ACTIONNUMBER #3, that has the multi-input destination: PROMPT What are your contact email addresses (upto 5 allowed)? DESTINATION EMAILADDRESS(5) which defines 5 fields, if I was going to do this with jQuery, you can then see what I am talking about. This would be wrong, right? function MakeEmailField(n) { var inputBox = $('input').attr(type, text).attr(id, email); for (i =0; i n; i++) { inputBox.appendTo('#myForm'); } } I would need to move the variable creation inside the loop. function MakeEmailField(n) { for (i =0; i n; i++) { var inputBox = $('input').attr(type, text).attr(id, email); inputBox.appendTo('#myForm'); } } Conceptually, it makes a big difference, probably has some significance with memory as well. :-) -- HLS
[jQuery] Re: Creating DOM elements on the fly
Actually, technically, what I suggested wastes the original node since it never gets inserted, just cloned. Maybe this would be slightly better: function MakeEmailField(n) { var $inputBox = $('input').attr(type, text); for(var i = 1; i n; i++) { $inputBox.clone().attr(id,email+i).appendTo('#myForm'); } $inputBox.attr(id,email+n).appendTo('#myForm'); } Noticed the loop starting value is different. This way, the cloning only happens if you want more than one, which is a little more efficient. --Erik On 8/17/07, Erik Beeson [EMAIL PROTECTED] wrote: You don't really want multiple fields with the same ID though, do you? I think .clone() will help you: function MakeEmailField(n) { var inputBox = $('input').attr(type, text); for (i =0; i n; i++) { inputBox.clone().attr(id,email+i).appendTo('#myForm'); } } The initial $('input') bit creates a DOM node. Adding it the first time adds it to the DOM, but adding it subsequent times is actually moving it. If you did: inputBox.appendTo('#myForm1'); inputBox.appendTo('#myForm2'); inputBox.appendTo('#myForm1'); I think you would find that the element would bounce back and forth (with adequate between those calls obviously). Sorting DOM nodes works the same way. You grab a reference to them, sort them outside of the DOM, and reinsert them all back in the same place they came from. They'll come out sorted because reinserting them (via append() or some such) is actually doing more of a move: $('#parent').children().sort().appendTo('#parent'); If you don't do the finally .appendTo(), you will have sorted them in memory, but not in the DOM. Anyways, a little off topic there. I hope that answers your question. --Erik On 8/17/07, Pops [EMAIL PROTECTED] wrote: On Aug 17, 2:49 am, Karl Rudd [EMAIL PROTECTED] wrote: In the examples I gave the new element is saved to the variable inputBox. So to add it to the DOM you will do something like what Erik wrote, that is: inputBox.appendTo('#myForm'); The above appends it (that is, adds it as the last element) to an element with id=myForm. Got it! Seeing the syntax helps. Much appreciated! I ask because this idea hits home with a major consideration in my current plans for one particular area for using jQuery, which begged the question: Is the VARIABLE autonomous? Meaning, is this following valid? var inputBox = $('input').attr(type, text).attr(id, someText); . . inputBox.appendTo('#myForm'); inputBox.appendTo('#myForm'); inputBox.appendTo('#myForm'); In my testing, that doen't work. It only adds the first one. The only way I can get that to work is to instantiate new variables. Of course, good JS coding can modularize a function generator., however it somewhat defeats the intended purpose - Create Once - Use Many Times! A practical example where I was intended to use dynamic creation of DOM elements was for our questionnaire (WCQ) web form generation. The WCQ Editor allows for device independent creation of questionnaires from a single source definition WCQ file. For example: ; ACTIONNUMBER 1 ACTION DISPLAY PROMPT @[EMAIL PROTECTED] @USER.FIRSTNAME@ NEXT Default ; ACTIONNUMBER 2 ACTION QUESTION PROMPT Leave mail on the server when picking mail via POP3? TYPE YesNo DESTINATION POP3SNOOP ; ACTIONNUMBER 3 ACTION QUESTION PROMPT What are your contact email addresses (upto 5 allowed)? TYPE Text DESTINATION EMAILADDRESS(5) MAX 70 NEXT Default ; ACTIONNUMBER 4 ACTION END NEXT Default For Console users, a text based interactive question/answer dialog is created from the WCQ file. For Web users, the server creates JS and forms. My goal was to pull the JS creation from the server and move new generalized JS/jQuery code to the client. The feed would be a JSON structure feed in via .getJSON(WCQ_URL) So for ACTIONNUMBER #3, that has the multi-input destination: PROMPT What are your contact email addresses (upto 5 allowed)? DESTINATION EMAILADDRESS(5) which defines 5 fields, if I was going to do this with jQuery, you can then see what I am talking about. This would be wrong, right? function MakeEmailField(n) { var inputBox = $('input').attr(type, text).attr(id, email); for (i =0; i n; i++) { inputBox.appendTo('#myForm'); } } I would need to move the variable creation inside the loop. function MakeEmailField(n) { for (i =0; i n; i++) { var inputBox = $('input').attr(type, text).attr(id, email); inputBox.appendTo('#myForm'); } } Conceptually, it makes a big difference, probably has some significance with memory as well. :-) -- HLS
[jQuery] Re: ORing selectors
Does anyone know offhand how much overhead using .add() instead of the comma incurs? Is it just the additional function call? I've always used comma in selectors but using .add() instead is much clearer as it separates the selectors in an obvious manner. --rob On 8/15/07, Matt Stith [EMAIL PROTECTED] wrote: I would do something like $(#X).add(.Y); On 8/15/07, rickdog [EMAIL PROTECTED] wrote: What is the cleanest way for ORing select results, e.g. returning all DIVs with id=X or class=Y? -- Rob Desbois Eml: [EMAIL PROTECTED] Tel: 01452 760631 Mob: 07946 705987 There's a whale there's a whale there's a whale fish he cried, and the whale was in full view. ...Then ooh welcome. Ahhh. Ooh mug welcome.
[jQuery] Switching the Content of the Carousel on Click
Hi Board, the last 8hours i spent trying to work out a way to switch the Content of the List on click. (ie. Tabs) I started out with the Javascript Array Example where it loads external Content. Then i wrote a onClick Function which assigns mycarousel_itemList a new set of Data. This works but now i need to Reload/Reset the actual Carousel Object so it adjusts to the new Data Array. I tryed everything i could think of but it just doesnt work. Heres an Example: -- onClick -- $('#mycarousel').jcarousel({ size: mycarousel_itemList.length, --initCallback: mycarousel_initCallback, itemLoadCallback: {onBeforeAnimation: mycarousel_itemLoadCallback} }); function mycarousel_initCallback(carousel, b){ --- carousel.reload(); }; (Theres also a Reset Function but tryed it too) So basicly i havent found any way of getting this accomplished. You guys are my last hope. Thanks in advance. -- View this message in context: http://www.nabble.com/Switching-the-Content-of-the-Carousel-on-Click-tf4284282.html#a12195641 Sent from the jCarousel mailing list archive at Nabble.com.
[jQuery] Re: Creating DOM elements on the fly
Michael replied: A single node can't appear twice in the DOM. But you can easily clone a node. http://docs.jquery.com/DOM/Manipulation#clone.28_deep_.29 Ok, thanks. One thing I partially disagree with that Simon fella and his excellent jQuery writeup, was the idea that if you can separate yourself from understanding how jQuery works with foundation, then you can discovery the power and make productive use of jQuery. I generally agree, but ultimately to be an expert with jQuery, you have to solid understanding of DOM and how jQuery uses DOM. I have to remember that a variable is a node in the DOM tree. Does that mean that when it initially created, it is hidden? First, let's call your variable $inputBox instead of inputBox so I won't get confused. :-) (A common - and helpful - convention is to use a $ prefix on a variable containing a reference to a jQuery object, as a reminder that it's a jQuery object.) Yes, I wondered about that when Karl used it without the $ sign. I am a stickler to good style and convention. Points like this is very helpful. Then, do a deep clone of $inputBox each time you want to append it: $inputBox.clone(true).appendTo('#myForm'); $inputBox.clone(true).appendTo('#myForm'); I think that should do the trick. Thank you Michael. Your feedback is always useful, productive and helpful. :-) PS: Where's the book? g --- HLS
[jQuery] Re: ColdFusion tag for Tabs
Klaus Hartl wrote: jQuerians and ColdFusionistas! Andrea Campolonghi wrote me an email the other day: I played a bit with your plug-in ( very nice ) and I made up a ColdFusion Custom Tag for an easy implemntation of your plg-in in CF. I am a CF developer learning jQuery ( really impressed from the library). There's no blog yet so I'm just posting it here! I don't understand much of ColdFusion, hope it is useful! It seems the attachment has been blocked? --Klaus
[jQuery] Re: ajax - tabs plugin question: proper anchor tags
Geert Baven wrote: Hi I am using the ajax version of klaus hartl tabs plugin. I try to do crosslinking between the files which are called ahah_1.html etc by using a href=ahah_2.htmllink/a this does not render properly. So what is the proper html to put in the anchor tag? Geert, what do you mean by crosslinking? Can you post an example? I don't understand what the problem is... --Klaus
[jQuery] Re: new Plugin every: jQuery-oriented setTimeout and setInterval
On Aug 16, 6:40 pm, Blair Mitchelmore [EMAIL PROTECTED] wrote: http://jquery.offput.ca/js/jquery.timers.js I am seeing this: You don't have permission to access /js/jquery.timers.js on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. -- HLS
[jQuery] Re: Creating DOM elements on the fly
I have to remember that a variable is a node in the DOM tree. Does that mean that when it initially created, it is hidden? Not quite. When you create a DOM node from scratch, it exists in memory, but not as a part of the DOM (that is, the collection of DOM nodes that make up the page), and therefor it has no interaction with any of the DOM nodes on the page until it is added via one of the manipulation functions. So while it's true that it doesn't show up on the page as soon as you create it, it *isn't* *not* showing up because it is hidden (in the CSS sense), it's because it's not actually part of the DOM of the page yet. --Erik
[jQuery] Re: Creating DOM elements on the fly
If you find yourself doing this kind of thing a lot, it might be handy to turn it into a plugin (totally off the top of my head and untested): (function($) { var _appendTo = $.fn.appendTo; $.fn.appendTo = function(parent, n) { if(n) { var id = this.attr('id'); for(var i = 1; i n; i++) { _appendTo.apply(this.clone(true).attr(id,id+i).attr(name,id+i), [parent]); } return _appendTo.apply(this.attr(id,id+n).attr(name,id+n), [parent]); } else { return _appendTo.apply(this, arguments); } }; })(jQuery); Then use it like: HTML: form id=theForm/form Script: $('input type=text id=email/').appendTo('#theForm', 5); Would result in: form id=theForm input type=text id=email1 name=email1/ input type=text id=email2 name=email2/ input type=text id=email3 name=email3/ input type=text id=email4 name=email4/ input type=text id=email5 name=email5/ /form And it doesn't break the usual usage of appendTo or chainability. --Erik On 8/17/07, Pops [EMAIL PROTECTED] wrote: On Aug 17, 4:30 am, Erik Beeson [EMAIL PROTECTED] wrote: Actually, technically, what I suggested wastes the original node since it never gets inserted, just cloned. Maybe this would be slightly better: function MakeEmailField(n) { var $inputBox = $('input').attr(type, text); for(var i = 1; i n; i++) { $inputBox.clone().attr(id,email+i).appendTo('#myForm'); } $inputBox.attr(id,email+n).appendTo('#myForm'); } Noticed the loop starting value is different. This way, the cloning only happens if you want more than one, which is a little more efficient. Ahhh. I see. Somewhat Obstrusive but I see the reasoning. g I will definitely save your notes here. Thanks -- HLS
[jQuery] Re: ajax - tabs plugin question: proper anchor tags
Hi Klaus at http://www.sriverm.net/gallery.html you can an example that I am working on now. The link and in the content section is what I am referring to in the previous mail. Geert 2007/8/17, Klaus Hartl [EMAIL PROTECTED]: Geert Baven wrote: Hi I am using the ajax version of klaus hartl tabs plugin. I try to do crosslinking between the files which are called ahah_1.html etc by using a href=ahah_2.htmllink/a this does not render properly. So what is the proper html to put in the anchor tag? Geert, what do you mean by crosslinking? Can you post an example? I don't understand what the problem is... --Klaus
[jQuery] Re: Creating DOM elements on the fly
Yes, the 'window' object is the global object that everything is a part of. The DOM for the page is under window.document (on FireFox anyways, starting to get into details that I don't know a lot about). If you were to do window.$someVar (no quotes) in your FireBug console, you'll find your new DOM node. --Erik On 8/17/07, Pops [EMAIL PROTECTED] wrote: Nice Erik! Definitely how I like to code! Perfect generalize unobstrusive coding! I do have a question from the your previous response. If its not stored in DOM, then were is the variable stored? I'm not referring to local scoping, but in general, like so: script type='text/javascript' var $someVar = null; $(document).ready(function() { $someVar = $('input').attr(type, text) } /script Of course, global variable is a taboo, but even then, where is this $someVar stored? The window object? Thanks for the plug-in. I have to study it! -- HLS On Aug 17, 5:43 am, Erik Beeson [EMAIL PROTECTED] wrote: If you find yourself doing this kind of thing a lot, it might be handy to turn it into a plugin (totally off the top of my head and untested): (function($) { var _appendTo = $.fn.appendTo; $.fn.appendTo = function(parent, n) { if(n) { var id = this.attr('id'); for(var i = 1; i n; i++) { _appendTo.apply(this.clone(true).attr(id,id+i).attr(name,id+i), [parent]); } return _appendTo.apply(this.attr(id,id+n).attr(name,id+n), [parent]); } else { return _appendTo.apply(this, arguments); } }; })(jQuery); Then use it like: HTML: form id=theForm/form Script: $('input type=text id=email/').appendTo('#theForm', 5); Would result in: form id=theForm input type=text id=email1 name=email1/ input type=text id=email2 name=email2/ input type=text id=email3 name=email3/ input type=text id=email4 name=email4/ input type=text id=email5 name=email5/ /form And it doesn't break the usual usage of appendTo or chainability. --Erik On 8/17/07, Pops [EMAIL PROTECTED] wrote: On Aug 17, 4:30 am, Erik Beeson [EMAIL PROTECTED] wrote: Actually, technically, what I suggested wastes the original node since it never gets inserted, just cloned. Maybe this would be slightly better: function MakeEmailField(n) { var $inputBox = $('input').attr(type, text); for(var i = 1; i n; i++) { $inputBox.clone().attr(id,email+i).appendTo('#myForm'); } $inputBox.attr(id,email+n).appendTo('#myForm'); } Noticed the loop starting value is different. This way, the cloning only happens if you want more than one, which is a little more efficient. Ahhh. I see. Somewhat Obstrusive but I see the reasoning. g I will definitely save your notes here. Thanks -- HLS
[jQuery] Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names
Of course, but I'm in favor of lt gt eq. Maybe 'cause I learned FORTRAN on college ;) 2007/8/17, Erik Beeson [EMAIL PROTECTED]: $(p:gt(4)).show().gt(10).css(color,red); Or, if you need to operate multiple time on same collection: var my_coll = $(p); my_coll.gt(3).css(color,red); my_coll.lt(3).css(color,blue); This stuff cannot be done by solely in selector expression. I'm pretty sure this can be done with filter. In fact, a cursory test with firebug on jQuery.com suggests it can: $('p'); [p, p, p.surprise, p, p.download_link, p.download_link, p, p, p] $('p:gt(2)'); [p, p.download_link, p.download_link, p, p, p] $('p:gt(2)').gt(4); [p] $('p:gt(2)').filter(':gt(4)'); [p] I'm all in favor of removing gt/lt/eq in favor of the selector version with filter. --Erik -- Dragan Krstić krdr http://krdr.ebloggy.com/
[jQuery] Re: Dynamic Form Validation?
Hi take a look http://dnaide.blogspot.com/2007/05/validationaide-easy-as-client-side-form.html BrowserSide validation. Very good. Regards Mario 2007/8/17, SeViR [EMAIL PROTECTED]: I suppose that you need a custom rule due to validation plugin don't support relations between fields. With jQuery.YAV (http://jquery.com/plugins/project/jquery_yav) I can do: input id=t1 name=t1 type=text class=equal alt={params:'some_value', require: 'pre-condition', condition: {name:'mycond', type:'implies', id:'t2', msg:'Please this field if required if you write a t1 value'}} / input id=t2 name=t2 type=text class=required alt={require:'post-condition',condition:{name:'mycond'}}/ And My JS code: $(#theform).yav(); Example (write some_value in the first field): http://projects.sevir.org/storage/yav/implies.html I like validation plugin but I want better more complexes rules of jQuery.YAV :-) howa escribió: Hello, anyone has idea how to do dynamic form validation? e.g. using http://bassistance.de/jquery-plugins/jquery-plugin-validation/ input name=t1 type=text / input name=t2 type=text / I only want to check for required field for t2 ONLY if t1 is equal to some value e.g. If t1 = test, then t2 cannot be null, else never mind abt t2 has any idea? -- Best Regards, José Francisco Rives Lirola sevir1ATgmail.com SeViR CW · Computer Design http://www.sevir.org Murcia - Spain -- Mário Alberto Chaves Moura [EMAIL PROTECTED] 31-9157-6000
[jQuery] Re: Superfish - huge issue with IE6
Hi Joel, I sent you a response with the url, but in the mean time I fixed it! I also use different html to make my menu function across browsers. This turned out to be the problem. Made the html look like yours and BOOOM! the menu works perfectly. If you could email me, I would like to talk to you about adding your script to my wordpress menu plugin . Thanks again Joel Sheri On Aug 17, 12:11 am, Joel Birch [EMAIL PROTECTED] wrote: On 8/17/07, muskokee [EMAIL PROTECTED] wrote: If you would like a url I would be happy to post one - just my dev site. Thanks a lot for any help you can offer. Sheri Hi Sheri, If you could post that url I'll try to have a look when I get the chance. My brain can't parse that raw CSS into a working model unfortunately - but wouldn't it be cool if it could! ;) Joel Birch.
[jQuery] Re: stupid dev tricks: marking current page links
Regexes are definitely worth learning. Once you know them, you can use them in many different programming languages (and even non-programming tools) and you'll be SO happy that you know how to use them. Brief follow-up: http://xkcd.com/208/ That's based on a true story.
[jQuery] Re: Superfish - huge issue with IE6
On 8/17/07, muskokee [EMAIL PROTECTED] wrote: Hi Joel, I sent you a response with the url, but in the mean time I fixed it! I also use different html to make my menu function across browsers. This turned out to be the problem. Made the html look like yours and BOOOM! the menu works perfectly. If you could email me, I would like to talk to you about adding your script to my wordpress menu plugin . Thanks again Joel Sheri Oh that's great news - I was just in the process of creating a test case so I could help you. Now I have my Friday night back :) Joel Birch.
[jQuery] Re: [OT] A Good Cause: AIR (Accessibility Internet Rally)
You should consider a new acronym for your group. Adobe just release a piece of software called AIR (Adobe Integrated Runtime) and they're putting lots of marketing dollars towards it. _ From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Kenneth Sent: Thursday, August 16, 2007 7:51 PM To: jquery-en@googlegroups.com Subject: [jQuery] [OT] A Good Cause: AIR (Accessibility Internet Rally) I am reposting this from March, as this year's events are coming up really soon. Please read! :) I know many of you here share my desire to produce accessible websites, so what more can we do though, besides that which we practice in our current roles? Well, for those of you who would like to put your design || development skills to good use by helping a non-profit organization (NPO), you should check out AIR, hosted by Knowbility: http://knowbility.org/air/ - AIR: Accessibility Internet Rally From the site, here's the rundown of how it works: 1. Form a web design team of up to four professionals and register your team with an AIR programs in your area. 2. Choose a training dates and sign-up to receive valuable accessibility training and access to free online accessibility testing software. Participants MUST attend the basic training. All registered team members also have the option to attend advanced accessibility training, which includes how to use CSS, javascript and other advanced technologies for maximum accessibility. 3. Attend the matching kickoff party and meet your nonprofit client. 4. Use the lead time to plan the site with your nonprofit partner. 5. Attend the Rally Day, collect your T-shirt and goody bag and build your entry web site for your nonprofit partner. 6. Come to the awards dinner and celebrate the good work of everyone and recognize the winners...which might be you! I'm not sure about the other cities, but I know AIR:Austin takes place in the fall. Also, there are other modes of participation, such as volunteering to help run the event, or program sponsorship. Also from the site, here's a list of 10 reasons why you should participate: 1. Your whole team gets the bonding experience of learning together how and why to make web sites accessible to people with disabilities (and PDAs and cell phones, and...) 2. All the coolest people have participated - frog design, Catapult Systems, MediaTruck, Bazzirk, IBM, Dell, Team Navanax, Nion, many many more. 3. Networking - get up close and personal with your peers in the industry and some of the very artists who keep Austin weird. 4. Access to new accessible design tools - and the folks who make them. 5. AIR judges are experts and become your friends. 6. Progress party, kickoff party, wrap party, awards party - BIG FUN! 7. A copy of the definitive accessibility book - Maximum Accessibility - is given to each team. 8. Your work featured in all AIR-Austin publicity. 9. Do good for a nonprofit arts, environment, or social service organization. 10. You could win!
[jQuery] Re: ColdFusion tag for Tabs
I got it. -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Klaus Hartl Sent: Friday, August 17, 2007 4:10 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: ColdFusion tag for Tabs Klaus Hartl wrote: jQuerians and ColdFusionistas! Andrea Campolonghi wrote me an email the other day: I played a bit with your plug-in ( very nice ) and I made up a ColdFusion Custom Tag for an easy implemntation of your plg-in in CF. I am a CF developer learning jQuery ( really impressed from the library). There's no blog yet so I'm just posting it here! I don't understand much of ColdFusion, hope it is useful! It seems the attachment has been blocked? --Klaus
[jQuery] event bubbling - checking for the right element
Hi, I've got a problem with event bubbling. That works fine: $(function() { $(body).click(function(e) { if ($(e.target).is(h2)) { alert(Test); } }); }); But now I want something like that: $(function() { $(body).click(function(e) { if ($(e.target).is(#test h2)) { alert(Test); } }); });
[jQuery] Search for a parent element
Hi, is it possible to find a parent element? See following example: div _prop=test1 div2 div3 div4 /div /div /div /div $([EMAIL PROTECTED]).bind(click, function(ev) { alert($(ev.srcElement).html()); }); If you run this you will always get the element under the mouse instead of the _prop element (which you want to get). What I'm searching for is something like: $([EMAIL PROTECTED]).bind(click, function(ev) { alert($(ev.srcElement).findParent([EMAIL PROTECTED]).html()); }); Michael
[jQuery] Re: Do my emails make it to the list?
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] Interface.js Exception: Access to Restricted URI denied
Hi, Was trying to make a horizontal accordion with nice ease-in effects etc. I first made the widget separately in an HTML file (which worked fine) and then tried to embed it in my main HTML file. I got a funny exception. Error: uncaught exception: [Exception... Access to restricted URI denied code: 1012 nsresult: 0x805303f4 (NS_ERROR_DOM_BAD_URI) location: file:///D:/work/ClientWork/Ask%20for%20Original/Site%20Design/HTML/interface.js Line: 8] The code that gives the error is the last line in the snippet below. The second last line happens nicely, though. which = '#'+which+'_details'; $('.details').animate({width: 0 }, 500, easein); $(which).animate({className: endcontent}, 500, easein); Please suggest a solution. Thanks -- Gurpreet Singh
[jQuery] Re: How i can replace?
Oh it's worked!!! xD Thank you!
[jQuery] Re: Creating DOM elements on the fly
I guess this is probably just a bit late (and will be even later due google not posting my replies until after 24-48 hours ) but if your interested i wrote a plugin for creating dom elements from json templates have a look at it here : http://jquery.com/plugins/project/appendDom --Byron
[jQuery] Hover Delay
Hi, I have a image which underneath has a p tag which contains some text, when the image is loaded the p tag is hidden until the cursor hovers over the image, then the p tag is shown. What I want to know is, is there a way I can only show the p tag if the cursor is held over the image for a set amount of time, else keep it hidden. Heres is the code I have for the hover. $('.full_img').hover(function(){ var description = $('a.selected img').attr(alt); var width = $(this).width() + 10; $('p.hidden').css('width', width); $('p.hidden').html(description); $('p.hidden').slideDown(slow); },function(){ $('p.hidden').slideUp(slow); }); And here is the code a http://b0bd0gz.adsl24.co.uk/gallery/ Any help and ideas would be appreciated. Thanks b0bd0gz -- View this message in context: http://www.nabble.com/Hover-Delay-tf4285726s15494.html#a12199740 Sent from the JQuery mailing list archive at Nabble.com.
[jQuery] Re: Hover Delay
On Aug 17, 3:43 pm, b0bd0gz [EMAIL PROTECTED] wrote: I have a image which underneath has a p tag which contains some text, when the image is loaded the p tag is hidden until the cursor hovers over the image, then the p tag is shown. What I want to know is, is there a way I can only show the p tag if the cursor is held over the image for a set amount of time, else keep it hidden. http://cherne.net/brian/resources/jquery.hoverIntent.html That's exactly what you want.
[jQuery] Re: Hover Delay
Awesome thanks, that is exactly what I needed :D -- View this message in context: http://www.nabble.com/Hover-Delay-tf4285726s15494.html#a12199959 Sent from the JQuery mailing list archive at Nabble.com.
[jQuery] Re: Modals don't mask whole page with Ext and jQuery
I've fixed the issue and I'm posting a new release right now. -- Brandon Aaron On 8/15/07, Brandon Aaron [EMAIL PROTECTED] wrote: Ahh thanks Wizzud, I'll dig a little deeper. Thanks. -- Brandon Aaron On 8/15/07, Wizzud [EMAIL PROTECTED] wrote: Brandon, There is actually a slight problem in this particular scenario, because $(document).height() is returning 0. Ext's jquery adaptor IS maxing out window and document, but because document is returning 0, window height is being used as the greater. The only property I can find (using FireBug) that returns a height value in this scenario is document.documentElement.scrollHeight. Using the code given in the EXT forum, I put in some tests... Ext.onReady(function(){ var vw = $(window).width() , vh = $(window).height() , bw = $(document).width() , bh = $(document).height() , d = document.documentElement.scrollHeight ; Ext.MessageBox.confirm('Confirm', 'Scroll the page up and down to see below the mask'); }); Breaking at Ext.MessageBox showed vh = 529 bh = 0 d = 1320 Width values seem to be fine. I've only looked at this (briefly) in Firefox, no other browser. I don't know if this will help at all. Brandon Aaron wrote: I responded to the thread over on the ext forums. Here is what I said: The jQuery Dimensions plugin simply returns the document height or the window height. Returning the Math.max( $(document).height(), $(window).height() ); for $(document).height() would not return the actual document height. -- Brandon Aaron On 8/14/07, Neil [EMAIL PROTECTED] wrote: Hi there. I posted a bug concerning modals not masking the whole page with jQuery on the Ext forum. Jack Slocum has responded saying The problem was reported a while back to jQuery. It has to do with viewport/document size not returning the largest value. If the document height is smaller than the window height, then the document height should be the window height. In jQuery that is not the case. You may want to log a bug there. The full write up on producing the bug is at http://extjs.com/forum/showthread.php?t=11086. Any advice on an interim workaround until the core is fixed would be really appreciated. Regards, Neil. -- View this message in context: http://www.nabble.com/Modals-don%27t-mask-whole-page-with-Ext-and-jQuery-tf4272596s15494.html#a12167179 Sent from the JQuery mailing list archive at 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: new Plugin every: jQuery-oriented setTimeout and setInterval
That's an .htaccess thing. There are some people hotlinking my scripts and I'm trying to discourage it. But fine, I'll remove the restriction and make it more fine-grained to the sites cheating me. It should work now. -blair On Aug 17, 5:32 am, Pops [EMAIL PROTECTED] wrote: On Aug 16, 6:40 pm, Blair Mitchelmore [EMAIL PROTECTED] wrote: http://jquery.offput.ca/js/jquery.timers.js I am seeing this: You don't have permission to access /js/jquery.timers.js on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. -- HLS
[jQuery] Jquery and IE problem
Hi All! I have a problem with my jquery code in IE browser. See bellow: I have two select: first - brand auto, second - model of auto. select with models is generated depending of brand using jquery instruments brand.js $(document).ready(function() { $('select#id_brand').change(function() { var url = '/ajax/brand/'; $.getJSON(url, {id: $(this).val()}, function(j) { var options = ''; for (var i = 0; i j.length; i++) { options += 'option value=' + j[i].id + '' + j[i].name + '/ option'; } $('select#id_model').html(options); $('select#id_model').removeAttr('disabled'); }); }); }); This code work in many browsers but not in IE. Can anybody help me? TIA
[jQuery] Re: Question about event.StopPropagation()
Hi Michael I thought that since 'match' is a ID (div id=#match) that means it is NOT a string, so I do I have the whole wrong idea about IDs? They are just plain old strings? Using the debugger is just what I need. I added the line to my code $(div).click(function(event) { debugger; if (event.target.id != 'match') { $(#text800birds).css( { background: #EE, color: #FF} ); } }); When I load the page Firebug opens (not everytime for some reason) with the script tab showing and the line with debugger; in yellow and to the right is the watch window. I can then go into the console and type: event.target.id and it shows its a null event.target shows div class=clipframe So does that mean that event.target.id doesnt work? I wish Firebug had some documentation. Mitch On Aug 16, 7:57 pm, Michael Geary [EMAIL PROTECTED] wrote: if (event.target.id != 'match') Thank you for the syntax correctoin. But how does jQuery know that 'match' is an ID and not an ordinary variable. It's neither. 'match' is a string. event is a variable. event.target is a property of the event variable, and event.target.id is a property of event.target. I have the handler set up but it seems to match any div that is clicked including the #match ID which I want it to ignore. Grrr. So I am wondering is there some kind of process I could follow on Firebug that would help me see where things are going wrong? I would add this statement where you want to look around (e.g. at the first line of your click event function): debugger; Firebug will stop there and you can look at variables and stuff. For example, you can type event.target.id into the Watch window and it will show you the value of that property. I wonder if it should be this.id instead of event.target.id? See what is in them both... -Mike
[jQuery] Re: Question about event.StopPropagation()
I wish Firebug had some documentation. It does. http://getfirebug.com/
[jQuery] Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names
Is this topic changing to the need for removing stuff from jQ? My intention was to just get opinions about the comment Thor made. On Aug 17, 1:04 am, Erik Beeson [EMAIL PROTECTED] wrote: $(p:gt(4)).show().gt(10).css(color,red); Or, if you need to operate multiple time on same collection: var my_coll = $(p); my_coll.gt(3).css(color,red); my_coll.lt(3).css(color,blue); This stuff cannot be done by solely in selector expression. I'm pretty sure this can be done with filter. In fact, a cursory test with firebug on jQuery.com suggests it can: $('p'); [p, p, p.surprise, p, p.download_link, p.download_link, p, p, p] $('p:gt(2)'); [p, p.download_link, p.download_link, p, p, p] $('p:gt(2)').gt(4); [p] $('p:gt(2)').filter(':gt(4)'); [p] I'm all in favor of removing gt/lt/eq in favor of the selector version with filter. --Erik
[jQuery] Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names
Thank you John - from you that means a lot. Speaking of meaning, are you suggesting I better get moving on this? When you say move it to the wiki do you mean I can go and set this up on the jq site? On Aug 16, 8:45 pm, John Resig [EMAIL PROTECTED] wrote: Great work Mitch - if someone wants to beat me to you, you should move this over to the wiki. I'll try to take a stab at it, if I can remember. --John On 8/16/07, Mitch [EMAIL PROTECTED] wrote: I think this is a very stimulating topic - the responses have given me a lot of insights to the frameworks of which jQuery belongs. I see there are some big issues here that kind of scare me, the one that stood out to me is the claim that jQurey is not for beginners who don't know the DOM, CSS and JS. I would contend that it is precisely the beginner that jQuery appeals to. Using myself as a test case - I came in knowing a little bit about JS, a bit more about CSS and pretty much nothing about DOM.. I had tried to use JS and CSS to do some fancy interface work and really got stuck in the complexities of JS. Then I found JQ and the world rocked for me. Suddenly I could do amazing things with my GUIs. Sure I had holes in my knowledge bank, and its shown in this mailing list, but I think you will admit this is a pretty impressive interface for a beginner to make: http://www.whatbird.com/wwwroot/Components/Complete_Search_Tab.html I have tons to learn but what a great and fun way to get started! I do think there is one hole in the JQ web site and that is there are not enough real life examples. To that end I am putting together jQuery Cheat Sheet (TM) (C) How To. I plan to make this available for everyone to contibute to. These two How Tos are examples of the format I am proposing to begin with. If anyone has any suggestions would love to hear them. If you have some suggestions for How Tos let me know and I will try and create them. I was thinking of making this into some kind of wiki like system where it would allow poeple to create How Tos that ended up in this standard format when formatted. http://www.whatbird.com/wwwroot/Components/jQuery_How_Do_I_not.html http://www.whatbird.com/wwwroot/Components/jQuery_How_Do_I_attr.html The JQ web site and other sites do a great job on explaining the API (even if most of the examples dont show up correclty in IE7) - whats missing is the practical side of the package. Real world non verbose examples of how to use the important features presented in a non trival but lucid manner, with the key concepts listed for indexing as well as the discussion is key to these working. Mitch- Hide quoted text - - Show quoted text -
[jQuery] Re: Search for a parent element
HI, Try to use the parent method, like this: $([EMAIL PROTECTED]).bind(click, function(ev) { alert( $( this ).parent().html() ); }); 2007/8/17, Michael Schwarz [MVP] [EMAIL PROTECTED]: Hi, is it possible to find a parent element? See following example: div _prop=test1 div2 div3 div4 /div /div /div /div $([EMAIL PROTECTED]).bind(click, function(ev) { alert($(ev.srcElement).html()); }); If you run this you will always get the element under the mouse instead of the _prop element (which you want to get). What I'm searching for is something like: $([EMAIL PROTECTED]).bind(click, function(ev) { alert($(ev.srcElement).findParent([EMAIL PROTECTED]).html()); }); Michael -- Abraços Estevão Lucas
[jQuery] Re: ColdFusion tag for Tabs
Thanks Klaus. 2007/8/17, Andy Matthews [EMAIL PROTECTED]: I got it. -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Klaus Hartl Sent: Friday, August 17, 2007 4:10 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: ColdFusion tag for Tabs Klaus Hartl wrote: jQuerians and ColdFusionistas! Andrea Campolonghi wrote me an email the other day: I played a bit with your plug-in ( very nice ) and I made up a ColdFusion Custom Tag for an easy implemntation of your plg-in in CF. I am a CF developer learning jQuery ( really impressed from the library). There's no blog yet so I'm just posting it here! I don't understand much of ColdFusion, hope it is useful! It seems the attachment has been blocked? --Klaus
[jQuery] jQuery Validation plugin and Tabs plugin
Hi... Anybody can tell me about how can I use jQuery Plugin Validation and Tabs plugin, because they can't work... this is my javascript source code: script type=text/javascript src=/js/jquery.pack.js/script script type=text/javascript src=/js/validate/jquery.validate.js/ script script type=text/javascript src=/js/validate/jquery.metadata.js/ script script type=text/javascript src=/js/tabs/jquery.tabs.pack.js/ script script type=text/javascript src=/js/tabs/ jquery.history_remote.pack.js/script script type=text/javascript $().ready(function() { $(#aggiungi_utente).validate({ rules: { rag_soc: required, piva: required, mail: { required: true, email: true }, conferma: required }, messages: { rag_soc: Devi indicare la ragione sociale/nome e cognome della societagrave;/utente da registrare., piva: Devi indicare la P. IVA o il codice fiscale della societagrave;/utente da registrare., mail: { required: Devi indicare la casella di Posta elettronica della societagrave;/utente da registrare., email: Devi indicare un indirizzo di posta elettronica corretto. }, conferma: Devi spuntare la cesella per poter effettuare la registrazione. } }); $(#menu-tab).tabs({ fxSlide: true, fxFade: true, fxSpeed: slow}) }) /script thank you
[jQuery] Re: columnize large text ...
Charles, Thanks!! :-) I like this script a lot, of course, so it's nice to hear that others do as well. Regarding HTML markup affecting column-ization (columnarization?): My script checks the total rendered width of your element, so technically anything should be allowed. However, right now all my script does is consider text; the amount of text in each column is determined by your element's width. So, if you include an inline image, for example, it probably wouldn't render as you'd expect. I do consider inline images to be a good feature to add next. I believe it's something that many people will want to use. Other feature ideas I find interesting are: - Allowing users to specify the height of their element, or the columns, and then paginate the text (I'd include links/buttons that allow you to page through the text). This would be good so that your columns don't get so tall that the user has to scroll up and down to read the text. - Allowing users to specify the number of columns, rather than the column width. Widow-orphan control sounds very interesting. (It's great to get someone with layout and design experience to comment on this, so thanks!!) While I was testing this plugin, it actually occurred to me that the text could be quite halted in this way, but I had no idea what to call it!! How about this: If the user has p tags in the element, the paragraphs will be kept together (i.e. not widowed/orphaned)? Now that I think about it some more, perhaps it is a good idea to integrate this into jQuery, because users can apply the behavior to elements of their choosing. However, having users specify column options in a Javascript call seems a little awkward (e.g. $(.MyColumnedElts).columns({width: 250px, gap: 15px});). What do you think? I'd do it all with CSS, but Firefox/Mozilla seems to remove CSS attributes that it doesn't apply; originally, this library did use CSS (e.g. column-width: 250px;), but when I iterated my elements in Firefox, they were gone. Anyway, thanks so much for the feedback!! I'd love to keep improving this library! I'd also secretly love to make it a jQuery plugin, so I can make this platform even stronger ;-) Take care, and keep creating!! Sean polyrhythmic wrote: Very interesting, I have seen something similar (now somewhat outdated) recently at http://13thparallel.com . However, what turned me off was a lack of widow-orphan control, the layout nut in me can't allow widows and orphans. There are other great features in this script, do you have any plans to implement widow-orphan control? It is also very nice that this is not a framework-dependent script, but I think this would be awesome to write as a streamlined jQuery function - jQuery will take care of cross-browser quirks on its own (camelCase, cloning, event binding). Plus, that way you could unobtrusively add properties without breaking validation. Hmm... also, are HTML tags allowed in the text? I am always looking for dynamic layout options, having text flow between columns is something layout designers have been using for years in print, it's about time to have a proper representation on screen. Nice work. Charles doublerebel.com On Aug 16, 12:30 pm, duma [EMAIL PROTECTED] wrote: Patrick, I've just released a Javascript library that allows you to have your text split into columns! Check it out here: http://pinkblack.org/text-columns/ You simply include the library in your document, and then do something like the following: div columnwidth=200px columngap=10px [My voluminous text goes here!] /div Now, your text will be split into columns that are, at maximum, 200 pixels wide. Also, there will be a 10-pixel gutter between columns. As your browser window grows and shrinks in width, columns will be added or subtracted dynamically. This library doesn't depend on jQuery -- or any other library, for that matter. It works in IE, Firefox, Opera, and Safari. Enjoy, and keep creating!! Sean patrickk wrote: I´m having a text on my page and I´d like to split that text into 2 (or even 3) columns. I´ve seen this before but I can´t remember where ... any suggestions are appreciated. thanks, patrick -- View this message in context:http://www.nabble.com/columnize-large-text-...-tf3527537s15494.html#a... Sent from the JQuery mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/columnize-large-text-...-tf3527537s15494.html#a12200653 Sent from the JQuery mailing list archive at Nabble.com.
[jQuery] Re: Modals don't mask whole page with Ext and jQuery
The new Dimensions 1.1.1 release is up on the project page. http://jquery.com/plugins/project/dimensions/ -- Brandon Aaron On 8/17/07, Brandon Aaron [EMAIL PROTECTED] wrote: I've fixed the issue and I'm posting a new release right now. -- Brandon Aaron On 8/15/07, Brandon Aaron [EMAIL PROTECTED] wrote: Ahh thanks Wizzud, I'll dig a little deeper. Thanks. -- Brandon Aaron On 8/15/07, Wizzud [EMAIL PROTECTED] wrote: Brandon, There is actually a slight problem in this particular scenario, because $(document).height() is returning 0. Ext's jquery adaptor IS maxing out window and document, but because document is returning 0, window height is being used as the greater. The only property I can find (using FireBug) that returns a height value in this scenario is document.documentElement.scrollHeight. Using the code given in the EXT forum, I put in some tests... Ext.onReady(function(){ var vw = $(window).width() , vh = $(window).height() , bw = $(document).width() , bh = $(document).height() , d = document.documentElement.scrollHeight ; Ext.MessageBox.confirm('Confirm', 'Scroll the page up and down to see below the mask'); }); Breaking at Ext.MessageBox showed vh = 529 bh = 0 d = 1320 Width values seem to be fine. I've only looked at this (briefly) in Firefox, no other browser. I don't know if this will help at all. Brandon Aaron wrote: I responded to the thread over on the ext forums. Here is what I said: The jQuery Dimensions plugin simply returns the document height or the window height. Returning the Math.max( $(document).height(), $(window).height() ); for $(document).height() would not return the actual document height. -- Brandon Aaron On 8/14/07, Neil [EMAIL PROTECTED] wrote: Hi there. I posted a bug concerning modals not masking the whole page with jQuery on the Ext forum. Jack Slocum has responded saying The problem was reported a while back to jQuery. It has to do with viewport/document size not returning the largest value. If the document height is smaller than the window height, then the document height should be the window height. In jQuery that is not the case. You may want to log a bug there. The full write up on producing the bug is at http://extjs.com/forum/showthread.php?t=11086. Any advice on an interim workaround until the core is fixed would be really appreciated. Regards, Neil. -- View this message in context: http://www.nabble.com/Modals-don%27t-mask-whole-page-with-Ext-and-jQuery-tf4272596s15494.html#a12167179 Sent from the JQuery mailing list archive at Nabble.com.
[jQuery] Re: ColdFusion tag for Tabs
Hi, if someone has some problem or suggestion with the CF Ctag for the tab plug-in please e-mail me. [EMAIL PROTECTED] Bye Andrea Campolonghi On Aug 17, 9:31 am, Web Specialist [EMAIL PROTECTED] wrote: Thanks Klaus. 2007/8/17, Andy Matthews [EMAIL PROTECTED]: I got it. -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Klaus Hartl Sent: Friday, August 17, 2007 4:10 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: ColdFusion tag for Tabs Klaus Hartl wrote: jQuerians and ColdFusionistas! Andrea Campolonghi wrote me an email the other day: I played a bit with your plug-in ( very nice ) and I made up a ColdFusion Custom Tag for an easy implemntation of your plg-in in CF. I am a CF developer learning jQuery ( really impressed from the library). There's no blog yet so I'm just posting it here! I don't understand much of ColdFusion, hope it is useful! It seems the attachment has been blocked? --Klaus
[jQuery] toggle all
Hello, is it possible to toggle all once a new toggle has been made? I have this function function opendiv(div){ var show = div; $(show).slideToggle(slow); } But I want to add something before the $(show).slideToggle(slow); that closes all opened toggles. Is this possible? Thanks -Tony
[jQuery] Re: columnize large text ...
Looks promising... Other feature ideas I find interesting are: - Allowing users to specify the height of their element, or the columns, and then paginate the text (I'd include links/buttons that allow you to page through the text). This would be good so that your columns don't get so tall that the user has to scroll up and down to read the text That's a key usability requirement indeed. Now that I think about it some more, perhaps it is a good idea to integrate this into jQuery, because users can apply the behavior to elements of their choosing. However, having users specify column options in a Javascript call seems a little awkward (e.g. $(.MyColumnedElts).columns({width: 250px, gap: 15px});). What do you think? I'd do it all with CSS, but Firefox/Mozilla seems to remove CSS attributes that it doesn't apply; originally, this library did use CSS (e.g. column-width: 250px;), but when I iterated my elements in Firefox, they were gone. I like the idea of having that in the css as well. Have a look at the metadata plugin, the syntaxt is class= {col-width: '250px'} (the plugin takes care of the parsing, of course) X+
[jQuery] Re: columnize large text ...
Oh, that's very interesting! Thank you, Xavier! Hum... maybe I will have a jQuery-only version after all! ;-) Sean xavier dutoit wrote: Looks promising... Other feature ideas I find interesting are: - Allowing users to specify the height of their element, or the columns, and then paginate the text (I'd include links/buttons that allow you to page through the text). This would be good so that your columns don't get so tall that the user has to scroll up and down to read the text That's a key usability requirement indeed. Now that I think about it some more, perhaps it is a good idea to integrate this into jQuery, because users can apply the behavior to elements of their choosing. However, having users specify column options in a Javascript call seems a little awkward (e.g. $(.MyColumnedElts).columns({width: 250px, gap: 15px});). What do you think? I'd do it all with CSS, but Firefox/Mozilla seems to remove CSS attributes that it doesn't apply; originally, this library did use CSS (e.g. column-width: 250px;), but when I iterated my elements in Firefox, they were gone. I like the idea of having that in the css as well. Have a look at the metadata plugin, the syntaxt is class= {col-width: '250px'} (the plugin takes care of the parsing, of course) X+ -- View this message in context: http://www.nabble.com/columnize-large-text-...-tf3527537s15494.html#a12201810 Sent from the JQuery mailing list archive at Nabble.com.
[jQuery] Re: Question about event.StopPropagation()
Have you looked at the documentation? They have a one page FAQ, console reference, keyboard reference and jQuery Lite. I dont see anything like how to use Firebug to debug. http://getfirebug.com/docs.html Maybe there is another link to a tutorial? On Aug 17, 7:22 am, Mike Alsup [EMAIL PROTECTED] wrote: I wish Firebug had some documentation. It does. http://getfirebug.com/
[jQuery] Avoiding anonymous functions - enhancement suggestion
Assigning event functions like click() require an anonymous function for what is often a very small snippet of code. These anonymous functions are confusing to inexperienced javascript coders and make the code less readable, IMO. I think it would be great to be able to pass a string to these functions and have it internally turned into a function. For example, instead of this: $('#test').click(function() { alert('test'); }); I want to do this: $('#test').click(alert('test');); This simple code change seems to do the job: // Handle event binding jQuery.fn[o] = function(f){ return f ? this.bind(o, ((typeof f==string)?Function(f):f)) : this.trigger(o); }; Is it possible to change jQuery to accept a string in addition to a function reference where possible? Although you would lose the potential benefit of the closure by passing a string, you could always pass the function ref instead if you needed to. Matt Kruse
[jQuery] Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names
The only concern I have is that this could be yet another mysterious method that someone might not know what it does. Will it work just lke javascript's slice method? _ From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Benjamin Sterling Sent: Friday, August 17, 2007 10:46 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names I like that, I like that alot! On 8/17/07, John Resig [EMAIL PROTECTED] wrote: I'm all in favor of removing gt/lt/eq in favor of the selector version with filter. That was the original goal, but I actually decided to introduce an array method into jQuery to solve that problem: .slice(). Now gt/lt/eq will become: gt: .slice(Num) lt: .slice(0,Num) eq: .slice(Num,1) Plus slice gives you a ton of extra functionality: first: .slice(0,1) last: .slice(-1) all but first and last: .slice(1,-1) --John -- Benjamin Sterling http://www.KenzoMedia.com http://www.KenzoHosting.com http://www.KenzoHosting.com
[jQuery] Re: toggle all
Yeah, you can use each to iterate to divs that you want to close... Date: Fri, 17 Aug 2007 11:24:36 -0400 From: [EMAIL PROTECTED] To: jquery-en@googlegroups.com Subject: [jQuery] toggle all Hello, is it possible to toggle all once a new toggle has been made? I have this function function opendiv(div){ var show = div; $(show).slideToggle(slow); } But I want to add something before the $(show).slideToggle(slow); that closes all opened toggles. Is this possible? Thanks -Tony _ Receba as últimas notícias do Brasil e do mundo direto no seu Messenger com Alertas MSN! É GRÁTIS! http://alertas.br.msn.com/
[jQuery] Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names
I'm all in favor of removing gt/lt/eq in favor of the selector version with filter. That was the original goal, but I actually decided to introduce an array method into jQuery to solve that problem: .slice(). Now gt/lt/eq will become: gt: .slice(Num) lt: .slice(0,Num) eq: .slice(Num,1) Plus slice gives you a ton of extra functionality: first: .slice(0,1) last: .slice(-1) all but first and last: .slice(1,-1) --John
[jQuery] Re: Creating DOM elements on the fly
There are also a few others: http://jquery.com/plugins/project/FlyDOM Easy DOM creation (which technically does not require jQuery, just the presence of $ in the global namespace): http://mg.to/2006/02/27/easy-dom-creation-for-jquery-and-prototype jquery-dom.js http://www.pinkblack.org/itblog/?page_id=22 jQDOM - a bit different to the others above (does not use JSON), more like the one by the OP Anurag (but with more features) http://www.alterform.com/resources/jqdom On Aug 17, 9:40 am, Byron [EMAIL PROTECTED] wrote: I guess this is probably just a bit late (and will be even later due google not posting my replies until after 24-48 hours ) but if your interested i wrote a plugin for creating dom elements from json templates have a look at it here :http://jquery.com/plugins/project/appendDom --Byron
[jQuery] Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names
I like that, I like that alot! On 8/17/07, John Resig [EMAIL PROTECTED] wrote: I'm all in favor of removing gt/lt/eq in favor of the selector version with filter. That was the original goal, but I actually decided to introduce an array method into jQuery to solve that problem: .slice(). Now gt/lt/eq will become: gt: .slice(Num) lt: .slice(0,Num) eq: .slice(Num,1) Plus slice gives you a ton of extra functionality: first: .slice(0,1) last: .slice(-1) all but first and last: .slice(1,-1) --John -- Benjamin Sterling http://www.KenzoMedia.com http://www.KenzoHosting.com
[jQuery] Re: Question about event.StopPropagation()
I found something http://www.evotech.net/blog/2007/06/introduction-to-firebug/ On Aug 17, 7:22 am, Mike Alsup [EMAIL PROTECTED] wrote: I wish Firebug had some documentation. It does. http://getfirebug.com/
[jQuery] Re: Question about event.StopPropagation()
Look at all the Learn More links on the main page. There is some good stuff. Maybe not exactly what you're looking for, but there is some useful info. Have you looked at the documentation? They have a one page FAQ, console reference, keyboard reference and jQuery Lite. I dont see anything like how to use Firebug to debug. http://getfirebug.com/docs.html Maybe there is another link to a tutorial?
[jQuery] Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names
The only concern I have is that this could be yet another mysterious method that someone might not know what it does. Will it work just lke javascript's slice method? Yes, of course - that's the only reason why I'm making this change. --John
[jQuery] Re: Avoiding anonymous functions - enhancement suggestion
On Aug 17, 5:51 pm, Matt Kruse [EMAIL PROTECTED] wrote: Assigning event functions like click() require an anonymous function for what is often a very small snippet of code. These anonymous functions are confusing to inexperienced javascript coders and make the code less readable, IMO. People who are unwilling to become comfortable with the language they're working in (e.g., by using its available features, such as anonymous functions) shouldn't be working in the language. I think it would be great to be able to pass a string to these functions and have it internally turned into a function. i think this would be counter-intuitive. If i pass a string to a function and know that it will be executed, i would expect the string to be eval()'d, not run in a Function object, and those evaluate their code with different scoping rules. This simple code change seems to do the job: // Handle event binding jQuery.fn[o] = function(f){ return f ? this.bind(o, ((typeof f==string)?Function(f):f)) : this.trigger(o); }; Shouldn't that be (new Function(f)) instead of (Function(f))? Is it possible to change jQuery to accept a string in addition to a function reference where possible? Although you would lose the potential benefit of the closure by passing a string, you could always pass the function ref instead if you needed to. IMO this change would be far more complex that it seems because, for example, the following no longer applies: if( typeof f == function ) { ... } That would have to be changed to include checks for Function: if( (typeof f == function) || (f instanceof Function) ) and the call syntax for those are different. You can, as far as i know, simply do f() when f is an instance of Function (i may be wrong on that, but i don't believe JS offers any sort of operator overloading for built-in types). Not only would the core be affected, but plugin authors might also have to go back and make similar changes, for consistency. The cascade of side-effects is enormous. i personally see no benefit, and several potential down-sides, to this change.
[jQuery] Select 2 types of elements
Hi, I did not find in doc, can I select 2 types of elements in only one instruction? My purpose is to capture values from input and select elements in a form to serialize it. Thank you
[jQuery] Re: jCarousel Lite - version 1.0
Hi Ganeshji, Thanks for your plugin. Its easy to use, and the true circular function is a great benefit! I am utilizing your plugin in the design for a food company website: http://www.comittechnologies.com/designs/brucefoods/test.html You can see the carousel on the left side, where the logos scroll past. This is about half the functionality I wanted. The other thing I want is for the carousel to stop moving once the user mouses over. Ideally it will stop when the brand logo is centered. Without seeing a complete source (with descriptive variable names) of your plugin, I am a little unsure as to how this can be done. Can you provide any suggestions? Thanks! Aaron On Aug 10, 1:00 pm, Ganeshji Marwaha [EMAIL PROTECTED] wrote: Awesome work. I'm now thinking to port this nice plugin to as a module in open source application like joomla. @Mike - Thanks, and that would be cool... Hi Ganeshji, Hey is it possible to have the presentation vertical, say three thumbnails tall, and then have it animate horizontally to slide three new thumbnails into place. I haven't seen an example for that type of a setup, still looking them over though. Nice work. thanks. @Ty, Since jCarouselLite supports any HTML content as its individual items, i am sure it is possible as long as your requirement is not to scroll both vertically and horizontally. If i have some time this weekend, i will try to get a demo for that in place. -GTG On 8/10/07, Ty [EMAIL PROTECTED] wrote: Hi Ganeshji, Hey is it possible to have the presentation vertical, say three thumbnails tall, and then have it animate horizontally to slide three new thumbnails into place. I haven't seen an example for that type of a setup, still looking them over though. Nice work. thanks. On Aug 9, 3:20 pm, Ganeshji Marwaha [EMAIL PROTECTED] wrote: Oops, forgot the link to the project page... here you go... http://gmarwaha.com/jquery/jcarousellite/ -GTG On 8/9/07, Ganeshji Marwaha [EMAIL PROTECTED] wrote: Hi friends, I have finally released the 1.0 version of jCarouselLite plugin. There was a lot of feedback for the earlier revisions, and i sincerely thank you all for that, because that is what shaped this 1.0 release. Nicolas Hoizey and Mike Fern - As per your request, circular is now well, circular. The carousel won't rewind itself after the last element. Rather it will cycle as if there is no end. Anton - As per your request, the buttons will be assigned a class called disabled when the carousel is in the first or last element respectively. This is applicable to non-circular carousels only. Cliff Lee - The bug you reported regarding clicking the previous button when the carousel is showing the first element, and then clicking the next button causes the carousel not to respond, should be fixed i suppose. Let me know. If you find the plugin interesting, don't resist yourself to digg it athttp://digg.com/programming/Merry_go_round_aka_jCarouselLite_with_jQuery -GTG
[jQuery] Re: Avoiding anonymous functions - enhancement suggestion
I cant comment on the merits of the technical aspects, but I do appreciate Matt's desire to simplify and to suggest possible alternatives. This isn't a love-it-or-leave-it community. We actively discuss ideas for changing the base code. I think slamming ideas is a bad practice. It might not make it into the code, but all ideas should have the benefit of the doubt that the suggestion is thoughtful. Regarding the specific suggestion For example, instead of this: $('#test').click(function() { alert('test'); }); I want to do this: $('#test').click(alert('test');); I used to feel uncomfortable with the function() {} part. It had alot of parens and brackets to keep track of and made me nervous. However, it does serve the purpose of reminding me that the stuff inside there is a series of steps like a normal function is. The {} helps me to think through what I am asking jQuery to do. Something like: $('#test').click( function() { alert('test'); $(this).show(); } ); So I am mixed about it. To me, Longer seems more understandable but shorter is more readable. Glen On 8/17/07, Stephan Beal [EMAIL PROTECTED] wrote: On Aug 17, 5:51 pm, Matt Kruse [EMAIL PROTECTED] wrote: Assigning event functions like click() require an anonymous function for what is often a very small snippet of code. These anonymous functions are confusing to inexperienced javascript coders and make the code less readable, IMO. People who are unwilling to become comfortable with the language they're working in (e.g., by using its available features, such as anonymous functions) shouldn't be working in the language. I think it would be great to be able to pass a string to these functions and have it internally turned into a function. i think this would be counter-intuitive. If i pass a string to a function and know that it will be executed, i would expect the string to be eval()'d, not run in a Function object, and those evaluate their code with different scoping rules. This simple code change seems to do the job: // Handle event binding jQuery.fn[o] = function(f){ return f ? this.bind(o, ((typeof f==string)?Function(f):f)) : this.trigger(o); }; Shouldn't that be (new Function(f)) instead of (Function(f))? Is it possible to change jQuery to accept a string in addition to a function reference where possible? Although you would lose the potential benefit of the closure by passing a string, you could always pass the function ref instead if you needed to. IMO this change would be far more complex that it seems because, for example, the following no longer applies: if( typeof f == function ) { ... } That would have to be changed to include checks for Function: if( (typeof f == function) || (f instanceof Function) ) and the call syntax for those are different. You can, as far as i know, simply do f() when f is an instance of Function (i may be wrong on that, but i don't believe JS offers any sort of operator overloading for built-in types). Not only would the core be affected, but plugin authors might also have to go back and make similar changes, for consistency. The cascade of side-effects is enormous. i personally see no benefit, and several potential down-sides, to this change.
[jQuery] Autocomplete problem
Hi, I have a textarea and i will write news related to mobile phones in it. But i want each phone must match the name in my database and be a link to its description page like journal form in last.fm In order to do this autocomplete should start to search whenever i type [phone] and when i find the phone it should modify it like [phone href=http://www.xx.com/phone.php?id=3]Nokia N90[/phone] or just [phone]Nokia N90[/phone] If you needed something like it and achieved to do that, can you tell me how to do it and where will i modify? Thanks for your help...
[jQuery] Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names
Then by all means...have at it. -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of John Resig Sent: Friday, August 17, 2007 10:56 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names The only concern I have is that this could be yet another mysterious method that someone might not know what it does. Will it work just lke javascript's slice method? Yes, of course - that's the only reason why I'm making this change. --John
[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] flicker on tooltips fix ?
On a website I am making I'm having a problem with some tooltips. If you have a look ( http://www.rockbandlogo.com/test_index.html ), you'll see three icons, which when you hover over them you'll get a tooltip type pop up. The problem occurs when you hover over both tooltip and icon underneath, it begins to flicker. I know why this happens, but I don't know how to solve it. I'm relatively new to jquery so I'm not sure how to go about fixing this. Any help would be great. Cheers, Al
[jQuery] Re: Avoiding anonymous functions - enhancement suggestion
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(); Removing the need for anonymous functions entirely. --John On 8/17/07, Matt Kruse [EMAIL PROTECTED] wrote: Assigning event functions like click() require an anonymous function for what is often a very small snippet of code. These anonymous functions are confusing to inexperienced javascript coders and make the code less readable, IMO. I think it would be great to be able to pass a string to these functions and have it internally turned into a function. For example, instead of this: $('#test').click(function() { alert('test'); }); I want to do this: $('#test').click(alert('test');); This simple code change seems to do the job: // Handle event binding jQuery.fn[o] = function(f){ return f ? this.bind(o, ((typeof f==string)?Function(f):f)) : this.trigger(o); }; Is it possible to change jQuery to accept a string in addition to a function reference where possible? Although you would lose the potential benefit of the closure by passing a string, you could always pass the function ref instead if you needed to. Matt Kruse
[jQuery] Re: Avoiding anonymous functions - enhancement suggestion
On Aug 17, 6:49 pm, Stephan Beal [EMAIL PROTECTED] wrote: According to the rhino book: ... One more follow-up here and i'll shut up: Also according to the rhino book: The Function() constructor parses the function body and creates a new function object each time it is called. ... By contrast, a function literal or nested function that appears within a loop or function is not recompiled each time it is encountered. So using Function(...) inside an $(...).each() loop could be disastrous, memory-wise. To summarize, the main problems with passing strings to create Function instances, compared to using anonymous functions, are: a) scoping rules are different (more eval()-like, no lexical scoping) for Function, as opposed to lexical scoping for anonymous functions. b) Function(...) body is recompiled on each call, whereas function does not. Only (a) should directly affect a user, but (b) would certainly come up at some point when someone traverses a table with 5k+ cells in it.
[jQuery] jQuery is not defined in line 1400 in 1.3.1.1
jQuery is not defined in line 1400 Now and then, I'm getting this error in FF. The line is: // Clean up added properties in IE to prevent memory leak if (jQuery.browser.msie) Is it a known issue or am I mistaken? TIA -- ?php echo 'Just another PHP saint'; ? Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/
[jQuery] Re: Avoiding anonymous functions - enhancement suggestion
On Aug 17, 11:11 am, Stephan Beal [EMAIL PROTECTED] wrote: People who are unwilling to become comfortable with the language they're working in (e.g., by using its available features, such as anonymous functions) shouldn't be working in the language. Perhaps. I'm comfortable with the language, and I see the anonymous function as just unnecessary clutter. i think this would be counter-intuitive. If i pass a string to a function and know that it will be executed, i would expect the string to be eval()'d, not run in a Function object, and those evaluate their code with different scoping rules. How so? Both are run in the context of the global object, are they not? Shouldn't that be (new Function(f)) instead of (Function(f))? Same diff, but shorter. IMO this change would be far more complex that it seems because, for example, the following no longer applies: if( typeof f == function ) { ... } Why would you want to do this, anyway? Once it gets past the initial call to click() or whatever, it is a function all the way down. If you define a new Function, the resulting object is typeof 'function'. There would be no visible effect anywhere else in plugins, etc. The cascade of side-effects is enormous. I don't see any side-effect at all, but I may of course be wrong ;) Matt Kruse
[jQuery] Re: Avoiding anonymous functions - enhancement suggestion
On Aug 17, 6:25 pm, Glen Lipka [EMAIL PROTECTED] wrote: the base code. I think slamming ideas is a bad practice. It might not make it into the code, but all ideas should have the benefit of the doubt that the suggestion is thoughtful. Saying i personally see no benefit is a statement of personal opinion, and not a slam. My apologies for the confusion. I used to feel uncomfortable with the function() {} part. It had alot of parens and brackets to keep track of and made me nervous. You work in an editor which doesn't do parent/brace matching for you? So I am mixed about it. To me, Longer seems more understandable but shorter is more readable. But offering both approaches at once has problematic technical implications, which i detailed in my first post. In summary, calling a function() and a Function() cannot be done uniformly. That is, you cannot do: function f(a,b,c) { ... } var f1 = f; var f2 = new Function(...); f1(1,2,3); f2(1,2,3); // this won't work And that means that the jQuery internals would have to accommodate both cases if it were to support this syntax. A quick look in a JS book implies that you could use f.apply() or f.call() for both approaches, but that also requires fiddling with the arguments lists (moving the args into an array). Also, according to this book (the rhino book), Function.arguments is being removed from ECMAScript 3, making it even more different from normal functions. And try generically passing multiple arguments to the Function ctor... it cannot be done generically - it would require a block for each different number of arguments. So, to respond more gently this time: my considered technical opinion is that this change would result in so many bugs and workarounds that it could no longer be considered a feature.
[jQuery] Re: Avoiding anonymous functions - enhancement suggestion
On Aug 17, 6:33 pm, Matt Kruse [EMAIL PROTECTED] wrote: On Aug 17, 11:11 am, Stephan Beal [EMAIL PROTECTED] wrote: i think this would be counter-intuitive. If i pass a string to a function and know that it will be executed, i would expect the string to be eval()'d, not run in a Function object, and those evaluate their code with different scoping rules. How so? Both are run in the context of the global object, are they not? According to the rhino book: A last, very important point about the Function() constructor is that the funcions is creates do not use lexical scoping; insteawd, they are always compiled as if they were top-level functions... That alone completely rules out their use for many use-cases as event handlers, which often want access to variables from their containing scope. Shouldn't that be (new Function(f)) instead of (Function(f))? Same diff, but shorter. i don't think those are the same, as (Function(...)) is not creating a new object, but theoretically its working directly on the prototype object. Maybe i'm wrong on this, but it looks suspicious to me. IMO this change would be far more complex that it seems because, for example, the following no longer applies: if( typeof f == function ) { ... } Why would you want to do this, anyway? When a function takes multiple argument types you have to check what those types are. That gets more complicated with two distinctly different ways of having functions. Once it gets past the initial call to click() or whatever, it is a function all the way down. If you define a new Function, the resulting object is typeof 'function'. ~ SpiderApe -e x=new Function('1');print(typeof x); function You're right - i wasn't aware of that. There would be no visible effect anywhere else in plugins, etc. i said earlier (in two posts) that the call syntax is different, but that is apparently incorrect: ~ SpiderApe -e x=new Function('print(1);');x(); 1 JS apparently offers special-case handling of this type. The cascade of side-effects is enormous. I don't see any side-effect at all, but I may of course be wrong ;) My apologies - i grossly overstated the side-effects (/me smacks forehead). But the scoping issue is still critical, as event handlers often need access to variables from their contained scope, and that apparently can't be done with Function objects.
[jQuery] Re: Select 2 types of elements
$(input, select) to select them both --John On 8/17/07, Giovanni Battista Lenoci [EMAIL PROTECTED] wrote: Hi, I did not find in doc, can I select 2 types of elements in only one instruction? My purpose is to capture values from input and select elements in a form to serialize it. Thank you
[jQuery] fadeTo fades up in Safari and FF, down in IE
I have an element with this style associated with it: filter:alpha(opacity=0); -moz-opacity: 0; opacity: 0; Now, I fade it in: $(object).fadeTo(1000, 0.8); In FF and Safari, this results in the object fading from 0% to 80% opacity. But in IE, it makes the object pop in at 100% opacity, then fades down to 80%. Has anyone seen this before? What am I doing wrong? Thanks, Aaron
[jQuery] Re: Jquery can show Images from file:///C:?
Hey Mario, I had the same idea some time ago, but after trying some workarounds and reading a lot of browser docs I noticed this was an horrible and really bad practice in web development. So we actually can't make an image preview before sending data to the server. We will have to stick to the simple way, upload then preview. Cheers, On 8/7/07, Mario Moura [EMAIL PROTECTED] wrote: Hi folks What I am trying is show an image into my browser with this tag img width=50 height=50 src=file:///C:/Users/example.JPG/ into my browser. Is it possible? or is a security lock from browsers? I am using $.post() So I could send the path that user choice C:/Users/example.JPG to my php and return img width=50 height=50 src=file:///C:/Users/example.JPG/ But isnt working because browsers cant show this tag img width=50 height=50 src=file:///C:/Users/example.JPG/ I can upload the file to webserver I know but will be more fast and I can save some bandwidth traffic if I could do this. And avoid malicious users consume my bandwidth traffic. So I am trying use AJAX to simulate Upload Ajax? and when forms is already send images normaly (without ajax). So Jquery can show Images from file:///C:? or something like this? Regards Mario -- Joan Piedra || Frontend webdeveloper http://joanpiedra.com/
[jQuery] Re: flicker on tooltips fix ?
I don't think that's why that happens? It's because when you hover over the tooltip, you are no longer hovering on the icon, so the tooltip disappears. but as it disappears you are then hovering over the icon again, thus the tooltip appears again.. rinse and repeat, hence the flickering? Al
[jQuery] Re: fadeTo fades up in Safari and FF, down in IE
For me, I like having the opacity setting in the CSS, so i set it there and set display:none. Then I use fadeIn instead of fadeTo. Not a solution, but a possible alternative. I'm sure someone else will have a real solution. The problem with fadeIn is that it brings the element to 100% opacity; I need it to only fade to 80%. Thanks, though. Aaron
[jQuery] Re: Jquery can show Images from file:///C:?
That's not true at all. I've got a JS file that allows for live previews. The JS file is attached, and here's the code needed to trigger it: form name=myForm input type=file name=photo_filebr input type=button name=button class=smaller value=Preview Image onclick=previewImage(document.myForm.photo_file.value) /form I can't say that it works on all computers, but I've never once had a client say that it didn't work. _ From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Joan Piedra Sent: Friday, August 17, 2007 12:39 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Jquery can show Images from file:///C:? Hey Mario, I had the same idea some time ago, but after trying some workarounds and reading a lot of browser docs I noticed this was an horrible and really bad practice in web development. So we actually can't make an image preview before sending data to the server. We will have to stick to the simple way, upload then preview. Cheers, On 8/7/07, Mario Moura mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi folks What I am trying is show an image into my browser with this tag img width=50 height=50 src=file:///C:/Users/example.JPG/ into my browser. Is it possible? or is a security lock from browsers? I am using $.post() So I could send the path that user choice C:/Users/example.JPG to my php and return img width=50 height=50 src=file:///C:/Users/example.JPG/ But isnt working because browsers cant show this tag img width=50 height=50 src=file:///C:/Users/example.JPG/ I can upload the file to webserver I know but will be more fast and I can save some bandwidth traffic if I could do this. And avoid malicious users consume my bandwidth traffic. So I am trying use AJAX to simulate Upload Ajax? and when forms is already send images normaly (without ajax). So Jquery can show Images from file:///C:? or something like this? Regards Mario -- Joan Piedra || Frontend webdeveloper http://joanpiedra.com/ previewImage.js Description: application/js
[jQuery] Re: problem with selector in IE
On Aug 17, 7:36 pm, Potluri [EMAIL PROTECTED] wrote: table id=srTable tbody tra1 /tr tra2 /tr tra3 /tr tra4 /tr /tbody /table This isn't legal HTML. TR elements can only contain TD elements, not text. Try replacing each row with: trtda1/td/tr
[jQuery] Re: flicker on tooltips fix ?
alexfoxy wrote: The problem occurs when you hover over both tooltip and icon underneath, it begins to flicker. I know why this happens, but I don't know how to solve it. If you mean the quickly toggling on and off when your mouse is near the right side of the item, this happens because the so-called hotspot of the mouse physically changes when the mouse pointer switches between pointer mode and another mode. When this happens, the hotspot is over your item when the mouse is in pointer mode, but then the hotspot moves out of the item when it switches to its different mode. This is an unfortunate detail that we cannot fix at the JS-level (it's more a problem with the window manager or desktop environment, IMO, since it doesn't take care to keep the hotspot consistent). BTW, the hotspot is the part of the mouse pointer which is actually used for coordinate determination. When you have a pointer-style mouse pointer the hotspot is obvious - the tip of the pointer. When you have a hand-shaped or cursor-shaped pointer the hotspot is not so obvious. For a great example of this problem, visit: http://wanderinghorse.net/computing/javascript/jquery/spoilers/demo.html and put your mouse near the far right edge of the first Spoilers entry. When positioned properly you can see the mouse pointer switching modes. When it does the, the hotspot moves, which has the unfortunate side-effect of performing a mouse-out event because the hotspot is no longer in the widget. So... the fix is to keep your mouse pointer somewhere away from the far right edge of the tooltipped item.
[jQuery] Re: How to show Updating container
On Aug 17, 6:36 pm, Potluri [EMAIL PROTECTED] wrote: function() { $(#rs_loading).show(); someFuncTORefine(); $(#rs_loading).hide(); } ... I dont know where it's breaking it rs_loading container is shown after the someFuncTORefine() is executed. So it appears once the refinement function is done but not exactly when the click is made. I spent lot of time on this figuring out whats going wrong. Can Any one help me out plz... If i'm not mistaken this happens because your browser is not guaranteed to update any UI elements while a script is actually running. Most (all?) browsers will freeze the UI while a script is running and avoid making updates to it (there are several technical reasons for this). Once your script stops running, THEN the UI is given a chance to refresh.
[jQuery] Re: fadeTo fades up in Safari and FF, down in IE
Yah I had an issue with this as well. I use a work around. For me, I like having the opacity setting in the CSS, so i set it there and set display:none. Then I use fadeIn instead of fadeTo. Not a solution, but a possible alternative. I'm sure someone else will have a real solution. On Aug 17, 10:06 am, Aaron Scott [EMAIL PROTECTED] wrote: I have an element with this style associated with it: filter:alpha(opacity=0); -moz-opacity: 0; opacity: 0; Now, I fade it in: $(object).fadeTo(1000, 0.8); In FF and Safari, this results in the object fading from 0% to 80% opacity. But in IE, it makes the object pop in at 100% opacity, then fades down to 80%. Has anyone seen this before? What am I doing wrong? Thanks, Aaron
[jQuery] problem with selector in IE
Hi, I face this selector problem only in IE(that sucks). What I'm trying to do is select rows of a table by looping through them like I've table with id srTable as table id=srTable tbody tra1 /tr tra2 /tr tra3 /tr tra4 /tr /tbody /table I'm trying to loop through rows of table as $( tbody:firsttr,#srTable).each (function() { alert(vj); }); This works perfectly fine in firefox but in IE it doesn't loop through the rows. Can any one of you help me out how to make this work in IE or some other better way to loop through rows in table with jquery. I'm waiting for answer which works right away. Thanks in advance. Regards, Vijay Potluri -- View this message in context: http://www.nabble.com/problem-with-selector-in-IE-tf4287169s15494.html#a12204040 Sent from the JQuery mailing list archive at Nabble.com.
[jQuery] Focus Disappears After Effect Ends
I have a login box that slides down when the 'login' link is clicked. It also is set to automatically focus on the first input in the login box when it slides down. The problem is that the focus only happens for a brief second until the toggle effect is complete. Then the focus is gone. Here's the code I'm using: codepre$(a.login).click(function() { $(#loginbox).slideToggle(fast); $(#hidebox).slideToggle(fast); // Focus on first input $(#loginbox :input:enabled:first).focus(); return false; });/pre/code Any ideas what I'm messing up here? Thanks in advance.
[jQuery] Re: Avoiding anonymous functions - enhancement suggestion
On Aug 17, 12:32 pm, Stephan Beal [EMAIL PROTECTED] wrote: a) scoping rules are different (more eval()-like, no lexical scoping) for Function, as opposed to lexical scoping for anonymous functions. Exactly, which is the caveat I put in my original post. This does have an advantage, though, in that potential memory leaks caused by closures are always avoided. I've used Function() many times just for this purpose, when the internal function doesn't need to retain any enclosing scope. b) Function(...) body is recompiled on each call, whereas function does not. Only each time it is evaluated, not each time the resulting function is called. For example, for (var i=0; i10; i++) { var f = new Function(alert('test')); f(); } That would re-compile the function 10 times. But this: var f = new Function(alert('test')); for (var i=0; i10; i++) { f(); } compiles it only once, so there is no performance hit. And this would be the case in the change I suggested. Matt Kruse
[jQuery] Re: Avoiding anonymous functions - enhancement suggestion
On Aug 17, 11:50 am, John Resig [EMAIL PROTECTED] wrote: 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(); Removing the need for anonymous functions entirely. Only if your entire click() funtionality consists of jquery calls, correct? If I simply wanted to alert, I would still need to use an anonymous function? Your syntax above reminds me of functionality I built into my own custom framework a while ago: $(el).repeat(10).css(background-color:red).wait(.5).css(background- color:white).start(); This would flash a background 10 times with a 1/2 second pause between colors. The implementation wasn't complex - the repeat() function just returned a shell object that chomped up the following commands into a buffer which would be executed when start() was called. Same thing with wait() - it would eat up the following commands so that a setTimeout() could be called and execution could continue when the pause was done. The end result was some kind of slick-looking code in some places. But more of a mental exercise than anything extremely practical ;) Matt Kruse