[jQuery] Re: Dealing with Non existent nodes
On Jun 17, 2:52 pm, Scottus [EMAIL PROTECTED] wrote: I am using var title = document.getElementsByTagName('title').item(0).innerHTML; to get the content of a pages title tag. But if the page has no title tag I get Error: document.getElementsByTagName(title).item(0) has no properties and the script craps out. any ideas about how to deal with this ? An HTML document without a title element is invalid. Christopher has given you a jQuery answer, a generic answer is that if you try to get a property of an object that doesn't exist your script will error. If you want a belt braces approach, try something like: var o; if ( document document.getElementsByTagName (o = document.getElementsByTagName('title')[0]) (typeof o.text == 'string') ) { alert('The document title is: ' + o.title); } Or if you like being a little more risque, try: alert( document.title ); -- Rob
[jQuery] Re: How is height calculated?
Klaus, Humm, I still can't get the size of an element while it's hidden and absolute... I tried with an element: style=display: none; position: absolute and alert(id: + elt.id + height: + elt.offsetHeight + width: + elt.offsetWidth); alert(id: + elt.id + style.height: + elt.style.height + style.width: + elt.style.width); I still get height:0 and width:0 and style.height as well as style.width. Did you mean that the element position is made absolute, moved off screen and made visible to get its size and then made static and hidden again? Thanks Fred On 6/17/07, Klaus Hartl [EMAIL PROTECTED] wrote: Fred Janon wrote: Hi, I am trying to understand how the height of an element is calculated in jQuery. I don't understand how the height can be calculated especially when the element is hidden with display:none. Thanks Fred Fred, if the particular element is hidden, it is absolutely positioned while invisible (and the parent element its context), instead of display: none, and the height can then be calculated. Thereafter these styles are resetted. There is one issue: If not the element itself but some parent element is hidden via setting display to none, you won't get the correct height. Its just to expensive to use the above described technique for some parent element. --Klaus
[jQuery] Re: Printer Friendly Form Field Replacements
Because its not just the look that matters. If you have a long text value in an input element, then the text value gets cut off. Can you use CSS to fix that? Also, for the multi-select boxes, you only show the values selected, not all of the options. On Jun 16, 10:47 am, R. Rajesh Jeba Anbiah [EMAIL PROTECTED] wrote: On Jun 16, 2:34 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Here you go: http://rcs-comp.com/code_examples/jquery_form_print/ snip Code is nice, but I'm wondering--why not doing it with CSS (form fields with flat look) -- ?php echo 'Just another PHP saint'; ? Email: rrjanbiah-at-Y!comBlog:http://rajeshanbiah.blogspot.com/
[jQuery] jQuery Ajax pagination
I'm looking an example using jquery for grid pagination with ajax(database hits) support. http://makoomba.altervista.org/grid/ haves a great example but using xml data. I'll want to use json instead. Do you know? Cheers
[jQuery] jQuery may add $.browser.isiPhone
i found there is a method which can detect if your use is browsering your site on iPhone, function isiPhone() { var agent = navigator.userAgent.toLowerCase(); return agent.match(/iPhone/i); } this method defined in http://images.apple.com/global/scripts/browserdetect.js maybe jQuery may add a new function, $.browser.isiPhone, for further, since iPhone allows developers do more in its safari... :) -- Zacky Ma www.marchbox.com
[jQuery] Re: jQuery Ajax pagination
I have a (currently) six part tutorial on paging the ExtJS DataGrid component, with JQuery, on my blog: http://blog.cutterscrossing.com/index.cfm/My-First-ExtJS-DataGrid Steve 'Cutter' Blades Adobe Certified Expert Advanced Macromedia ColdFusion MX 7 Developer http://blog.cutterscrossing.com The best way to predict the future is to help create it On 6/17/07, Web Specialist [EMAIL PROTECTED] wrote: I'm looking an example using jquery for grid pagination with ajax(database hits) support. http://makoomba.altervista.org/grid/ haves a great example but using xml data. I'll want to use json instead. Do you know? Cheers -- Steve Cutter Blades Adobe Certified Professional Advanced Macromedia ColdFusion MX 7 Developer _ http://blog.cutterscrossing.com --- The Past is a Memory The Future a Dream But Today is a Gift That's why they call it The Present
[jQuery] Re: ANNOUCE: idTabs plugin released!
On 6/17/07, Robert Wagner [EMAIL PROTECTED] wrote: it (the link you mentioned) behaves _strange_ in safari. (2.0.4) it hangs a few seconds an then it shows the tabs (sometimes). -robert I'll try to look into this Robert, but I don't have access to a mac atm, do you think the windows version of Safari would show the same problems? Thanks for the feedback. ~Sean
[jQuery] Refreshing event registration
Hi there, I am adding input elements using jQuery and these input elements shall react on globally registered event handlers ( $(.myelement).click() ). But when inserting them via jQuery, they do not react on these rules, so I think I have to somehow re-register the events after adding them dynamically. But how do I do this? When I simply execute the bindings after inserting the elements, the events get registered multiple times. Is there a simple re-register command or something? Thanks in advance Arne
[jQuery] Re: ANN: jQuery Paris Meetup
Is there some more infos about what is planned there ? John Resig wrote: When: Sunday, June 24, 2007 - 10:30 AM Where: Hotel Helder Opera 4, Rue du Helder Paris, Île-de-France 75009 About: This is a meet up for those that use and are interested in the jQuery JavaScript Library. We'll be meeting in the lobby of the Hotel Helder Opera and then move to a park for a picnic. John Resig, the creator and lead developer of jQuery, will be attending. This meet up is being organized by the SPIP (a popular CMS, happily using jQuery) core team. Register: If you're interested in attending this event, please sign up on the event's Upcoming.org page: http://upcoming.yahoo.com/event/206745 Hope to meet everyone there! --John
[jQuery] Re: Dealing with Non existent nodes
thanks this worked well. I guess the key the if statement is testing for truth of a statement that anything that makes it false counts as false even if its non existence. o = document.getElementsByTagName('title')[0]) nice code. thanks On 6/17/07, RobG [EMAIL PROTECTED] wrote: On Jun 17, 2:52 pm, Scottus [EMAIL PROTECTED] wrote: I am using var title = document.getElementsByTagName('title').item(0).innerHTML; to get the content of a pages title tag. But if the page has no title tag I get Error: document.getElementsByTagName(title).item(0) has no properties and the script craps out. any ideas about how to deal with this ? An HTML document without a title element is invalid. Christopher has given you a jQuery answer, a generic answer is that if you try to get a property of an object that doesn't exist your script will error. If you want a belt braces approach, try something like: var o; if ( document document.getElementsByTagName (o = document.getElementsByTagName('title')[0]) (typeof o.text == 'string') ) { alert('The document title is: ' + o.title); } Or if you like being a little more risque, try: alert( document.title ); -- Rob -- Scott Wickham Everyone is equal and everyone is the best at everything. --- Principal Skinner Success is a lousy teacher. It seduces smart people into thinking they can't lose. -Bill Gates 99% of the time, in my experience, the hard part about creativity isn't coming up with something no one has ever thought of before. The hard part is actually executing the thing you've thought of. -- seth godin
[jQuery] Re: vignet : another great jquery powered site
Just posted a review for teamViget.com: http://www.stylegala.com/archive/team_viget.htm Any comments and insights from the dedicated jQ'ers out there would be great ;) Ty - wish my name was Jay Query G. On Jun 11, 11:26 am, Sam Sherlock [EMAIL PROTECTED] wrote: http://www.teamviget.com/ great work
[jQuery] Re: ANN: jQuery Paris Meetup
It's going to be pretty casual - I'll probably give a talk on jQuery 1.2, the direction of the project, etc. If anyone has any questions, I'll be happy to try and answer them. That's what I know about, on my end. The SPIP developers will probably be organizing some stuff too. (They run the French jQuery site: http://jquery.info/) --John On 6/17/07, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: Is there some more infos about what is planned there ? John Resig wrote: When: Sunday, June 24, 2007 - 10:30 AM Where: Hotel Helder Opera 4, Rue du Helder Paris, Île-de-France 75009 About: This is a meet up for those that use and are interested in the jQuery JavaScript Library. We'll be meeting in the lobby of the Hotel Helder Opera and then move to a park for a picnic. John Resig, the creator and lead developer of jQuery, will be attending. This meet up is being organized by the SPIP (a popular CMS, happily using jQuery) core team. Register: If you're interested in attending this event, please sign up on the event's Upcoming.org page: http://upcoming.yahoo.com/event/206745 Hope to meet everyone there! --John
[jQuery] Re: ANNOUCE: idTabs plugin released!
Good chance to see if Safari is the same on thee Mac v. PC. I also got an error in IE7 on Vista. Strange one. Line 5. Can't move focus to the control because it is invisible, not enabled or of a type that does not accept the focus. Otherwise, cool plugin. :) Glen On 6/17/07, Sean Catchpole [EMAIL PROTECTED] wrote: On 6/17/07, Robert Wagner [EMAIL PROTECTED] wrote: it (the link you mentioned) behaves _strange_ in safari. (2.0.4) it hangs a few seconds an then it shows the tabs (sometimes). -robert I'll try to look into this Robert, but I don't have access to a mac atm, do you think the windows version of Safari would show the same problems? Thanks for the feedback. ~Sean
[jQuery] Re: How to disable (or properly remove) meta refresh?
As Sigmund Freud might have said, It's all in your head... but he wasn't talking about html very little in the html head is normal. meta's are read from the head (by the server, not the client) and sent as headers! So it's too late for you to do anything... but at least you know how long until the browser will refresh you away! --- Connection: close Date: Sun, 17 Jun 2007 16:54:27 GMT Server: Apache/2.2.4 (Unix) mod_ssl/2.2.4 OpenSSL/0.9.7l DAV/2 PHP/5.2.1 mod_perl/2.0.3 Perl/v5.8.6 Content-Type: text/html; charset=UTF-8 Client-Date: Sun, 17 Jun 2007 16:54:27 GMT Client-Peer: 127.0.0.1:80 Client-Response-Num: 1 Client-Transfer-Encoding: chunked Refresh: 10;URL=/ Title: stars ?xml version=1.0 encoding=utf-8 ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.1//EN http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en head title stars /title meta http-equiv=refresh content=10;URL=/ / script type=text/javascript src=/js/jquery.js/script script type=text/javascript $(function(){ alert ($([EMAIL PROTECTED]).attr('content')) }); /script /head body /body /html --- On 6/17/07, Michael Andreas [EMAIL PROTECTED] wrote: Hi group, just a quick question here. Does anyone know how can I disable the refresh effect of the following meta element: meta http-equiv=refresh content=10;URL=index.htm / ? I've tried $([EMAIL PROTECTED]).remove(); but it didn't work. I'm so hopeful of a solution. Thank you. -Michael- -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ
[jQuery] Re: Refreshing event registration
Arne, When jQuery 1.1.3 comes out you will be able to use Brandon Aaron's Behavior Pluigin[1] to manage this behavior automatically. Until then you can do it manually. They key is to only bind the elements that have not been previously bound. If, for example, you're using ajax functionality to replace the contents of a form you can do something like the following: function addBehavior(sel, context) { $(sel, context).click(function(){}); } $(document).ready(function() { addBehavior(':input'); // example 1: load method $('#example1').click(function() { $('#myForm').load(function() { addBehavior(':input',this); }); }); // example 2: simple form plugin usage $('#example2').submit(function() { $('#myForm').ajaxSubmit(function() { addBehavior(':input',this); }); return false; }); // example 3: advanced form plugin usage $('#example2').submit(function() { $('#myForm').ajaxSubmit({ target: '#myForm', success: function() { addBehavior(':input',this); } }); return false; }); }); If you're just adding some elements on the fly they you'll need to be slightly more clever but as long as you know what you've added you should be able to either cache them or select them and apply the desired behavior. // cache example var $a = $('input name=a value=x').appendTo('#myForm'); var $b = $('input name=b value=y').appendTo('#myForm'); addBehavior([$a,$b]); Cheers. Mike [1] http://jqueryjs.googlecode.com/svn/trunk/plugins/behavior/jquery.behavior.js On 6/17/07, Arne-Kolja Bachstein [EMAIL PROTECTED] wrote: Hi there, I am adding input elements using jQuery and these input elements shall react on globally registered event handlers ( $(.myelement).click() ). But when inserting them via jQuery, they do not react on these rules, so I think I have to somehow re-register the events after adding them dynamically. But how do I do this? When I simply execute the bindings after inserting the elements, the events get registered multiple times. Is there a simple re-register command or something? Thanks in advance Arne
[jQuery] Re: calling php file into a div
I'm getting this error with fire bug... missing : after property id $(#show_results).load(index.php,{id,$(this).attr(id)});\n On Jun 15, 1:59 pm, Jake McGraw [EMAIL PROTECTED] wrote: try: $(function(){ $(a).click(function(){ $(#show_results).load(index.php,{id,$(this).attr(id)}); return false; }); }); Binds a click event to every anchor, sends urlparam id set to whatever the anchor id is, you can access is using $_REQUEST[id]. Injects return text (HTML, XML, whatever) into show_results div. - jake On 6/15/07, webgodjj [EMAIL PROTECTED] wrote: Hi, What I want to do: I have a list of links with id values. Each of these id values get sent to a remote php file, that is in turn returned to the page. ie... a href=index.php id=1 a href=index.php id=2 a href=index.php id=3 div id=show_results Show formated results here. /div
[jQuery] Re: calling php file into a div
I'm getting this error with fire bug... missing : after property id $(#show_results).load(index.php,{id,$(this).attr(id)});\n On Jun 15, 1:59 pm, Jake McGraw [EMAIL PROTECTED] wrote: try: $(function(){ $(a).click(function(){ $(#show_results).load(index.php,{id,$(this).attr(id)}); return false; }); }); Binds a click event to every anchor, sends urlparam id set to whatever the anchor id is, you can access is using $_REQUEST[id]. Injects return text (HTML, XML, whatever) into show_results div. - jake On 6/15/07, webgodjj [EMAIL PROTECTED] wrote: Hi, What I want to do: I have a list of links with id values. Each of these id values get sent to a remote php file, that is in turn returned to the page. ie... a href=index.php id=1 a href=index.php id=2 a href=index.php id=3 div id=show_results Show formated results here. /div
[jQuery] Prevent Firefox password manager to popup on invalid forms
Hi, I'm having troubles to prevent Firefox' password manager to popup on invalid forms. The problem is that it opens when the user clicks submit, and afterwards the form is marked invalid, possibly even including an invalid password. I haven't managed to produce a reliable test yet, so I hope someone has already experience with this problem and can help with a solution or hint me into the right direction. Thanks -- Jörn Zaefferer http://bassistance.de
[jQuery] Re: jQuery may add $.browser.isiPhone
maybe jQuery may add a new function, $.browser.isiPhone, for further, since iPhone allows developers do more in its safari... :) This should be as easy as adding a line with iphone: /iphone/.test(b), inside jQuery.browser = { }.. But, if it's added to the core: please, please name it $.browser.iphone for consistency. Just because Apple uses odd capitalisation, that doesn't mean we should use it in jQuery like that. Best, Bob.
[jQuery] How to modify Q A or Topic Expansion CSS
I got this code from scriptaculos and it toggles display of the answer pat then the question part is clicked. Javascript $(document).ready(function () { $ ('div.faqitem').find('div.answer').hide().end().find('div.question').click(function() { $(this).next().slideToggle(); }); }); HTML Code = div class=faqitem div class=question Topic /div div class=answer expansion /div /div I am trying to extend the CSS to: 1. give the question part a different colour if the answer is empty 2. avoid expanding the answer section if it is empty. Any pointers in how to do that? I am a Javascript newbie and I'd love an example of how to achieve this without the library just to know how things work. The source of the page doesn't include any onclick events. The event appears to be trapped higher up and passed down to the divs. There is the working page this code comes from http://yogaredux.meripol.net/node/42
[jQuery] Getting the absolute position of an element
I'm looking for a jQuery-native way to get the absolute position of an element; something like Prototype's Position.cumulativeOffset(element) or YUI's YAHOO.util.Dom.getXY(element). Is there anything like this or do I have to borrow from the other libs? Michael -- Michael Schuerig mailto:[EMAIL PROTECTED] http://www.schuerig.de/michael/
[jQuery] Re: Refreshing event registration
Hi Mike, thanks for this, this solution sounds quite plausible and is a good way to handle it at the moment, so thank you again! Best regards Arne -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mike Alsup Sent: Sunday, June 17, 2007 7:17 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Refreshing event registration Arne, When jQuery 1.1.3 comes out you will be able to use Brandon Aaron's Behavior Pluigin[1] to manage this behavior automatically. Until then you can do it manually. They key is to only bind the elements that have not been previously bound. If, for example, you're using ajax functionality to replace the contents of a form you can do something like the following: function addBehavior(sel, context) { $(sel, context).click(function(){}); } $(document).ready(function() { addBehavior(':input'); // example 1: load method $('#example1').click(function() { $('#myForm').load(function() { addBehavior(':input',this); }); }); // example 2: simple form plugin usage $('#example2').submit(function() { $('#myForm').ajaxSubmit(function() { addBehavior(':input',this); }); return false; }); // example 3: advanced form plugin usage $('#example2').submit(function() { $('#myForm').ajaxSubmit({ target: '#myForm', success: function() { addBehavior(':input',this); } }); return false; }); }); If you're just adding some elements on the fly they you'll need to be slightly more clever but as long as you know what you've added you should be able to either cache them or select them and apply the desired behavior. // cache example var $a = $('input name=a value=x').appendTo('#myForm'); var $b = $('input name=b value=y').appendTo('#myForm'); addBehavior([$a,$b]); Cheers. Mike [1] http://jqueryjs.googlecode.com/svn/trunk/plugins/behavior/jquery.behavi or.js On 6/17/07, Arne-Kolja Bachstein [EMAIL PROTECTED] wrote: Hi there, I am adding input elements using jQuery and these input elements shall react on globally registered event handlers ( $(.myelement).click() ). But when inserting them via jQuery, they do not react on these rules, so I think I have to somehow re-register the events after adding them dynamically. But how do I do this? When I simply execute the bindings after inserting the elements, the events get registered multiple times. Is there a simple re-register command or something? Thanks in advance Arne
[jQuery] Re: Getting the absolute position of an element
Michael, Take a look at the dimensions plugin: http://jqueryjs.googlecode.com/svn/trunk/plugins/dimensions/jquery.dimensions.js Mike On 6/17/07, Michael Schuerig [EMAIL PROTECTED] wrote: I'm looking for a jQuery-native way to get the absolute position of an element; something like Prototype's Position.cumulativeOffset(element) or YUI's YAHOO.util.Dom.getXY(element). Is there anything like this or do I have to borrow from the other libs? Michael -- Michael Schuerig mailto:[EMAIL PROTECTED] http://www.schuerig.de/michael/
[jQuery] Re: jQuery may add $.browser.isiPhone
hopefully we won't need to care that it's an iPhone! We'll know more on the 29th On 6/17/07, Bob den Otter [EMAIL PROTECTED] wrote: maybe jQuery may add a new function, $.browser.isiPhone, for further, since iPhone allows developers do more in its safari... :) This should be as easy as adding a line with iphone: /iphone/.test(b), inside jQuery.browser = { }.. But, if it's added to the core: please, please name it $.browser.iphone for consistency. Just because Apple uses odd capitalisation, that doesn't mean we should use it in jQuery like that. Best, Bob. -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ
[jQuery] Re: Validate RC2 Preview: Remember The Milk Signup
R. Rajesh Jeba Anbiah wrote: To be honest, having inspired by validation plugin, I thought of hacking an adopter for it. But, later I found that it's too un- intuitive to try to bend CakePHP rules for validation plugins; it will be just easy to dump CakePHP rules in JSON and write a simple jQuery code to do the validation. That may be true, but lacks validation that goes beyond required, validation on submit, hiding error messages... Basically you are replicating a very small subset of the validation plugin, and while being useful, I don't yet see the value here. -- Jörn Zaefferer http://bassistance.de
[jQuery] Re: How to terminate each befor full iteration
if (!okay) return; maybe? :P On 6/17/07, wyo [EMAIL PROTECTED] wrote: I'd like to terminat (beak) the iteration in the following code if a value is emtpy. Is that somehow possible? var okay = true; $('.input_required').each (function (i){ if ($(this).val() == ) { okay = false; } if (!okay) ??? }) O. Wyss
[jQuery] Using Sortables with tables
I have a CMS that I'm building for a client. There's going to be a list of items in one portion of the CMS which will likely get rearranged on a regular basis. Obviously I could simply have them change their order one at a time via a simple text box. I'd like to give them something unexpected though and make their lives much easier. So I'm considering the option of using Sortables to allow them to drag and drop to rearrange. Here's a small sample of my HTML code. At this point, each row would look just like this: tr valign=top class=listmainbg td align=center1/td tda href=modules.cfm?action=contentid=6 title=Edit the settings of this moduleCover Letter/a/td tdText/td td width=20a href=modules.cfm?action=contentid=6img src=images/edit.gif width=16 height=16 border=0 alt=Edit the settings of this module/a/td td width=20a href=modules.cfm?action=submitdeleteid=6img src=images/delete.gif width=16 height=16 border=0 alt=Delete this record/a/td /tr Each row will have a class of listmainbg, and will most likely have a unique ID which correlates to it's current display order (the first TD). What I would like to do is have the user drag and drop a row into the position they would like to be, then trigger a callback which renumbers the entire likst (or maybe just the ones which need to be changed?), then sends that array to an AJAX call to update the database. So the questions: 1) Has anyone else done something like this? 2) Do I need to make any changes to my HTML code? 3) Is this a crazy idea? Thanks for any help you can provide. Word!
[jQuery] rangeValue in Jorn Form Validation Plugin - zip validation
Hi, I'll want to validate a range in US(Los Angeles) zip field using great Jorn's Form Validation Plugin. For example: - how to ensure users enter only zip inside the range 902??- and 905??-??? Cheers
[jQuery] Re: Removing injected elements
Hi Michael, You could do something like this (untested): var $inner = $('#container').html(); $('#container').after($inner).remove(); --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Jun 17, 2007, at 5:03 PM, Michael Heilemann wrote: Hey all, Alright, so its fairly easy to inject content with jQuery, like for instance with .wrap(). But how do you remove those injected elements again, without destroying the underlying content? .remove() will remove anything contained within an element, but what I need is something that only removes the element, leaving its contents alone. Any takers?
[jQuery] Re: How to terminate each befor full iteration
Return false to stop the iteration loop. Mike On 6/17/07, wyo [EMAIL PROTECTED] wrote: I'd like to terminat (beak) the iteration in the following code if a value is emtpy. Is that somehow possible? var okay = true; $('.input_required').each (function (i){ if ($(this).val() == ) { okay = false; } if (!okay) ??? }) O. Wyss
[jQuery] Re: jQuery may add $.browser.isiPhone
i doubt they would be of any use, espically since it will be the only platform with that kind of function. On Jun 18, 5:47 am, Ⓙⓐⓚⓔ [EMAIL PROTECTED] wrote: I'm guessing a poke = a click, and a drag is a drag what will the double finger gestures be ?
[jQuery] AJAX get into a persistent variable?
I'm working on a page that has a form that is dynamically generated using jQuery. The form isn't built in one pass but progressively based on user actions. Prior to submit the form may contain dozens of select menus with varying option content. The problem is that the select menu options contain values that are stored in database. Those values can change, therefore it isn't safe to hard code the menu options in jquery code. I realize that I could make an AJAX call each time I need to build a menu, but that will slow down the form generation. It is safe to say that the values won't change during a user's session though. What I would like to do is cache the various menu values when the page loads, but I'm not sure the best way to do this? Is it possible to perform a $.get() and store the result into a global variable? I've tried something like this but it doesn't work. var foo = ''; $.get(options.php, function(data){ foo = data; // try to store data into foo }); Optionally I suppose I could do something like this ... $.get(options.php, function(data){ $('body').append(p style=\display:none\ id=\footext\ + data + /p); // store data in a hidden page element }); and access get the value via $(#footext).text() everytime I need it, but would prefer to use a variable.
[jQuery] Re: problem with animate()...
Having no actual idea and just venturing a guess, I'd say maybe there's a compounding rounding error or something? Maybe try setting the correct value after the animation has completed (via a callback)? --Erik On 6/17/07, Byron [EMAIL PROTECTED] wrote: Hi all, this is my first post to this list and my first attempt at porting a script to jquery, Ok so anyway... I've made this smooth image-list slider : http://dev.byron-adams.com/jquery/slider.html it was originally using prototype scriptaculous (130kb+) so it works pretty well, except for one issue that seems to have somthing to do with the animate function/method let me attempt to explain how this works, if you click the right arrow button $(#control-next), the $ ('#imageBoxInside') box will slide a set amount of pixels to the left, in this case it slides to -720px; and if you click the left button (after clicking the right one) it SHOULD scroll back to 0px, but instead, its scrolling back past 0px all the way to -2px. At first I thought this was obviously an error on myhalf, but apon futher inspection the problem seems to with jquerys animate()... some googling revealed this has occured before: http://blog.joshuaeichorn.com/archives/2007/01/11/jquery-image-strip/#comment-192037 and it doesnt seem like the author of that script is even aware of it... anyone encountered this before? any ideas? any response welcome :)
[jQuery] Re: problem with animate()...
It doesn't seem to happen consistently... On 6/17/07, Erik Beeson [EMAIL PROTECTED] wrote: Having no actual idea and just venturing a guess, I'd say maybe there's a compounding rounding error or something? Maybe try setting the correct value after the animation has completed (via a callback)? --Erik On 6/17/07, Byron [EMAIL PROTECTED] wrote: Hi all, this is my first post to this list and my first attempt at porting a script to jquery, Ok so anyway... I've made this smooth image-list slider : http://dev.byron-adams.com/jquery/slider.html it was originally using prototype scriptaculous (130kb+) so it works pretty well, except for one issue that seems to have somthing to do with the animate function/method let me attempt to explain how this works, if you click the right arrow button $(#control-next), the $ ('#imageBoxInside') box will slide a set amount of pixels to the left, in this case it slides to -720px; and if you click the left button (after clicking the right one) it SHOULD scroll back to 0px, but instead, its scrolling back past 0px all the way to -2px. At first I thought this was obviously an error on myhalf, but apon futher inspection the problem seems to with jquerys animate()... some googling revealed this has occured before: http://blog.joshuaeichorn.com/archives/2007/01/11/jquery-image-strip/#comment-192037 and it doesnt seem like the author of that script is even aware of it... anyone encountered this before? any ideas? any response welcome :)
[jQuery] getScript problem
I have tried to test on the twitter json and so I use the getScript to do that. It works in IE but not Firefox. The js console error shows: [Exception... ' P ³å|ë method XMLHttpRequest.open' when calling method: [nsIDOMEventListener::handleEvent] nsresult: 0x8057001e (NS_ERROR_XPC_JS_THREW_STRING) location: unknown data: no] I'm using the latest packed version on jquery.com front page, which should be 1.1.2. Code: html head titleTest jQuery Twitter/title script type=text/javascript src=jquery.js/script script type=text/javascript $(document).ready(function(){ var url = http://twitter.com/statuses/user_timeline/jackysee.json?callback=twitterCallbackamp;count=1 ; $.getScript(url); }); function twitterCallback(obj){ $(#text).html(obj[0].text); } /script /head bodyp id=text/p/body /html -- Best Regards, Jacky 網絡暴民 http://jacky.seezone.net
[jQuery] Re: getScript problem
jQuery's getScript implementation uses ajax and therefore you can not make cross-domain requests. But Michael Geary has a nice JSON plugin: http://mg.to/2006/01/25/json-for-jquery Mike On 6/17/07, Jacky [EMAIL PROTECTED] wrote: I have tried to test on the twitter json and so I use the getScript to do that. It works in IE but not Firefox. The js console error shows: [Exception... ' P ³å|ë method XMLHttpRequest.open' when calling method: [nsIDOMEventListener::handleEvent] nsresult: 0x8057001e (NS_ERROR_XPC_JS_THREW_STRING) location: unknown data: no] I'm using the latest packed version on jquery.com front page, which should be 1.1.2. Code: html head titleTest jQuery Twitter/title script type=text/javascript src=jquery.js/script script type=text/javascript $(document).ready(function(){ var url = http://twitter.com/statuses/user_timeline/jackysee.json?callback=twitterCallbackamp;count=1 ; $.getScript(url); }); function twitterCallback(obj){ $(#text).html(obj[0].text); } /script /head bodyp id=text/p/body /html -- Best Regards, Jacky 網絡暴民 http://jacky.seezone.net
[jQuery] Re: problem with animate()...
Thanks, I tried setting it in the call bak like so.. ... $(#imageBoxInside).animate({left: sLeft}, 'slow', function() { wait = 0; var left = parseInt($(#imageBoxInside).css(left)); if (left 0 left -(imageSize * transitionSize)) { $(#imageBoxInside).css(left, 0px); } }); ... and that works great :) But it would be nice to not have to use the hack... im still not really sure if its my code or jquery thats causing rounding error... On Jun 18, 2:28 pm, Erik Beeson [EMAIL PROTECTED] wrote: Having no actual idea and just venturing a guess, I'd say maybe there's a compounding rounding error or something? Maybe try setting the correct value after the animation has completed (via a callback)?
[jQuery] Cheat Sheet for jQuery v1.1.2 (PDF format) grab here.
Hey, long time jquery fan, I got time today to make One page Cheat Sheet (overview list of function in jquery library ) You know what to do with it, print it, tape it, type it, enjoy it. Download / view at PDF : www.n-bp.com/jquery_cheat_sheet/v112/jQuery_cheat_sheet_v1-1-2.pdf cheers, Nilesh - www.pixelide.com
[jQuery] Re: problem with animate()...
Byron - You should give jQuery 1.1.3a a try. This was one of the nasty bugs that we were able to resolve in it: http://code.jquery.com/jquery-1.1.3a.js Let me know if that code helps to solve your problem. --John On 6/17/07, Byron [EMAIL PROTECTED] wrote: Thanks, I tried setting it in the call bak like so.. ... $(#imageBoxInside).animate({left: sLeft}, 'slow', function() { wait = 0; var left = parseInt($(#imageBoxInside).css(left)); if (left 0 left -(imageSize * transitionSize)) { $(#imageBoxInside).css(left, 0px); } }); ... and that works great :) But it would be nice to not have to use the hack... im still not really sure if its my code or jquery thats causing rounding error... On Jun 18, 2:28 pm, Erik Beeson [EMAIL PROTECTED] wrote: Having no actual idea and just venturing a guess, I'd say maybe there's a compounding rounding error or something? Maybe try setting the correct value after the animation has completed (via a callback)?