Re: [jQuery] Dom creation
On 17/08/06, Michael Geary <[EMAIL PROTECTED]> wrote: > > From: Aloyzas Rimeika > > > > ...But I recommend use $.dom plugin only in XHTML pages with > > MIME type application/xhtml+xml > > http://www.quirksmode.org/bugreports/archives/2004/11/innerhtml_in_xh.html > > > > Easier and faster solution is innerHTML > > http://www.quirksmode.org/dom/innerhtml.html > > > > For example: > > var json = [ > >{'name' : "John", 'surname' : "Smith"}, > >{'name' : "Sarra", 'surname' : "Smith"} ]; > > > > var table = $('#fill-table > tbody'); > > $.each(json, function(){ > >table.append('' > > +''+ this.name > > +''+ this.surname > >+''); > > }); > > I'm with you there. I have switched most of my code from DOM creation to > innerHTML. > > BTW, you can speed up this kind of code by using Array.join instead of > string concatenation: > > var table = $('#fill-table > tbody'); > $.each(json, function(){ > table.append( [ > '', > '', this.name, '', > '', this.surname, '', > '' > ].join('') ); > }); > > It won't make a huge difference in a simple case like this, but if you're > concatenating very many strings, Array.join really speeds things up in most > browsers. > > -Mike > Doesn't this work: $('#fill-table > tbody').append(json, [ '', '', this.name, '', '', this.surname, '', '' ].join(''); ); If not, perhaps it should be added to jQuery? ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Help with the SVN Build Process
On 16/08/06, John Resig <[EMAIL PROTECTED]> wrote: > Step 1: > Go to this page and download and install "Java Runtime Environment (JRE) 5.0": > http://java.sun.com/javase/downloads/index.jsp > > Step 2: > Download and install Apache Ant: > http://ant.apache.org/bindownload.cgi > > Step 3: > Go to the jQuery directory and type 'ant'. You now have a compiled > version of jQuery, the documentation, and the test suite. > > Steps 2 & 3 Change depending if you're using Ant or the Makefile. > Since jQuery now includes the Ant build file, it's much easier to > simply use that (and more cross-platform). For UNIX-type people, like > myself, I'll just see the Makefile, type Make, and be done with it. > > I recommend that you check out the new, updated, README file in jQuery > SVN - as it explains this whole process. > > --John > Perhaps it may be benefitial if you could also build jQuery using NAnt or MSBuild - if you don't want / don't have Java or Make? Is there a way to check out jQuery without using SVN (ISA server blocks essential HTTP commands (PROPFIND) needed by SVN - error 400: Bad Request)? ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Dom creation
> Doesn't this work: > > $('#fill-table > tbody').append(json, [ >'', >'', this.name, '', >'', this.surname, '', >'' >].join(''); > ); > > If not, perhaps it should be added to jQuery? Not the json/templating stuff - but you can append s to both tables and tbodys (jQuery takes care of all the innerHTML details to make it work cross browser). --John ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Can jQuery SVN get / set element dimensions?
Does jQuery SVN have any functions for getting the dimensions (left, right, top, bottom, width, height, z-index) of an element? Something that also works across different browsers. I want to be able to do something like this: var me = $("#myelement"); var meD= $("#myelement").dimensions(0); // dimensions() would also get the first match var left = meD.left; Or maybe a better way (having left, right, top etc as methods): // set left, top and height (chain not broken) $("#myelement").left("12px").top("-2em").height("6em"); // get width (chain broken) var width = $("#myelement").width(); ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Tabs plugin feature request
Hi KlausI've been playing around with your tabs plugin, and would very much like it if you could add a callback facility. ie, when the tab is changed, i'd like a function to be called in the scope of the active tab. I can make this change myself, but dont know whether i have the latest version. does the URL quoted below contain the latest version?RegardsAshutoshOn 8/3/06, Klaus Hartl <[EMAIL PROTECTED]> wrote: Tabs:http://stilbuero.de/jquery/tabs/(Note: can now use fade and slide for switching tabs. slide is slightlybroken in latest svn version...) ___jQuery mailing listdiscuss@jquery.comhttp://jquery.com/discuss/ -- Reach1to1 Communicationshttp://www.reach1to1.com[EMAIL PROTECTED]98201-94408 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Improvements in Ajax facilities - error handling?
Speaking of errors... That's one thing I've really wanted. When using jQuery, I've noticed that assuming all of the syntax is valid, if you run code that doesn't work, nothing happens. No error message, nothing. That makes debugging quite difficult because you have no idea where to start. Is there any way that jQuery could generate SOME sort of error, a default alert box maybe) with error information? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of John Resig Sent: Wednesday, August 16, 2006 11:28 PM To: jQuery Discussion. Subject: Re: [jQuery] Improvements in Ajax facilities This is an amazing set of fixes/updates. I poured through them, made some tweaks, changes, and bug fixes and committed it to SVN. The big change, from your code, is that 'failure' is now 'error' - to be consistent with the current naming scheme. Keep up the great work! --John On 8/16/06, Taku Sano (Mikage Sawatari) <[EMAIL PROTECTED]> wrote: > With Ajax facilities of jQuery, it is not easy to deal with errors. In > addition, it is inconvenient to repeat reloading the same URL to > observe changes. Please confirm my patch handles these issues. > > [patch for svn.208] > http://pepper.sherry.jp/jquery/newajaxpatch-svn208.patch > > [test page] > http://pepper.sherry.jp/jquery/newajaxfunc.html > > Problems: > - $().load() replaces the HTML regardless of whether the request has > succeeded or failed. Therefore it is impossible to customize an error > message to show. > - Callback functions can't learn if the request has succeeded or not. > - It's true that there are methods that are called on error. But even > if it failed, DOM elements are always replaced, and callbacks are > always called. > - There are no ways to set timeout. In case of a server doesn't respond, > we can't abort the request after a few seconds and display an error. > > Improvements: > - Callbacks for $().load(), $.get, $.post now takes the second argument > which represents a state ("success", "failure", "notmodified"). > - $().load() no longer replaces the HTML on error, if a callback is > supplied. Without a callback, it replaces the HTML on error as it > used to do. > - $().load(), $.get, $.post now can timeout. When it timed out, the state > becomes "failure" and treated as an error. > $.ajaxTimeout(1000); // ms > $().load(); > - Added 2 ajax methods: > $().loadIfModified(); > $.getIfModified(); > These methods set If-Modified-Since header to Ajax requests. They are > useful when we periodically reload the same URL to see changes. > > They work the same way as $().load and $.get if the URL is updated. > When it is unchanged, ().load doesn't replace the URL but does callback. > In that case, the state will be "notmodified". > > Since IE always returns the same cached content for the same URL, it is > normally impossible to check changes. It's true that it is possible to > force not to use cache by appending some random characters as query of > the URL, but then we waste the traffic needlessly. $().loadIfModified() > and $.getIfModified() solve this problem. > > > > Taku Sano > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > -- John Resig http://ejohn.org/ [EMAIL PROTECTED] ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New plugin: Autocompleter
Hey there! This is a wonderful piece of code you have here! I'm trying to intergrate it into my current project but I'm having an issue. My query results contain a link (like Google Suggest results), but when I click on a result in the autocomplete, it just puts the entire link (HTML included) in the textbox text. What do I need to do to make it jump to the given link, instead of putting the selected item into the textbox? Thanks very much! Dan -- View this message in context: http://www.nabble.com/New-plugin%3A-Autocompleter-tf1998487.html#a5851684 Sent from the JQuery forum at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Improvements in Ajax facilities
Taku / John, This is excellent stuff! Great work. Mike ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New Plugin: Spy
Very nice plugin! I've put it to use in a little mini-app here at work. (Unfortunately, it's an internal thing, so I can't post an example link.) One suggestion: I found timestamp you are using difficult to process under ASP/MS SQL. I made some modifications to your script to add a second timestamp formatted slightly differently. First I changed: var timestamp = Math.floor((now - epoch) / 1000); to: var timestamp = Math.floor((now - epoch) / 1000); var timestampstring = (now.getMonth()+1) + '/' + now.getDate() + '/' + now.getFullYear() + ' ' + now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds(); Then I changed: $.post(o['ajax'], { 'timestamp': timestamp }, function(r) { to: $.post(o['ajax'], { 'timestamp': timestamp, 'timestampstring': timestampstring }, function(r) { This way, I can use the "timestampstring" form post variable in my database queries. >>> Remy Sharp <[EMAIL PROTECTED]> 08/14/06 7:06 AM >>> Hi, I've written a jQuery plugin that creates similar functionality to the Digg spy (http://digg.com/spy). Examples and documentation: http://leftlogic.com/info/articles/jquery_spy Source: http://leftlogic.com/jquery_spy/spy.js Will be grateful for any feedback. Thanks, Remy Sharp ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New plugin: Autocompleter
On 17/08/06, Dan Atkinson <[EMAIL PROTECTED]> wrote: > > Hey there! > > This is a wonderful piece of code you have here! > > I'm trying to intergrate it into my current project but I'm having an issue. > > My query results contain a link (like Google Suggest results), but when I > click on a result in the autocomplete, it just puts the entire link (HTML > included) in the textbox text. > > What do I need to do to make it jump to the given link, instead of putting > the selected item into the textbox? > > Thanks very much! > > Dan > -- What I would do is return the results from the queried page with the link after a | jQuery|http://jquery.com Google|http://www.google.com Yahoo|http:www.yahoo.com Then do the following: $("#mysearch").autocomplete("sites.php", { minChars:3, matchSubset:1, matchContains:1, cacheLength:10, onItemSelect: navigate } ) function navigation(li) { if (li.extra) { location.href = li.extra[0]; } } ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Plugin for browser's "Go Back" button and "bookmark"
I have made a plugin that helps you make your Ajax-driven page available for "Go Back" button and "bookmark" of browser. See the sample page: http://www.mikage.to/jquery/jquery_history.html ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New plugin: Autocompleter
Sam, Thanks for that. Here is an example of my output is from a search query: DSC-DSCSW70S|index.aspx?s=digitalcamera DSC-DSCFW7S|index.aspx?s=digitalcamera DSC-DSCHW7S|index.aspx?s=digitalcamera DSC-DSLWRA100KB|index.aspx?s=digitalcamera DSC-DSLQRA100W|index.aspx?s=digitalcamera And here is my what I'm calling with: $(document).ready(function() { $("#ctl00_ContentPlaceHolder1_ac_me").autocomplete("search.aspx", { minChars:5, matchSubset:1, matchContains:1, cacheLength:10, onItemSelect:navigate } ); }); function navigation(li) { if (li.extra) { location.href = li.extra[0]; } } In IE6, when I click on a result, I get taken to "http://example.com/[object]"; sans quotes. In Firefox, I get the following error in Firebug: "navigate is not defined". Search does not work at all and does not return any results. Where is navigation() being called? Thanks again. Sam Collett wrote: > > What I would do is return the results from the queried page with the > link after a | > > jQuery|http://jquery.com > Google|http://www.google.com > Yahoo|http:www.yahoo.com > > > Then do the following: > > $("#mysearch").autocomplete("sites.php", > { > minChars:3, > matchSubset:1, > matchContains:1, > cacheLength:10, > onItemSelect: navigate > } > ) > function navigation(li) > { > if (li.extra) > { > location.href = li.extra[0]; > } > } > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > -- View this message in context: http://www.nabble.com/New-plugin%3A-Autocompleter-tf1998487.html#a5852491 Sent from the JQuery forum at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New plugin: Autocompleter
Scratch that! I replaced 'onItemSelect: navigate' for 'onItemSelect: navigation'!!! :) Thanks again Sam! Sam Collett wrote: > > On 17/08/06, Dan Atkinson <[EMAIL PROTECTED]> wrote: >> >> Hey there! >> >> This is a wonderful piece of code you have here! >> >> I'm trying to intergrate it into my current project but I'm having an >> issue. >> >> My query results contain a link (like Google Suggest results), but when I >> click on a result in the autocomplete, it just puts the entire link (HTML >> included) in the textbox text. >> >> What do I need to do to make it jump to the given link, instead of >> putting >> the selected item into the textbox? >> >> Thanks very much! >> >> Dan >> -- > > What I would do is return the results from the queried page with the > link after a | > > jQuery|http://jquery.com > Google|http://www.google.com > Yahoo|http:www.yahoo.com > > > Then do the following: > > $("#mysearch").autocomplete("sites.php", > { > minChars:3, > matchSubset:1, > matchContains:1, > cacheLength:10, > onItemSelect: navigate > } > ) > function navigation(li) > { > if (li.extra) > { > location.href = li.extra[0]; > } > } > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > -- View this message in context: http://www.nabble.com/New-plugin%3A-Autocompleter-tf1998487.html#a5852548 Sent from the JQuery forum at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New plugin: Autocompleter
On 17/08/06, Dan Atkinson <[EMAIL PROTECTED]> wrote: > > Scratch that! > > I replaced 'onItemSelect: navigate' for 'onItemSelect: navigation'!!! > > :) > > Thanks again Sam! > That was a typo I made. Good that you spotted it though! ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Rebind events on dynamic content (modified DOM)
Hi Guys, I'm fairly new to Jquery but love it! My problem: I'm loading some DIV in to a container DIV using AJAX... all works like a charm. However, I need to bind some events to the DIVs I'm dynamically loading in, no joy :( I guess I need to refresh the DOM somehow? My code looks like: $("#daysheader").load("ajax/weekview_headers.aspx?fromdate=" + calendarDay.Date); $("#days").load("ajax/weekview_appointments.aspx?fromdate=" + calendarDay.Date); BindTimeSelectors(); function BindTimeSelectors() { //Wire up mouse down events to the day selectors. $("#day1selector").mousedown(function(){mouseDown("day1selector");}); $("#day2selector").mousedown(function(){mouseDown("day2selector");}); $("#day3selector").mousedown(function(){mouseDown("day3selector");}); $("#day4selector").mousedown(function(){mouseDown("day4selector");}); $("#day5selector").mousedown(function(){mouseDown("day5selector");}); } ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New plugin: Autocompleter
Return the link as an extra parameter. So format your results like this: result1|link1 result2|link2 ... onItemSelect allows you to access the complete row of the selected resut as an array. On 8/17/06, Dan Atkinson <[EMAIL PROTECTED]> wrote: > > Hey there! > > This is a wonderful piece of code you have here! > > I'm trying to intergrate it into my current project but I'm having an issue. > > My query results contain a link (like Google Suggest results), but when I > click on a result in the autocomplete, it just puts the entire link (HTML > included) in the textbox text. > > What do I need to do to make it jump to the given link, instead of putting > the selected item into the textbox? > > Thanks very much! > > Dan > -- > View this message in context: > http://www.nabble.com/New-plugin%3A-Autocompleter-tf1998487.html#a5851684 > Sent from the JQuery forum at Nabble.com. > > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Rebind events on dynamic content (modified DOM)
try my plugin: http://www.aloyzas.lt/javascript/jquery-dev/events.js I didn't wrote any documentation because of my English :) and it requires more testing I think. How it works: $('').events({ ':': function(e){ ... do something... }, ... }); Example: $(document).events({ '[EMAIL PROTECTED]:click': function(e){ alert("go to anchor"); } }); On 8/17/06, Tom Holder <[EMAIL PROTECTED]> wrote: > Hi Guys, > > I'm fairly new to Jquery but love it! My problem: > > I'm loading some DIV in to a container DIV using AJAX... all works > like a charm. However, I need to bind some events to the DIVs I'm > dynamically loading in, no joy :( > > I guess I need to refresh the DOM somehow? > > My code looks like: > > > > $("#daysheader").load("ajax/weekview_headers.aspx?fromdate=" + > calendarDay.Date); > > $("#days").load("ajax/weekview_appointments.aspx?fromdate=" + > calendarDay.Date); > > BindTimeSelectors(); > > > > function BindTimeSelectors() > > { > > //Wire up mouse down events to the day selectors. > > $("#day1selector").mousedown(function(){mouseDown("day1selector");}); > > $("#day2selector").mousedown(function(){mouseDown("day2selector");}); > > $("#day3selector").mousedown(function(){mouseDown("day3selector");}); > > $("#day4selector").mousedown(function(){mouseDown("day4selector");}); > > $("#day5selector").mousedown(function(){mouseDown("day5selector");}); > > } > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Rebind events on dynamic content (modified DOM)
Hi Tom, I had this problem a while ago and John pointed out that it "should" work... Probably worth checking your cache... Hope this helps Mark. On 17/08/06, Tom Holder <[EMAIL PROTECTED]> wrote: > Hi Guys, > > I'm fairly new to Jquery but love it! My problem: > > I'm loading some DIV in to a container DIV using AJAX... all works > like a charm. However, I need to bind some events to the DIVs I'm > dynamically loading in, no joy :( > > I guess I need to refresh the DOM somehow? > > My code looks like: > > > > $("#daysheader").load("ajax/weekview_headers.aspx?fromdate=" + > calendarDay.Date); > > $("#days").load("ajax/weekview_appointments.aspx?fromdate=" + > calendarDay.Date); > > BindTimeSelectors(); > > > > function BindTimeSelectors() > > { > > //Wire up mouse down events to the day selectors. > > $("#day1selector").mousedown(function(){mouseDown("day1selector");}); > > $("#day2selector").mousedown(function(){mouseDown("day2selector");}); > > $("#day3selector").mousedown(function(){mouseDown("day3selector");}); > > $("#day4selector").mousedown(function(){mouseDown("day4selector");}); > > $("#day5selector").mousedown(function(){mouseDown("day5selector");}); > > } > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > -- www.markpanay.com - Jargon Free Development www.labellife.com - Music Industry 2.0 www.tunecast.co.uk - Music for your website ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Rebind events on dynamic content (modified DOM)
You are calling BindTimeSelectors before the AJAX load is complete. Which AJAX load is the one that BindTimeSelectors depends on? Assuming it is the second one, you could code it like this: $("#daysheader").load( "ajax/weekview_headers.aspx?fromdate=" + calendarDay.Date ); $("#days").load( "ajax/weekview_appointments.aspx?fromdate=" + calendarDay.Date, BindTimeSelectors() ); Also, the code that wires up the events could be simplified considerably. Are you able to give each of those DOM elements a common class name? If they all have the class name "dayselector" then you could just code: function BindTimeSelectors() { //Wire up mouse down events to the day selectors. $(".dayselector").mousedown( function() { mouseDown( this.id ); } ); } If you can't do that, a simple loop would do the trick: function BindTimeSelectors() { //Wire up mouse down events to the day selectors. for( var i = 1; i <= 5; i++ ) { $( "#day" + i + "selector" ).mousedown( function() { mouseDown( this.id ); } ); } } > I'm loading some DIV in to a container DIV using AJAX... all > works like a charm. However, I need to bind some events to > the DIVs I'm dynamically loading in, no joy :( > > I guess I need to refresh the DOM somehow? > > My code looks like: > > $("#daysheader").load("ajax/weekview_headers.aspx?fromdate=" + calendarDay.Date); > $("#days").load("ajax/weekview_appointments.aspx?fromdate=" + calendarDay.Date); > BindTimeSelectors(); > > function BindTimeSelectors() > { > //Wire up mouse down events to the day selectors. > $("#day1selector").mousedown(function(){mouseDown("day1selector");}); > $("#day2selector").mousedown(function(){mouseDown("day2selector");}); > $("#day3selector").mousedown(function(){mouseDown("day3selector");}); > $("#day4selector").mousedown(function(){mouseDown("day4selector");}); > $("#day5selector").mousedown(function(){mouseDown("day5selector");}); > } ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Rebind events on dynamic content (modified DOM)
Hi Mike, Cheers for that. It turns out it was actually working as I had it, so perhaps it was the fact the ajax hadn't finished loading so I'll replace with your method. The simiplified event binding looks cool too, Cheers Tom On 8/17/06, Michael Geary <[EMAIL PROTECTED]> wrote: > You are calling BindTimeSelectors before the AJAX load is complete. > > Which AJAX load is the one that BindTimeSelectors depends on? Assuming it is > the second one, you could code it like this: > > $("#daysheader").load( "ajax/weekview_headers.aspx?fromdate=" + > calendarDay.Date ); > $("#days").load( > "ajax/weekview_appointments.aspx?fromdate=" + calendarDay.Date, > BindTimeSelectors() > ); > > Also, the code that wires up the events could be simplified considerably. > Are you able to give each of those DOM elements a common class name? If they > all have the class name "dayselector" then you could just code: > > function BindTimeSelectors() > { > //Wire up mouse down events to the day selectors. > $(".dayselector").mousedown( function() { mouseDown( this.id ); } ); > } > > If you can't do that, a simple loop would do the trick: > > function BindTimeSelectors() > { > //Wire up mouse down events to the day selectors. > for( var i = 1; i <= 5; i++ ) { > $( "#day" + i + "selector" ).mousedown( function() { mouseDown( > this.id ); } ); > } > } > > > I'm loading some DIV in to a container DIV using AJAX... all > > works like a charm. However, I need to bind some events to > > the DIVs I'm dynamically loading in, no joy :( > > > > I guess I need to refresh the DOM somehow? > > > > My code looks like: > > > > $("#daysheader").load("ajax/weekview_headers.aspx?fromdate=" + > calendarDay.Date); > > $("#days").load("ajax/weekview_appointments.aspx?fromdate=" + > calendarDay.Date); > > BindTimeSelectors(); > > > > function BindTimeSelectors() > > { > > //Wire up mouse down events to the day selectors. > > $("#day1selector").mousedown(function(){mouseDown("day1selector");}); > > $("#day2selector").mousedown(function(){mouseDown("day2selector");}); > > $("#day3selector").mousedown(function(){mouseDown("day3selector");}); > > $("#day4selector").mousedown(function(){mouseDown("day4selector");}); > > $("#day5selector").mousedown(function(){mouseDown("day5selector");}); > > } > > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Plugin for browser's "Go Back" button and "bookmark"
> I have made a plugin that helps you make your Ajax-driven page > available for "Go Back" button and "bookmark" of browser. This is effing sweet. Thanks, Taku! ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Can jQuery SVN get / set element dimensions?
> Or maybe a better way (having left, right, top etc as methods): > > // set left, top and height (chain not broken) > $("#myelement").left("12px").top("-2em").height("6em"); > // get width (chain broken) > var width = $("#myelement").width(); Have you tried this yet? It works, verbatim. :-) All those methods are detailed in the new docs (temporary URL): http://john.jquery.com/jquery/docs/ --John ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Plugin for browser's "Go Back" button and "bookmark"
You my friend are a GENIUS!!! I need this sort of thing for a project I'm building using jQuery! Wonderful! -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Taku Sano (Mikage Sawatari) Sent: Thursday, August 17, 2006 9:43 AM To: jQuery Discussion. Subject: [jQuery] Plugin for browser's "Go Back" button and "bookmark" I have made a plugin that helps you make your Ajax-driven page available for "Go Back" button and "bookmark" of browser. See the sample page: http://www.mikage.to/jquery/jquery_history.html ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery vs Prototype
Thanks to all who responded. I'm already impressed by the bright and active community rallying around this thing. For that reason, and because it makes my code look so gosh darned pretty, I'm leaning toward jQuery at this point. Oh yeah, and also because of the Devo hat logo. It just does it for me. Hey John, if you ever get tired of the "New Wave _javascript_" tagline, how about "Whip Your Scripts Into Shape"? From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Matt Stith Sent: Wednesday, August 16, 2006 4:54 PM To: jQuery Discussion. Subject: Re: [jQuery] jQuery vs Prototype Im with Jonathan on this one. jQuery is the only library ive ever used, and its done everything ive ever needed. On 8/16/06, Jonathan Sharp < [EMAIL PROTECTED]> wrote: I would agree with Corey. We've been using jquery in a large scale application. We evaluated jquery and prototype a while back but were forced to start prototyping ui's quickly and so we picked jquery and figured we'd re-evaluate when implementation began. We've never re-evaluated since there has never been a need. We went from the prototype to implementation phase faster than planned and have been able to develop robust components with amazing speed. (One example of a component is http://jdsharp.us/code/jd_Menu/jd_Menu.html) I can't speak to prototype since I haven't used it extensively, so let's just say that jquery has never given me a reason to look anywhere else. Great work John! -js On 8/16/06, Corey Jewett <[EMAIL PROTECTED]> wrote: You'd be surprised at how much functionality jQuery packs into such a small package. I used to use prototype, but I've switched to jQuery completely. Maybe the largest piece of functionality you'll give up is access to some of the other stuff that leverages prototype (e.g. scriptaculous). However jQuery has a thriving plugin community that's rapidly expanding the quite of bolt-on goodness. My main reason for switching to jQuery is it's terseness and expressiveness. The chainable method strategy often results in being 50-75% shorter code than equivalent prototype code. There's some examples documenting this phenomena on the jQuery blog. For me terser, more expressive code is not only more productive, but more readable and easier to debug. Corey On Aug 16, 2006, at 12:51 PM, Menier, Todd wrote: > Hello, > > I'm new to this mailing list and have recently begun the process of > evaluating jQuery. After looking at a wide variety of _javascript_/ > Ajax libraries, I've narrowed my choices down to jQuery and > Prototype. Though I understand there's nothing stopping me from > using both, there's lots of overlapping functionality from what I > can tell and I'd prefer to pick one as my primary solution. > > > > I'm having a hard time finding good information that directly > compares the 2 libraries. I assume the in exchange for the much > smaller file size, I'd be giving up a good deal of functionality by > going with jQuery. I've begun going through what documentation and > articles do exist in an attempt to put my own comparison together, > but I was wondering if anyone who has experience with both > libraries could provide a broad overview of their main differences? > > > > Thanks! > > Todd > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery vs Prototype
> Oh yeah, and also because of the Devo hat logo. It just does it for me. Hey > John, if you ever get tired of the "New Wave Javascript" tagline, how about > "Whip Your Scripts Into Shape"? Haha! I like that a lot :-) Maybe that'll be the tag line for the re-launched site. Or maybe something like "Whipping Javascript into Shape." I like those a lot :-) --John ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Can jQuery SVN get / set element dimensions?
> The problem is if you want the dimensions of an element that is not > positioned via CSS, i.e. to get the left position: True - and a request for it is already in the bug tracker. However, it's just not going to happen before 1.0 proper - it's in a feature freeze right now. --John ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Can jQuery SVN get / set element dimensions?
On 17/08/06, John Resig <[EMAIL PROTECTED]> wrote: > > Or maybe a better way (having left, right, top etc as methods): > > > > // set left, top and height (chain not broken) > > $("#myelement").left("12px").top("-2em").height("6em"); > > // get width (chain broken) > > var width = $("#myelement").width(); > > Have you tried this yet? It works, verbatim. :-) > > All those methods are detailed in the new docs (temporary URL): > http://john.jquery.com/jquery/docs/ > > --John > The problem is if you want the dimensions of an element that is not positioned via CSS, i.e. to get the left position: var left = el.offsetLeft; do { el = el.offsetParent, left+= el.offsetLeft, top+= el.offsetTop; } while (el.offsetParent); I think offsetLeft (and offsetTop, offsetWidth, offsetHeight) are supported by all those browsers jQuery works with - as el.y and el.x are for Netscape 4. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Can jQuery SVN get / set element dimensions?
On 17/08/06, John Resig <[EMAIL PROTECTED]> wrote: > > The problem is if you want the dimensions of an element that is not > > positioned via CSS, i.e. to get the left position: > > True - and a request for it is already in the bug tracker. However, > it's just not going to happen before 1.0 proper - it's in a feature > freeze right now. > > --John > I suppose it could be implemented as a plugin (until it makes it into 1.1). I do make an assumption that looping through the offsetParent's works across all modern browsers - I can only really test on what is available on Windows (so no Safari, Konqueror etc). ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Plugin for browser's "Go Back" button and "bookmark"
This is really nice :-) As with all back-button plugins, though, they seem to die with Safari. Here are my results when testing with it: Safari 2.0.4: A link is clicked and you are taken to a garbled version of the URL, for example: jquery_history.html#%232 for link #2. The AJAX content does not load (unfortunately), however hitting the back button does change the URL back to its previous state. Safari Nightlies: Virtually identical behavior, however instead of a corrupted URL string, it looks as it should (e.g. "#2"). So, in reality, the only major issue is getting the dynamic content to load in Safari since everything else appears to work. Great job! --John On 8/17/06, Taku Sano (Mikage Sawatari) <[EMAIL PROTECTED]> wrote: > I have made a plugin that helps you make your Ajax-driven page > available for "Go Back" button and "bookmark" of browser. > > See the sample page: http://www.mikage.to/jquery/jquery_history.html > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > -- John Resig http://ejohn.org/ [EMAIL PROTECTED] ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Can jQuery SVN get / set element dimensions?
> I suppose it could be implemented as a plugin (until it makes it into 1.1). > > I do make an assumption that looping through the offsetParent's works > across all modern browsers - I can only really test on what is > available on Windows (so no Safari, Konqueror etc). As far as I know, those properties work in all browsers that jQuery supports. If you wanna work on it, then you're more than welcome to. I was going to have functions like the following: .leftFromParent() .leftFromDocument() .leftFromWindow() .topFromParent() .topFromDocument() .topFromWindow() Or maybe that can be shortened to .topParent() .leftDocument() ? This way .top() and .left() will still return the un-touched CSS property (if it's needed). Let me know how this sounds to you. --John ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] $(this).getAttribute("href") Doesn't work
hey , I found a solution that works correctly. try this.. $.attr($('a').get(0),'href') 100% works its called by first value is object, then 2nd value is attribute -- Nilesh B. Patel Contact: 704.723.6427 website: www.n-bp.com ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] date picker plugin update
Jörn Zaefferer schrieb: >> $("input.mydate").datePicker({format:'mm/dd/', startdate:'08/15/2006', >> enddate:'08/31/2006'}); >> > > Yeah! That would be much better! This way you could create several date > pickers at once, without having to configure which class is used to mark the > date field. And it would be possible to use several date pickers on a page > with different settings, something currently not possible, as far as I get > it. > > Maybe further feature requests should be branched into a new plugin. I guess > its nice to have it simple to use and small. On the other hand, its not able > to select a birthdate etc. > > -- Jörn > > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > Great plugin, here are a few suggestions: Make the textfield read-only. Whats the point in having a date picker, when the user still can put unwanted date in the textfield :-) I would also prefer a way to go faster through the dates, so a 3 month -next/prev 6 month next/prev would be great. Michael ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Can jQuery SVN get / set element dimensions?
On 17/08/06, John Resig <[EMAIL PROTECTED]> wrote: > > I suppose it could be implemented as a plugin (until it makes it into 1.1). > > > > I do make an assumption that looping through the offsetParent's works > > across all modern browsers - I can only really test on what is > > available on Windows (so no Safari, Konqueror etc). > > As far as I know, those properties work in all browsers that jQuery > supports. If you wanna work on it, then you're more than welcome to. I > was going to have functions like the following: > > .leftFromParent() > .leftFromDocument() > .leftFromWindow() > > .topFromParent() > .topFromDocument() > .topFromWindow() > > Or maybe that can be shortened to .topParent() .leftDocument() ? This > way .top() and .left() will still return the un-touched CSS property > (if it's needed). Let me know how this sounds to you. > > --John > Would leftFromParent simply be 'el.offsetLeft'? What is the difference between leftFromDocument and leftFromWindow? ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] date picker plugin update
> Make the textfield read-only. Whats the point in having > a date picker, when the user still can put unwanted > date in the textfield :-) Picking and validating are separate operations. I know my birthday and can type it faster than I can pick it. Pickers are useful when you know you want a Friday in September but don't know the dates. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Can jQuery SVN get / set element dimensions?
> Would leftFromParent simply be 'el.offsetLeft'? Yep! > What is the difference between leftFromDocument and leftFromWindow? A document is positioned within a window. For example, I'm typing this in Gmail and the document is 1500px tall (just a guess) while my browser window is only 1200px tall - causing a scrollbar to appear. So, this is important for many dynamic applications, because you need to know exactly where an element is visible to the user. Oh - I also remembered the result of the features that I was going to do: $(window).width()/.height() $(document).width()/.height() $(document).left()/.top() = The scroll offset of the document $(window).left()/.top() = The position of the window on the screen Also, it'd be really nice to have associated convenience methods for "bottom" and "right". Just some more to chew on. --John ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Can jQuery SVN get / set element dimensions?
> .leftFromParent() > .leftFromDocument() > .leftFromWindow() These seem to be crying out "Please parameterize my From part!" :) Maybe something like this: $("#mydiv").pxLeft(item) That would tell you how many pixels to the left #mydiv is from the given item, which should be an ancestor DOM element or perhaps some special string values like "window"; no item could be interpreted as "document" or "parent" or whatever seems most reasonable. If item is an element that is not an ancestor it would return undefined--unless there's some reasonable way to figure out the relationship? ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery vs Prototype
> Haha! I like that a lot :-) Maybe that'll be the tag line for the > re-launched site. Or maybe something like "Whipping Javascript into > Shape." I like those a lot :-) Or "Give the past the slip" heh. -p@ -- ᗷɭoℊẚᗰսɳᑯѲ⁈⁈⁈ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery vs Prototype
>> Haha! I like that a lot :-) Maybe that'll be the tag line for the >> re-launched site. Or maybe something like "Whipping Javascript into >> Shape." I like those a lot :-) > Or "Give the past the slip" Song before "Whip It" on Devo's Freedom of Choice album describes my code: "It's Not Right" :) ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Can jQuery SVN get / set element dimensions?
> $("#mydiv").pxLeft(item) It'd actually be not that bad. Something like: $( elementA ).posLeft( elementB ); is equivalent to: $( elementA ).posLeft( document ) - $( elementB ).posLeft( document ); and .posLeft() could return the positioni relative to the parent, by default. So, that would mean that there would be .posLeft(), .posTop(), .postRight(), .posBottom() and each would take any of the following parameters: window, document, an element, an expression (matching the first element, and comparing against it), or nothing (aka: the parent) I'm liking this more and more :-) --JOhn ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Multiple $(document).ready()'s...
Let's say I am creating a set of code snippets that end users will have the ability to place in various locations throughout a site. I'd like to keep all the code for a specific snippet in a single file. But if several of those snippets use jquery, that means I'll potentially have several $(document).ready()'s in a single page. Is that bad? Or does it not matter... Thanks, Jason -- View this message in context: http://www.nabble.com/Multiple-%24%28document%29.ready%28%29%27s...-tf2122871.html#a5856114 Sent from the JQuery forum at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Multiple $(document).ready()'s...
nm, found the answer in the archives. apologies for the clutter. - jason Jason Huck wrote: > > Let's say I am creating a set of code snippets that end users will have > the ability to place in various locations throughout a site. I'd like to > keep all the code for a specific snippet in a single file. But if several > of those snippets use jquery, that means I'll potentially have several > $(document).ready()'s in a single page. Is that bad? Or does it not > matter... > > Thanks, > Jason > > > > -- View this message in context: http://www.nabble.com/Multiple-%24%28document%29.ready%28%29%27s...-tf2122871.html#a5856191 Sent from the JQuery forum at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Multiple $(document).ready()'s...
Hi Jason, Just simply add an Init function to each file and then call each one from a single document.ready. Hope this helps. Tom On 8/17/06, Jason Huck <[EMAIL PROTECTED]> wrote: > > Let's say I am creating a set of code snippets that end users will have the > ability to place in various locations throughout a site. I'd like to keep > all the code for a specific snippet in a single file. But if several of > those snippets use jquery, that means I'll potentially have several > $(document).ready()'s in a single page. Is that bad? Or does it not > matter... > > Thanks, > Jason > > > > -- > View this message in context: > http://www.nabble.com/Multiple-%24%28document%29.ready%28%29%27s...-tf2122871.html#a5856114 > Sent from the JQuery forum at Nabble.com. > > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Form Handling
Another newbie question. I was looking at some cool form handling features of prototype (about half-way down this article: http://www.sitepoint.com/print/painless-_javascript_-prototype) and was trying to figure out jQuery has similar features. I'm a little confused – I see the form plugin referenced from http://proj.jquery.com/plugins does some of what I'm looking for (such as serialize), but it also looks like some (maybe all?) of this functionality is already baked into the core jQuery library. Is this just simply not documented yet? Is there a good current overview of the latest built-in form handling features? 2 specific functions of prototype that I think look particularly useful are Form.Observer and Form.EventObserver. The former checks all form fields at a specified periodic interval and calls a specified callback if anything changes. The latter is similar only it listens for all relevant change events (onchange, onclick) of all form fields rather than polling at intervals. Does the core jQuery and/or an existing plugin have a similar feature? Sorry if I completely missed it - I dug around a bit and didn't find anything. Also, until the new site is launched, is proj.jquery.com the place to go (rather than jquery.com) for the most current info and documentation? Thanks! Todd ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Can jQuery SVN get / set element dimensions?
John, $().height(), $().width() and others doesn't work, just because of small mistype in jQuery.each( jQuery.macros.css, function(i,n){ jQuery.fn[ i ] = function(h) { // <- must be jQuery.fn[ n ] :) return h == undefined ? ( this.length ? jQuery.css( this[0], n ) : null ) : this.css( n, h ); }; }); ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Another Easy Dom creation for JQuery
I'm using Another Easy DOM creation extension... http://mg.to/2006/02/27/easy-dom-creation-for-jquery-and- prototype#comment-176 to dynamically create a section from a JSON request... $.tpl(pArray, function(){ return [ 'address',{'class':"vcard"},[ 'span',{'class':"fn"}, [this.FIRST_NAME+' '+this.LAST_NAME], 'span',{'class':"org"}, [this.SEARCH], 'a',{'href':"mailto:"+this.EMAIL,'class':"email"}, [this.EMAIL], 'span',{'class':"tel"}, [this.PHONE_NUMBER], 'span',{'class':"url"}, ['a',{'href':this.URL}, [this.URL]] ]]; }).appendTo('#section-'+sec); For some reason, it's adding an extra attribute called classname... ... ...to all the elements. I can't seem to figure out why it's doing this. Does anybody have an idea? Thanks, Madison ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Any IE6 related input element changes recently?
In Internet Explorer 6, via MS Script Editor [during a debug]: > document.getElementsByTagName("input") {...} length: 20 > $("input").size() 0 It works normally in firefox, so i don't understand why it doesn't in IE5. I thought jquery used getElementsByTagName internally when it could. I'll keep digging, I was curious if anybody else got this error. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Multiple $(document).ready()'s...
Tom Holder schrieb: > Hi Jason, > > Just simply add an Init function to each file and then call each one > from a single document.ready. Hope this helps. This is absolutely not necessary. You can have as much $(document).ready as you want in different plazes. The event handler functions are queued. -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] New to jquery - how do I...
I wanted to solicit help here to jump-start my first jquery development... I've some experience with prototype.js, and would like to start a small project using jquery. main content A re-engineering of your current world view will reaffirm your online presence enabling a more effervescent solution. Upscaling voluminous networking exchange solutions will result in your achieving an excellent systemic electronic data interchange synchronization, thereby exploiting technical environments for mission critical broad-based capacity-constrained systems. I'd like to make the 2nd cell, which is as tall as the first cell, into a mouse-grabbable handle which can be used to control the width of the first cell. I should research this further, any pointer in the right direction with jQuery is appreciated. Sam ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Rebind events on dynamic content (modified DOM)
Michael Geary schrieb: > You are calling BindTimeSelectors before the AJAX load is complete. > > Which AJAX load is the one that BindTimeSelectors depends on? Assuming it is > the second one, you could code it like this: > > $("#daysheader").load( "ajax/weekview_headers.aspx?fromdate=" + > calendarDay.Date ); > $("#days").load( > "ajax/weekview_appointments.aspx?fromdate=" + calendarDay.Date, > BindTimeSelectors() > ); I think it should read: $("#days").load( "ajax/weekview_appointments.aspx?fromdate=" + calendarDay.Date, BindTimeSelectors ); -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Improvements in Ajax facilities - error handling?
Andy Matthews wrote: > > Speaking of errors... > > That's one thing I've really wanted. When using jQuery, I've noticed that > assuming all of the syntax is valid, if you run code that doesn't work, > nothing happens. No error message, nothing. > > That makes debugging quite difficult because you have no idea where to > start. > > Is there any way that jQuery could generate SOME sort of error, a default > alert box maybe) with error information? > > That would be stellar. Maybe I'm just too knew to jquery to understand how to go about debugging, but I keep running into this problem (since my newbie code is usually wrong, even if syntactically correct). The only error I ever see in the console is "f has no properties", jquery.js line 14, which obviously isn't my code. :P Cheers, Jason -- View this message in context: http://www.nabble.com/Improvements-in-Ajax-facilities-tf2119204.html#a5858298 Sent from the JQuery forum at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Error in current jquery version
Hallo, I have tried to use jquery for a current project. To test it, I have created following code:< html>JSON-Test title>