[jQuery] Re: :visible fails in MSIE8 (in a ThickBox)
This is (finally) fixed in latest SVN and will be in jQuery 1.3.3. -- Brandon Aaron On Fri, Jun 26, 2009 at 1:50 PM, Nekura Neko wrote: > > Okay, so jQuery 1.3.2 defines the visible filter like this: > > Sizzle.selectors.filters.visible = function(elem){ > return elem.offsetWidth > 0 || elem.offsetHeight > 0; > }; > > Now I've got a table of hidden (style="display: none") rows. The user > will click something that will .show() a specific row, and the whole > table -- along with a lot of other stuff -- will be displayed in a > lovely thickbox. > > The problem is that MSIE 8 assigns offsetWidths and offsetHeights to > the rows; even those with "display: none" active on them. In > "compatibility mode," MSIE will set the offsetHeight to 0, but there > will still be an offsetWidth. > > Firefox doesn't have this problem; Chrome doesn't have this problem. > > I'm not sure if MSIE got wildly confused by moving hidden rows into a > thickbox. I know I've broken MSIE's rendering of other similar tables > on the page, but I doubt those have anything to do with jQuery. > > I've gotten around it by using .addClass and .removeClass and > filtering on that new class instead of :visible, but I'd rather know > that :visible is working as intended in the long run. > > Cheers, > JM (wanders off to lunch)
[jQuery] Re: question re: .live() and .empty()
The .live() method binds event handlers at a higher level than the node(s) selected. So, in other words the events aren't actually bound to specific nodes so they won't be removed when you call empty. If you need to remove a live event, just call .die(). It is like .unbind() but for .live() events. http://docs.jquery.com/Events/die#typefn -- Brandon Aaron On Fri, May 29, 2009 at 10:06 PM, Jack Killpatrick wrote: > > I'm guessing that once a .live() instantiation occurs it's there for good. > If that's the case, is there a way to destroy it? (in particular as it > pertains to a selector). > > I'm debating using it in a plugin, but am wary because of what could happen > with multiple instances of the plugin and maybe no ability to destroy it > completely. > > Thanks, > Jack > > Jack Killpatrick wrote: >> >> Hi All, >> >> Wondering if someone knows the answer to this: >> >> Using jQuery 1.3.2, if some items inside a div have events bound to them >> via .live() and then .empty() is called on the div will the events that were >> bound via .live() get removed? The .empty() doc says: >> >> http://docs.jquery.com/Manipulation/empty >> >> Note that this function starting with 1.2.2 will also remove all event >> handlers and internally cached data. >> >> But something I'm working on makes me think that the .live() events are >> not removed. I haven't nailed it down yet. >> >> Thanks, >> Jack >> >> > > >
[jQuery] Re: Reverse a collection of jQuery elements.
$.fn.reverse = [].reverse; $('#some_selector').parents('li').reverse(); :) -- Brandon Aaron On Wed, May 27, 2009 at 4:51 PM, simshaun wrote: > > I need to reverse the collection jQuery returns when I use > > $("#some_selector").parents("li"); > > in order to build a path. > > Is this doable? It'd be nice if jQuery had a reverse() method. >
[jQuery] Re: scrollTop on jQuery object
There are two ways to get the DOM element out of the jQuery object. Assuming $msgs from your code example, you could get the first message as a DOM element like this: var msg = $msgs.get(0); // or var msg = $msgs[0]; // then get scrollHeight msg.scrollHeight -- Brandon Aaron On Mon, May 18, 2009 at 12:36 PM, Arrviasto wrote: > > Hi! > I have to use scrollTop and scrollHeight properties, but on jQuery > object it returns `undefined`. Is there any method to get this > property from jq object? > > It doesn't matter, but my object looks like this: > > var $win = $(this) // div on my page > var $msgs = $win.find('.msgs'); > > > $msgs.scrollHeight returns 'undefined' > > Thanks, > Arrviasto (Poland) >
[jQuery] Re: Events - Live -v- Livequery
Only Live Query supports calling a function when an element is matched (or unmatched). If you need this functionality, then you'll need to stick with Live Query. -- Brandon Aaron On Mon, May 18, 2009 at 9:58 AM, Meander365 wrote: > > Hi all, > > I normally do this with livequery: > > $('.mylink').livequery(function(event) { > $(this).mycustomFunction(); > }); > > So any new .mylink's on a page would also be bound with my custom > function. > > How can I do this with the new LIVE event? or is it even possible? > > Thanks in advance! > >
[jQuery] Re: Best book to learn jQuery?
On Mon, May 18, 2009 at 8:35 AM, Karl Swedberg wrote: > I've heard Learning jQuery 1.3 is a great read, too. ;-) HAHAHA... I think you forgot your disclaimer. :p Karl is a co-author of Learning jQuery. Nonetheless, Learning jQuery 1.3 would be a great choice. :) -- Brandon Aaron
[jQuery] Re: jQuery-way for filtering self + all children
Yeah, I see what you mean. What about .findAndSelf(selector)? Trying to stick with existing naming conventions... Do you have some sample scenarios to go along with this need? Like actual HTML, etc. Would you mind filing a new enhancement ticket for this? http://dev.jquery.com/newticket -- Brandon Aaron On Mon, May 4, 2009 at 6:57 PM, Pappy wrote: > > While it will be nice to pass in a selector to andSelf, it's a shame > you'll have to repeat the selector in both the 'find' and 'addSelf'. > I'd still rather there be only one function necessary. It's an > awfully common pattern. Honestly, I wish 'find' had been this way > from the start, and there was a descendants function that works like > 'find' today... it seems much more sane to me. > > Hmm... other possible interfaces/names - > jObject.search(selector) > jObject.findAll(selector) > jObject.findInclusive(selector) // my favorite > jObject.find(selector, "andSelf") > > On May 4, 4:47 pm, Brandon Aaron wrote: > > FYI... There is an open enhancement ticket that proposes adding an > optional > > selector to the .andSelf() method.http://dev.jquery.com/ticket/4446 > > -- > > Brandon Aaron > > > > On Mon, May 4, 2009 at 5:11 PM, Pappy wrote: > > > > > Just curious... what's the jQuery-way of saying "Give me all children > > > that match a filter and include myself if I happen to match as well."? > > > > > I've been using - > > > > > element.find("*").andSelf().filter([myfilter]) > > > > > but that seems kludgy. Is there a better way? If not, I'll just wrap > > > this as "findInclusive" or "find([filter], true)" or something. >
[jQuery] Re: jQuery-way for filtering self + all children
FYI... There is an open enhancement ticket that proposes adding an optional selector to the .andSelf() method. http://dev.jquery.com/ticket/4446 -- Brandon Aaron On Mon, May 4, 2009 at 5:11 PM, Pappy wrote: > > Just curious... what's the jQuery-way of saying "Give me all children > that match a filter and include myself if I happen to match as well."? > > I've been using - > > element.find("*").andSelf().filter([myfilter]) > > but that seems kludgy. Is there a better way? If not, I'll just wrap > this as "findInclusive" or "find([filter], true)" or something.
[jQuery] Re: Loading before dom = ready - Best Practices.
On Thu, Apr 23, 2009 at 3:42 PM, Adam wrote: > > On Apr 23, 2:57 pm, Brandon Aaron wrote: > > You could use $.getScript to load in the slow loading scripts. Any > scripts > > loaded this way will be non-blocking (asynchronous). > > -- > > Brandon Aaron > > > That could certainly cut down some of the time, but I suspect there's > same-origin policy limitations here? > Nope. http://docs.jquery.com/Ajax/jQuery.getScript#urlcallback -- Brandon Aaron
[jQuery] Re: Loading before dom = ready - Best Practices.
You could use $.getScript to load in the slow loading scripts. Any scripts loaded this way will be non-blocking (asynchronous). -- Brandon Aaron On Thu, Apr 23, 2009 at 2:13 PM, hedgomatic wrote: > > While virtually every site in existence trumpets using the jQuery DOM- > ready shortcut as an absolute must, I've come across situations which > I feel frustrate the user, particularly when using jQuery to create a > navigational element. > > I often work on sites which are going to have a lot of external > content (ads, feeds, analytics), and if even one of them is sluggish > to load, none of my interactive elements are responsive for that time. > > There seem to be three options: > > 1] liveQuery (disadvantage: overhead) > 2] popping a loading message over the whole page (disadvantage: > ridiculous) > 3] nesting an image inside the portion of the DOM we need, and using > an onLoad event (disadvantage: poor semantics). > > > Anyone else come across any novel ways around this seemingly under- > discussed issue? > > >
[jQuery] Re: Questions about $.live, Live Query and performance
LiveQuery when used for events does not use event delegation. It binds the event directly to the matched elements. The reason the latest version of LiveQuery depends on 1.3.x is to take advantage of some internal changes to jQuery, not because it uses live. The live method in jQuery uses event delegation. If you use LiveQuery *a lot* then you will most likely see slow downs. Live Query tries to be non-invasive about its operations but if it is a large dom with lots of queries, then it will be slow. You can minimize these affects by using a context and good selectors. The reason to use LiveQuery over live is if you need to do something more than bind an event or if event delegation just doesn't work for the event you are binding. Otherwise you should use live if you need to bind events to a large number of dom elements that may or may not be in existence at runtime. If it is a small number of elements and they exist at runtime then you should still use bind. -- Brandon Aaron On Sun, Apr 19, 2009 at 11:16 AM, Geoffrey wrote: > > $.live and Live Query are both wonderful. I am hoping to put them to > extensive use in my projects. > > I have a few questions about $.live and Live Query and their effect on > performance. > > Background: If I recall correctly, the original release of Live Query > could have some performance problems. I don't remember if things > bogged down when the DOM had a lot of elements, when you added a large > number of Live Query events, did a lot of updating or exactly what. > > Question 1: > What were the specific concerns around performance with the 1.0.x > releases of Live Query? > > Now with jquey 1.3, there is $.live. $.live does not do everything > that Live Query does, but does do some of it. > > Question 2: > Does $.live use a different technique for handling events than Live > Query? > > Question 2a: > If it is different, are there any performance concerns using $.live > like there used to be with Live Query? > > Live Query 1.1.x requires jquery 1.3. I am guessing that the new > version uses $.live internally. > > Question 3a: > Is the performance of Live Query better in the 1.1.x version? > > Question 3b: > Are there some selectors that have better performance than others? or > to say it another way, do all of the selectors perform the same or, > for example, does > $('input').livequery('click', function() { }); > perform better than > $('input').livequery('change', function() { });? > > Using $.live or Live Query. > Question 4: > Is there any difference in performce between using > $('input').livequery('click', function() { }); > vs > $("input").live("click", function(){ });? > > > I am thinking of really diving in to using $.live and/or Live Query. I > am trying to get a complete understanding of all of the issues that > may arise. > > Thanks > -Geoff > > > >
[jQuery] Re: Minified and Gzip?
Here is what I've added to my Apache Config to support mod_deflate of my html, css and js. I just dropped this in at the bottom of my httpd.config. # Create the output filter SetOutputFilter DEFLATE # Netscape 4.x has some problems BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.06-4.08 have some more problems BrowserMatch ^Mozilla/4.0[678] no-gzip # MSIE masquerades as Netscape, but it is fine BrowserMatch bMSIE !no-gzip !gzip-only-text/html ## Don't compress for IE5.0 BrowserMatch "MSIE 5.0" no-gzip # Don't compress images, flash, PDFs SetEnvIfNoCase Request_URI.(?:gif|jpe?g|png|swf|pdf)$ no-gzip dont-vary # Make sure proxies don't deliver the wrong content Header append Vary User-Agent env=!dont-vary Hope that helps... -- Brandon Aaron On Tue, Feb 17, 2009 at 7:00 PM, ScottChiefBaker wrote: > > How do I setup JQuery to be server Gzipped? Using apache I installed > mod_deflate and set it up to serve .js files as gzipped, but it > doesn't seem to be working. Does anyone have any example > configurations I could steal from? > > - Scott >
[jQuery] Re: Why does $.width return innerWidth but set outerWidth?
This isn't the normal behavior. Could you create a test case for this? -- Brandon Aaron On Fri, Feb 13, 2009 at 5:07 AM, [rob desbois] wrote: > > Hi all, > > I was just writing a bit of JS to set the width of some buttons to the > width of the largest. > While doing this I found that the largest one would shrink! > > Doing this in a debugger gives: > $("#x").width(); // 222 > $("#x").width(222); // makes element shrink > $("#x").width(); // 216 > > The number returned from $.width() is equal to the innerWidth() (at > least it is on my button, which has a border but no padding). > When you set it though, if you set it to the value returned, it will > shrink! It won't do this if you pass the return from $.outerWidth(). > > This seems backwards; I would never expect that passing the return of > a getter to its corresponding setter to change the return from the > getter! > > Can someone tell me if this is a bug or is by design - and if by > design, why? > TIA, > --rob >
[jQuery] Re: live Problem
Stick with Live Query but grab the latest version of Live Query from GitHub: http://github.com/brandonaaron/livequery/tree/master -- Brandon Aaron On Thu, Jan 29, 2009 at 7:59 PM, Pedram wrote: > > Dear FOlk , > I'm going to upgrade my liveQuery code , I figured out that LIVE in > jQuery 1.3.1 doesn't Support Focus and Blur and also it doesn't > support the no-event Style callback that liveQuery provides... > what is the solution. >
[jQuery] API Browser for your iPhone and iPod Touch
I wrote an API Browser as a "Web App" for the iPhone and iPod touch. It downloads the docs to a local sqlite database for quick browsing of the API. It is basically a proof of concept right now (the code is ugly and a little buggy). However, if enough people like it I'll go ahead and take the time the polish it up and fix the quirks/bugs. Let me know what you think, how it performs, etc. BTW... If you add it to your home screen it will launch without the Safari chrome. Beware the first time you visit this site it will download the docs in XML format (368KB) and then store them in the database. So be patient, the setup screen will let you know what is going on and there will be a big "Continue" button that shows up once everything is done. http://brandonaaron.net/iphone/index.html One bug I know is fairly annoying is that if you click the back button to a long page it won't scroll. Just click back one more time and then go to that page again and it will magically scroll again. I tweaked the iUI framework to use CSS transforms for the slide animation and it seems to be causing the issue. -- Brandon Aaron
[jQuery] Re: I love jQuery fan logos
Cool! BTW... You can find the official jQuery and jQuery UI logos here: http://docs.jquery.com/Design_and_Identity :) -- Brandon Aaron On Fri, Jan 23, 2009 at 7:35 AM, chrispie wrote: > > hey, i love jQuery so i made some "i love jQuery" logos for blogs or > what ever. > be proud and be a fan ;) > > http://www.chrispie.de/apple/i-love-jquery-300/ >
[jQuery] Re: When to use LiveQuery plugin
What is the issue you are having? Which version of Live Query are you using? Try using the very latest/edge version of Live Query that you can download from github. http://github.com/brandonaaron/livequery/tree/master -- Brandon Aaron On Wed, Jan 21, 2009 at 12:15 PM, Rics wrote: > > Karl, > > There is a bug somewhere between JQuery 1.3 and LiveQuery Plugin. > I just can't put LiveQuery Plugin to work with JQuery 1.3. It's odd. > > I will use previous JQuery version until they implement all the > events. Untill there I need to use LiveQuery... > > =((( > > On 19 jan, 14:43, Karl Swedberg wrote: > > If you need to bind events that .live() currently doesn't handle, such > > as mouseenter, mouseleave, focus, blur, and change, you should keep > > Live Query around. In subsequent versions, .live() is supposed to > > handle these, but for now it doesn't. >
[jQuery] Re: When to use LiveQuery plugin
It really depends on how you are using LiveQuery. If you are using it only to bind events to new elements then you should switch over to live. That is unless one of the events you are binding is one of the event types that does not bubble. Check the documentation for the events that are currently not supported by live. http://docs.jquery.com/Events/live#typefn If you are using the function based livequeries then you should stick with LiveQuery and upgrade to the git version. http://github.com/brandonaaron/livequery/tree/master -- Brandon Aaron On Mon, Jan 19, 2009 at 10:23 AM, Terry wrote: > > Is it known when one might wish to continue to use the LiveQuery > plugin itself with version 1.3+ of the jQuery library? That is, if I > upgrade, is there any reason to keep the LQ plugin around? > > On Jan 14, 3:16 pm, MorningZ wrote: > > first off all... the purpose (and advantage of)LiveQueryis that > > when new matching items are added, they will automatically be wired > > up... > > > > secondly, one thing to look at is the just-released-today version of > > jQuery (1.3), it now has a ".live" handler that will effectively do > > what the plugin does > > > > http://docs.jquery.com/Events/live#typefn > > > > On Jan 14, 3:07 pm, ocptime wrote: > > > > > Hi all, > > > > > I had seen a new plugin called "LiveQuery" and i have some questions > > > that are not yet completely answered when i read its documentation. > > > > > I am using jquery.form.plugin, My questions is when to uselivequery > > > and what is it's advantages. > > > is it possible to uselivequeryin conjention with the form plugin. > > > > > can u pls cite me a small sample code or some pointers on the web > > > where both are used. > > > > > Thanks in advance > > > ocptime >
[jQuery] Re: $(' Expert jQuery & JS synatx ' ).show
It works by referencing the method with bracket or array notation. You can reference properties and methods of an object this way. For example: var obj = { test1: 'test_one', test2: 'test_two' }; alert( obj['test1'] ) // alerts test_one alert( obj.test1 ) // also alerts test_one The other code doesn't work because your aren't looking for a property on an object. To make it work you evaluate the expression and then call the method like this. (expr ? 'a' : 'a')(); However, since your function 'a' is global it is a method of the window. You could use bracket notation to reference the method like this. window[ (expr ? 'a' : 'a') ]() -- Brandon Aaron On Sun, Jan 18, 2009 at 9:48 PM, Ami wrote: > > Thank you. > It's working :) > > Can you put a function name in an array ?! > > May you explain me WHY it's working? >$('div')[ (true? 'next' : 'before') ]().hide() > > I tried also this: >function a() {alert('Function a')} >[expr ? 'a' : 'a']() > but it's didn't work. why? > > On Jan 19, 5:15 am, Brandon Aaron wrote: > > I believe you are looking for the following syntax: > > $(selector)[ (expr ? 'next' : 'before') ]().show(); > > > > -- > > Brandon Aaron > > > > On Sun, Jan 18, 2009 at 9:12 PM, Ami wrote: > > > > > Sorry about my grammar, English isn't my lang. > > > > > I am trying to write code like that: > > >var expr=true,selector='div'; > > >$(selector) (expr ? .next() : .before() ). show(); > > > > > But it's not JS syntax. So how can I do it? > > > > > I know,that I can do it like that: > > >if (expr) $(selector)..before(),show() else > > > $(selector).next().show() > > > > > But I am trying to find a solution, that return a jQuery object. > > > > > Thank you. >
[jQuery] Re: $(' Expert jQuery & JS synatx ' ).show
I believe you are looking for the following syntax: $(selector)[ (expr ? 'next' : 'before') ]().show(); -- Brandon Aaron On Sun, Jan 18, 2009 at 9:12 PM, Ami wrote: > > Sorry about my grammar, English isn't my lang. > > I am trying to write code like that: >var expr=true,selector='div'; >$(selector) (expr ? .next() : .before() ). show(); > > But it's not JS syntax. So how can I do it? > > I know,that I can do it like that: >if (expr) $(selector)..before(),show() else > $(selector).next().show() > > > But I am trying to find a solution, that return a jQuery object. > > Thank you. > >
[jQuery] Re: jQuery 1.3 + live/livequery + draggable problem
I'm currently using the SVN Trunk version of jQuery and jQuery UI and the sortables, which use drag and drop, are working for me. If you are willing to live on the edge, which I'm guessing you are since you are trying to use preview releases, you might want to try trunk to see if that fixes your issue. -- Brandon Aaron On Wed, Jan 7, 2009 at 9:28 PM, Richard D. Worth wrote: > I'm not sure you'll have success (yet) combining a (preview) released > version of jQuery UI 1.6 with a (preview) released version of jQuery 1.3. > Here's a summary > > jQuery UI 1.5.3 will only work with jQuery 1.2.6 (not 1.3) > jQuery UI 1.6 final will only work with jQuery 1.3 final (not 1.2.6) > > The problem is jQuery UI 1.6rc4 works only with 1.2.6. So we're in kind of > an in-between state. From now until that release is final, we're working on > switching over and testing against 1.3pre. That work is in jQuery UI trunk, > but not 1.6rc4. The plan is to release 1.6rc5 the day after 1.3 final is > released. It will be tested against and ship with 1.3. We'll have one week > of testing, then finalize jQuery UI 1.6. > > If you're interested, you're more than welcome to help us test the interim > scenario I've described above. It would mean checking out the jQuey UI > trunk. But should be simple otherwise as that contains the version of jQuery > 1.3pre we're testing against (r6065, a little later than 1.3b2 - r6056). > > - Richard > > > On Wed, Jan 7, 2009 at 5:29 PM, Joshua Uziel wrote: > >> Through the wonders of jQuery 1.2.6, jQuery UI 1.6rc2/4 and LiveQuery, I >> am able to make divs that are generated after the page load be draggable via >> something like so: >> >> $(".results_container").livequery(function() { >> $(this).draggable({ >> helper: 'clone', >> cursor: 'move', >> revert: 'invalid', >> start: function(ev, ui) { >> var title = $.trim( >> $(this).children("div.results_title").text() ); >> >> $(ui.helper).addClass("my_dragged").html(draggedObj) >> .data("title", title); >> } >> }); >> }); >> >> Now I'm trying to convert to jQuery 1.3b2 and haven't yet had any luck. >> My first step was to simply replace 1.2.6 with 1.3b2 and continue using >> LiveQuery. It feels like the events get registered, but when I drag, it >> seems as though the start function isn't being called (which is confirmed by >> setting Firebug breakpoints within the function that aren't triggered). >> >> I'd of course prefer to use the new $.live functionality, but can't figure >> out how. There are other events in my code that I register as: >> >> $(".foo").livequery("click", function() { ... >> >> that I can convert to >> >> $(".foo").live("click", function() { ... >> >> and they work both ways with 1.2.6 and 1.3b2. It's just that >> >> $(".foo").livequery(function() { $(this).draggable({ ... >> >> that I can't seem to get working either way (LiveQuery or $.live). >> Besides the helper not being generated, the drop event isn't caught either, >> so the whole drag & drop is broken. >> >> Anyone have any ideas? Thanks! >> > >
[jQuery] Re: How beneficial is chaining methods?"
Just a quick clarification on this. The this keyword within the "newMethod" plugin you just made is already the jQuery object. All you need to do is return this; -- Brandon Aaron On Wed, Dec 3, 2008 at 1:01 PM, 703designs <[EMAIL PROTECTED]> wrote: > > There's nothing special about chaining methods. You can do it in most > decent languages (in PHP, you could design methods to allow something > like: $toys->addNew("Block")->delete();) and all it involves is > returning an instance of the current object. It's not a performance > hit by any means. > > A chainable method, in jQuery, is written: > > $.fn.newMethod = function() { >// Function body... >return $(this); > } > > As you can see, all that's happening is "this" is being converted to a > jQuery object (defined by jQuery and its alias "$") and returned. > > Thomas > > On Dec 3, 1:54 pm, MorningZ <[EMAIL PROTECTED]> wrote: > > "I can see it saving time as there is less > > code to write; but on the flip side, I can see how it can becomes > > harder to manage especially if there is an excess amount chaining > > going on" > > > > That's your decision to make, and you can have the choice to do it one > > way or the other > > > > One advantage to doing this > > > > $("#Results").html("Some Text").show(); > > > > over this > > > > $("#Results").html("Some Text"); > > $("#Results").show(); > > > > would be that the script doesn't have to retrieve that wrapped set a > > second time > > > > On Dec 3, 12:55 pm, SLR <[EMAIL PROTECTED]> wrote: > > > > > I'm new to jQuery and I'm trying to learn some more about jQuery's > > > chaining feature. Chaining methods seems to be one of jQuery's best > > > features (at least this is how I see it described all over over the > > > web). > > > > > From a developer standpoint, I can see it saving time as there is less > > > code to write; but on the flip side, I can see how it can becomes > > > harder to manage especially if there is an excess amount chaining > > > going on. > > > > > Also, how does this affect performance? Does chaining use more, less, > > > or the same amount of resources? > > > > >
[jQuery] Re: Use of getBoxObjectFor() is deprecated. Try to use element.getBoundingClientRect() if possible.
What plugins are you using? getBoxObjectFor is a XUL method but getBoundingClientRect isn't available for older version of Firefox. I'd just suggest using the .offset() method from jQuery core. At any rate it is just a deprecation warning. I imagine whatever plugin uses it checks to see if it exists first and then uses it. When Firefox finally removes it, the code should jump to the next branch. Unless they did browser detection :( -- Brandon Aaron On Thu, Nov 27, 2008 at 9:40 AM, edzah <[EMAIL PROTECTED]> wrote: > > Searched around and found a old post here but there was no answer. > > Any idea what this is about and how I can squash it? > > Ed
[jQuery] Re: Hi all, jquery issue (major) with IE - all versions
It sounds like you might be trying to set css properties via the .attr method instead of the .css method. -- Brandon Aaron On Wed, Nov 26, 2008 at 10:23 AM, tukutela <[EMAIL PROTECTED]>wrote: > > Hi all, I have some additional information which I hope might be of > use. > > the function is passed the following variables: > name = color > value = inherit > > unfortunately I'm not able to get the elem to help out more, anyone > have any suggestions on how to debug? > > > On Nov 26, 9:42 am, tukutela <[EMAIL PROTECTED]> wrote: > > HI all, > > > > This only happens with IE (all versions), on line 1120 in > > jquery-1.2.6.js I get the following error. > > > > Line 1120: > > Invalid Property Value > > > > The line in the js file is the following: > > > > elem[ name ] = value; > > > > It inside attr: function( elem, name, value ) > > > > Does anybody have a problem similar to this? >
[jQuery] Re: table striping performance with livequery
When dealing with tables, event delegation is almost always the best way to handle it. You might want to give jQuery.listen plugin a try. http://plugins.jquery.com/project/Listen -- Brandon Aaron On Mon, Nov 24, 2008 at 8:36 AM, Carpii <[EMAIL PROTECTED]> wrote: > > Hi all, ive just started using jQuery, and also the livequery plugin > > I set up jQuery to automatically stripe a table, and also do a > mouseover to highlight the current row. > This works nicely, but I wanted to use it inside of a tabset which > loads its pages dynamically > > To do this I started using livequery to bind the events after the tab > is loaded. > > Ive noticed the performance of the row mouseover row highlight is now > pretty poor, and wondered if Im doing something wrong? > > Pretty trivial code > > $(document).ready(function() > { > $(".stripeMe tr") >.livequery('mouseover', function() { >$(this).addClass("over"); >}) >.livequery('mouseout', function() { >$(this).removeClass("over"); >}); > } > > Is there a reason this technique would degrade performance ? > > Thanks >
[jQuery] Re: livequery not binding to ajax loaded links in ie6 and ie7?
No worries! Glad you got it figured out and sorry I wasn't able to get back to you sooner. :) -- Brandon Aaron On Sat, Nov 15, 2008 at 2:39 PM, n00bert <[EMAIL PROTECTED]> wrote: > > Got it sorted. ie doesn't like the selector. Now using a different > method, but still with livequery. Sorry to have bothered you Brandon, > and thanks for such a powerful plugin. > > Sameer > > On Nov 14, 9:50 pm, n00bert <[EMAIL PROTECTED]> wrote: > > Hi Brandon, > > > > I've tried changing this code: > > > > $('#mainMenu ul li ul li a[href$="' + href + '"]').triggerHandler > > ('click'); > > > > to: > > > > $('#mainMenu ul li ul li a:first').triggerHandler('click'); > > > > in order to see if it was the selector that's causing the problem. It > > seems it is. The second line of code works as expected in ie6 and ie7. > > > > Is there another way of selecting a link with a href that matches the > > clicked link's href? > > > > Thanks, > > > > Sameer > > > > On Nov 14, 3:31 pm, n00bert <[EMAIL PROTECTED]> wrote: > > > > > Hi Brandon, > > > > > no errors in ie at all. I've uploaded the site I'm working on > athttp://rosiespencer.co.ukWhenit loads, click a small thumb. The menu > > > should slide down and the contents of #content are replaced via ajax. > > > Some larger thumbs appear. This is where it breaks in ie. In other > > > browsers if you click one of the bigger thumbs, #content is replaced > > > as expected. > > > > > Thanks again for your help, > > > > > Sameer > > > > > On Nov 14, 2:23 pm, "Brandon Aaron" <[EMAIL PROTECTED]> wrote: > > > > > > On Thu, Nov 13, 2008 at 10:26 PM, n00bert <[EMAIL PROTECTED]> > wrote: > > > > > > > Hi Brandon, > > > > > > > I put an alert in like so: > > > > > > > $('#content div.thumb a').livequery('click', function(e) { > > > > > alert ('clicked'); > > > > > e.preventDefault(); > > > > >var href = $(this).attr('href'); > > > > >$('#mainMenu ul li ul li a[href$="' + href + > '"]').triggerHandler > > > > > ('click'); > > > > >return false; > > > > > }); > > > > > > > Safari, Firefox and Opera all show the alert when clicked. ie6 and > ie7 > > > > > do not. In firebug, there are no errors. Any clues? > > > > > > But are there any errors in IE? > > > > > > -- > > > > Brandon Aaron >
[jQuery] Re: livequery not binding to ajax loaded links in ie6 and ie7?
On Thu, Nov 13, 2008 at 10:26 PM, n00bert <[EMAIL PROTECTED]> wrote: > > Hi Brandon, > > I put an alert in like so: > > $('#content div.thumb a').livequery('click', function(e) { > alert ('clicked'); > e.preventDefault(); >var href = $(this).attr('href'); >$('#mainMenu ul li ul li a[href$="' + href + '"]').triggerHandler > ('click'); >return false; > }); > > Safari, Firefox and Opera all show the alert when clicked. ie6 and ie7 > do not. In firebug, there are no errors. Any clues? But are there any errors in IE? -- Brandon Aaron
[jQuery] Re: livequery not binding to ajax loaded links in ie6 and ie7?
Well, to help debug the issue, try putting an alert within the click handler to make sure the click event is being bound and it isn't livequery causing the issue. Are you getting any script errors on the page? -- Brandon Aaron On Thu, Nov 13, 2008 at 10:04 PM, n00bert <[EMAIL PROTECTED]> wrote: > > Hi Brandon, > > thanks for your speedy reply. I added the $ as shown below. > Unfortunately, ie still doesn't recognise the links added to #content > as clickable. I know I'm pushing it, but do you have any other ideas > as to why this should be? > > Sameer > > > On Nov 14, 3:27 am, "Brandon Aaron" <[EMAIL PROTECTED]> wrote: > > It is most likely an issue with selecting the a tag by the href > attribute. > > Sometimes the href attribute gets serialized by IE. Try using the $= > > attribute selector ( > http://docs.jquery.com/Selectors/attributeEndsWith#attributevalue) to find > > that a tag. > > > > $('#mainMenu ul li ul li a[href$="' + href + > '"]').triggerHandler('click'); > > > > -- > > Brandon Aaron > > > > On Thu, Nov 13, 2008 at 9:13 PM, n00bert <[EMAIL PROTECTED]> > wrote: > > > > > Hi, > > > > > I have the following code: > > > > >//link is loaded via ajax into a div in #content > > > > >//when clicked find a link in #mainMenu with the same href and > > > trigger a > > > click on it > > >$('#content div.thumb a').livequery('click', function(e) { > > >e.preventDefault(); > > >var href = $(this).attr('href'); > > >$('#mainMenu ul li ul li a[href="' + href + > > > '"]').triggerHandler('click'); > > >return false; > > >}); > > > > >//some code for what happens when a menu link is clicked > > > > > which works well in Safari 3, Firefox 3, Opera 9 on both win and mac. > > > However, in ie6 and ie7 I'm guessing the click event is never bound > because > > > nothing happens if the link in a div in #content is clicked. > > > > > Can someone shed some light on this please? Perhaps internet explorer > is > > > not > > > recognising the selector which has a variable in it? Or is it a > livequery > > > issue? > > > > > I'm stumped. Thanks for any help, > > > > > Sameer > > > -- > > > View this message in context: > > >http://www.nabble.com/livequery-not-binding-to-ajax-loaded-links-in-i. > .. > > > Sent from the jQuery General Discussion mailing list archive at > Nabble.com. >
[jQuery] Re: livequery not binding to ajax loaded links in ie6 and ie7?
It is most likely an issue with selecting the a tag by the href attribute. Sometimes the href attribute gets serialized by IE. Try using the $= attribute selector ( http://docs.jquery.com/Selectors/attributeEndsWith#attributevalue ) to find that a tag. $('#mainMenu ul li ul li a[href$="' + href + '"]').triggerHandler('click'); -- Brandon Aaron On Thu, Nov 13, 2008 at 9:13 PM, n00bert <[EMAIL PROTECTED]> wrote: > > > Hi, > > I have the following code: > >//link is loaded via ajax into a div in #content > >//when clicked find a link in #mainMenu with the same href and > trigger a > click on it >$('#content div.thumb a').livequery('click', function(e) { >e.preventDefault(); >var href = $(this).attr('href'); >$('#mainMenu ul li ul li a[href="' + href + > '"]').triggerHandler('click'); >return false; >}); > >//some code for what happens when a menu link is clicked > > which works well in Safari 3, Firefox 3, Opera 9 on both win and mac. > However, in ie6 and ie7 I'm guessing the click event is never bound because > nothing happens if the link in a div in #content is clicked. > > Can someone shed some light on this please? Perhaps internet explorer is > not > recognising the selector which has a variable in it? Or is it a livequery > issue? > > I'm stumped. Thanks for any help, > > Sameer > -- > View this message in context: > http://www.nabble.com/livequery-not-binding-to-ajax-loaded-links-in-ie6-and-ie7--tp20494001s27240p20494001.html > Sent from the jQuery General Discussion mailing list archive at Nabble.com. > >
[jQuery] Re: LiveQuery
Here is how you'd write those utilizing Live Query. $('.hover_info').livequery(function() { $(this).hide(); }); $('.file').livequery(funcion() { $(this).hover(function() { $(this).find('.hover_info').slideDown(220); }, function() { $(this).find('.hover_info').slideUp(220); }); But ... let me see if I can help you optimize the hover a little. Instead of using the hover helper method, I'd just bind the mouseenter and mouseleave events manually like this. $('.file').livequery('mouseenter mouseleave', function(event) { $('.hover_info', this)[ "slide" + (event.type == "mouseenter" ? "Down" : "Up") ](220); }); And finally, I'd recommend that you use the technique found at this Learning jQuery post to hide your .hover_info via CSS when JS is enabled. http://www.learningjquery.com/2008/10/1-awesome-way-to-avoid-the-not-so-excellent-flash-of-amazing-unstyled-content Hiding something should typically be the job of your CSS. :) -- Brandon Aaron On Mon, Nov 10, 2008 at 6:11 AM, elev3n <[EMAIL PROTECTED]> wrote: > > Hi All, > I was wondering if someone could help me translate this code: > > $('.hover_info').hide(); > > $('.file').hover( >function() { >$(this).find('.hover_info').slideDown(220); >}, >function() { >$(this).find('.hover_info').slideUp(220); >} > ); > > into something that works with the livequery plugin (http:// > brandonaaron.net/docs/livequery/). Both of these are called on page > load. Everything I try seems to be throwing errors. I have tried along > the line of: > > $('.hover_info').livequery().hide(); > $('.hover_info').livequery('load',hide()); > > Any tips would be greatly appreciated. > > Thanks >
[jQuery] Re: Livequery not working with jQuery 1.2.6
Yeah you'll need to grab the latest version of livequery. -- Brandon Aaron On Fri, Nov 7, 2008 at 2:48 PM, Alexandre Plennevaux <[EMAIL PROTECTED]>wrote: > how about using the latest version of livequery (1.0.2) ? > > http://plugins.jquery.com/node/1088 > > > I use it with jquery 1.2.6 on several projects without issue. > > > > On Fri, Nov 7, 2008 at 9:39 PM, ksimpson <[EMAIL PROTECTED]> wrote: > >> >> I'm trying to use livequery 1.0.1 with jQuery 1.2.6 and am getting the >> following errors >> >> this.setArray is not a function => jquery.js (line 83) >> jQuery(document)[jQuery.fn.ready ? "ready" : "load"] is not a >> function => (line 81) >> jQuery(document).triggerHandler is not a function => (line 2322) >> >> Livequery has work fine for me before in jquery 1.2.3. >> > >
[jQuery] Re: LiveQuery with Tipsy (tooltip) help
Are you using jQuery for the AJAX? Live Query really only works automagically if you are using jQuery to modify the DOM. If you aren't using jQuery for the AJAX, there are a few options. Live Query has an API doing things a little more manual. After you load in the content from the AJAX call run the following code: jQuery.livequery.run(); That will invoke Live Query as if you modified the DOM with jQuery. -- Brandon Aaron On Fri, Nov 7, 2008 at 10:01 AM, idealists <[EMAIL PROTECTED]>wrote: > > Hi Brandon > > Thanks, so much for your reply I had actually tried that too. > > And yes this does work..However, strangely, ONLY when I have mouse > overed ANOTHER link (with title attrible a['title']) that is OUTSIDE > the part of the page that is "refreshed" when the ajax pagination > occurs. > > If I first mouseover a link (with title) in the updated content, then > the tooltip doesn't work (until I mouseover such a link outside the > updated content). > > Strange eh. > > Any ideas? > > On Nov 8, 2:43 am, "Brandon Aaron" <[EMAIL PROTECTED]> wrote: > > Your very close... Try this instead: > > $('a[title]') > > .livequery(function() { > > $(this).tipsy({ fade: true, gravity: 'w' }); > > > > }); > > > > No need to return false. > > > > -- > > Brandon Aaron > > > > On Thu, Nov 6, 2008 at 9:14 PM, idealists < > [EMAIL PROTECTED]>wrote: > > > > > > > > > Im got a section of my page which updates via ajax pagination. > > > The jQuery tipsy tooltips work on the initial page load, but when I > > > click Page "2" and so on, and the ajax containing div updates with new > > > content the tipsy tooltips do no display. > > > Solution (I thought) was to use the jQuery LiveQuery plugin. However > > > I am unable to get that to work. > > > Im kind of new to jQuery. > > > > > This is what I have so far: > > > > > > $('a[title]') > > >.livequery(function() { > > >$('a[title]').tipsy({fade: true, gravity: 'w'}); > > > return false; > > > }); > > > > > > > > This seems to work on the initial page load, but doesn't bind any new > > > a['title'] elements when the page is updated via ajax. > > > > > Any help would be appreciated. > > > > > Thanks >
[jQuery] Re: LiveQuery with Tipsy (tooltip) help
Your very close... Try this instead: $('a[title]') .livequery(function() { $(this).tipsy({ fade: true, gravity: 'w' }); }); No need to return false. -- Brandon Aaron On Thu, Nov 6, 2008 at 9:14 PM, idealists <[EMAIL PROTECTED]>wrote: > > Im got a section of my page which updates via ajax pagination. > The jQuery tipsy tooltips work on the initial page load, but when I > click Page "2" and so on, and the ajax containing div updates with new > content the tipsy tooltips do no display. > Solution (I thought) was to use the jQuery LiveQuery plugin. However > I am unable to get that to work. > Im kind of new to jQuery. > > This is what I have so far: > > $('a[title]') >.livequery(function() { >$('a[title]').tipsy({fade: true, gravity: 'w'}); > return false; > }); > > > This seems to work on the initial page load, but doesn't bind any new > a['title'] elements when the page is updated via ajax. > > Any help would be appreciated. > > Thanks >
[jQuery] Re: empty().append() slow
It has to do more than just set innerHTML to a blank string to avoid memory leaks. :( -- Brandon Aaron On Thu, Nov 6, 2008 at 6:28 PM, jquertil <[EMAIL PROTECTED]> wrote: > > thanks Karl, > > didn't make a difference. I suppose I'll have to preload everything > and show/hide things... ugh. > > does empty() go through the entire element node tree and remove things > one by one or something? I kept thinking it just sets innerHTML=''.
[jQuery] Re: jQuery, ASP.Net and Drop-Down-Lists
First place to check would be the selector. Make sure the select element is actually getting selected. I'd recommend using Firebug to help you see if the selector you are using is working and to help you formulate one that does if it isn't. -- Brandon Aaron On Thu, Nov 6, 2008 at 7:42 AM, Damien <[EMAIL PROTECTED]> wrote: > > Hi, > > I am trying to use a DropDownLists and jQuery, I was trying to use the > jQuery events and then call a function but it seems not to be working. > No matter what event I choose nothing happens! > > Anyone got an idea of what could be causing it? Do drop down lists > in .Net not have the standard events >
[jQuery] Re: Can I make jquery not fail silently??
On Wed, Nov 5, 2008 at 1:10 PM, brian <[EMAIL PROTECTED]>wrote: > > > > Now $('#non-existing-id').fail().toggle() will fail, > > but will work if it's not empty. > > That's actually right on the money. Thanks. > > //Still thinks fail silently on id queries is insane, but knows a > religious argument when he sees one. Hmmm ... you don't expect your CSS queries to throw an error if they don't match an element do you? It'd be silly if it did. Then you'd need a separate style sheet for each page instead of making good use of reusing styles. Same goes for jQuery code. Matching zero or more elements is a corner stone of being able to progressively enhance your web site/app with unobtrusive javascript. -- Brandon Aaron
[jQuery] Re: LiveQuery won't allow explicit onchange firing?
So this is an interesting use case. Typically you use Live Query to bind events to elements that don't yet exist in the DOM. Granted it binds to elements that already exist in the DOM as well. However, there is a miniscule delay in the actual binding and the trigger is happening before the event is actually bound. One way you can overcome this is like this: function change(event) { alert( $(this).is(':checked') ); }; $('input') .bind('change', change).trigger('change') .livequery('change', change); I'd say that this is a bug. I'm not sure when I can find the time to fix it ... but in the mean time you can use the above code to work around it. -- Brandon Aaron On Wed, Oct 8, 2008 at 11:04 AM, Jake McGraw <[EMAIL PROTECTED]> wrote: > > Using livequery for a project when I ran across an issue using the > following code: > > $("input").livequery( "change", function(){ > > if ($(this).is(":checked")) { >alert("checked!"); > } else { >alert("not checked!"); > } > > }).change(); > > My problem is the chained "change" function call. It looks like > livequery doesn't like when I directly call events from within jQuery, > custom events don't work either: > > $("input"),livequery("demo.change", function(){ > > if ($(this).is(":checked")) { >alert("checked!"); > } else { >alert("not checked!"); > } > > }).change(function(){ > > $(this).trigger("demo.change"); > > }).change(); > > This does work, but doesn't utilize livequery: > > $("input").change(function(){ > > if ($(this).is(":checked")) { >alert("checked!"); > } else { >alert("not checked!"); > } > > }).change(); > > So, my question is, how do I trigger livequery events within JavaScript? > > - jake >
[jQuery] Re: dimensions plugin integrated in jquery ?
That is correct. The dimensions plugin now completely included in jQuery 1.2.6. -- Brandon Aaron On Wed, Oct 8, 2008 at 7:41 AM, Alexandre Plennevaux <[EMAIL PROTECTED]>wrote: > hello! > > aquick question: is it right that dimensions.js has been included in jquery > 1.2.6? So there is no need to include it as a separate plugin? > > thanks for your insight! > > Alexandre >
[jQuery] Re: Is it possible to avoid jumpy / disappearing content
Make sure your styles are included before the script tags. Is this happening in a particular browser? -- Brandon Aaron On Tue, Oct 7, 2008 at 1:58 PM, John D. <[EMAIL PROTECTED]> wrote: > > Hmm...I'm still having trouble with this. > > my showHide script is as follows: > > $(document).domready(function() { >$('body').addClass('jsEnabled'); // let css know js is enabled >$('p.firstparagraph').hide() >$('#showh1').click(function(){ > $('p.firstparagraph').show(200); > }); > $('#hideh1').click(function(){ > $('p.firstparagraph').hide(200); > }); > }); > > Including the following: > http://code.jquery.com/</a> > jquery.js <<a rel="nofollow" href="http://code.jquery.com/jquery.js">http://code.jquery.com/jquery.js</a>>"> > > > > and added the following CSS rule: > > body.jsEnabled p.firstparagraph { display: none; } > > Still the firstparagraph is showing then disappearing on page load. > The page validates for both css and html. > > Any thoughts? > > Thanks! > > John > > On Oct 7, 10:28 am, Nabha <[EMAIL PROTECTED]> wrote: > > Installed the plugin, and it works great! I'm using it just as you > > suggested. > > > > For those who find this later, you'll want to "minify" the javascript > > file:http://www.digitaloverload.co.uk/jsmin/ > > > > And this is code you can copy and paste (has a fixed typo): > > > > $(document).domready(function() { > > $('body').addClass('jsEnabled'); > > > > }); >
[jQuery] Re: Is it possible to avoid jumpy / disappearing content
Actually it is located at: http://brandonaaron.net/jquery/snippets/domready/jquery.domready.js :) -- Brandon Aaron On Mon, Oct 6, 2008 at 8:09 PM, Brandon Aaron <[EMAIL PROTECTED]>wrote: > The document ready function in 1.2.6 was updated to wait on styles. This is > a good thing sometimes but other times it causes said flickers. On a few > recent projects I packaged up the old ready function as domready so that I > could avoid the flickers. You can find the code here: > http://brandonaaron.net/jquery/snippets/jquery.domready.js > You can use it just like you use ready but instead of ready it is domready. > > $(document).domready(function() { ... }); > > I'd also like to make mention that it would be good practice to add a class > to the body to signify that JS is enabled. Then use CSS to handle the > display when JS is enabled. > > $(document).domready(funciton() { > $('body').addClass('jsEnabled'); // let css know js is enabled > }); > > Now in CSS you can just say: > > body.jsEnabled p.firstparagraph { display: none; } > > -- > Brandon Aaron > > > On Mon, Oct 6, 2008 at 7:11 PM, John D. <[EMAIL PROTECTED]> wrote: > >> >> Hi, >> >> I've been running into the same problem with the following: >> >> $(document).ready(function() { >> $('p.firstparagraph').hide() >> $('#hideh1').click(function(){ >> $('p.firstparagraph').hide(200); >> }); >> $('#showh1').click(function(){ >> $('p.firstparagraph').show(200); >> }); >> }); >> >> p.firstparagraph is displaying briefly before the page has completely >> loaded. I was under the impression that $(document).ready(function() >> executed before the page was output for display. >> >> style="display:none" has been suggested on some websites but is >> inaccessible for users with javascript disabled. >> >> Any help understanding what is going on is appreciated. >> >> Thanks! >> >> John >> >> >> >> >> On Oct 6, 3:08 pm, Nabha <[EMAIL PROTECTED]> wrote: >> > Hi there, >> > >> > I love jQuery, but I have a question about something I see it doing: >> > >> > Content that it is hiding or moving often appears in its original >> > position *before* it is hidden by jQuery. Is there any good, >> > accessible way around this? >> > >> > You can see the effect in action on a page like this: >> http://docs.jquery.com/Core/jQuery#html >> > >> > Extra content shows up, and is hidden. Sometimes I imagine this kind >> > of thing would be a little jarring for the average user. >> > >> > Thanks! >> > >
[jQuery] Re: Is it possible to avoid jumpy / disappearing content
The document ready function in 1.2.6 was updated to wait on styles. This is a good thing sometimes but other times it causes said flickers. On a few recent projects I packaged up the old ready function as domready so that I could avoid the flickers. You can find the code here: http://brandonaaron.net/jquery/snippets/jquery.domready.js You can use it just like you use ready but instead of ready it is domready. $(document).domready(function() { ... }); I'd also like to make mention that it would be good practice to add a class to the body to signify that JS is enabled. Then use CSS to handle the display when JS is enabled. $(document).domready(funciton() { $('body').addClass('jsEnabled'); // let css know js is enabled }); Now in CSS you can just say: body.jsEnabled p.firstparagraph { display: none; } -- Brandon Aaron On Mon, Oct 6, 2008 at 7:11 PM, John D. <[EMAIL PROTECTED]> wrote: > > Hi, > > I've been running into the same problem with the following: > > $(document).ready(function() { > $('p.firstparagraph').hide() > $('#hideh1').click(function(){ > $('p.firstparagraph').hide(200); > }); > $('#showh1').click(function(){ > $('p.firstparagraph').show(200); > }); > }); > > p.firstparagraph is displaying briefly before the page has completely > loaded. I was under the impression that $(document).ready(function() > executed before the page was output for display. > > style="display:none" has been suggested on some websites but is > inaccessible for users with javascript disabled. > > Any help understanding what is going on is appreciated. > > Thanks! > > John > > > > > On Oct 6, 3:08 pm, Nabha <[EMAIL PROTECTED]> wrote: > > Hi there, > > > > I love jQuery, but I have a question about something I see it doing: > > > > Content that it is hiding or moving often appears in its original > > position *before* it is hidden by jQuery. Is there any good, > > accessible way around this? > > > > You can see the effect in action on a page like this: > http://docs.jquery.com/Core/jQuery#html > > > > Extra content shows up, and is hidden. Sometimes I imagine this kind > > of thing would be a little jarring for the average user. > > > > Thanks! >
[jQuery] Re: jEditable Clone Referring to the Original Element, livequery ok to use?
After glancing over the JS it looks like you are using both live query and clone(true). Using both is unnecessary and might be the cause of the issue. Just try using one of the two and see if that resolves your issue. -- Brandon Aaron On Mon, Sep 29, 2008 at 2:04 PM, Wayne <[EMAIL PROTECTED]> wrote: > > On Sep 29, 1:25 pm, Mika Tuupola <[EMAIL PROTECTED]> wrote: > > In layman's terms. After clicking baseline the new item is still > > editable, but the problem is when triggering the event it also makes > > not only the clicked element but also previous element editable. > > > > Is this your problem? > > Right, because I'm cloning the ":last" li of the list, that's the > element that the editable latches onto. In the example linked, it's > the caption tag of each table within the li. > > -Wayne >
[jQuery] Re: jEditable Clone Referring to the Original Element, livequery ok to use?
Ahh ... I guess I just misunderstood :) Yes it is possible to use LiveQuery to bind custom events using LiveQuery. -- Brandon Aaron On Sun, Sep 28, 2008 at 2:48 PM, Mika Tuupola <[EMAIL PROTECTED]>wrote: > > > On Sep 27, 2008, at 11:39 PM, Brandon Aaron wrote: > > I understood he was binding Jeditable to event called "editable" (which is > possible). So the question would have been does LiveQuery handle other than > inbuilt jQuery events? > > Although maybe misunderstood the original question. > > Quickly looking over the jEditable docs, 'editable' isn't an actual event. >> You can instead use a function based live query like this: >> >> $('.editable, .bline_measure caption').livequery(function(){ >>$(this).editable(function(value, settings) { ... }); >> }); >> >> -- >> Brandon Aaron >> >> On Fri, Sep 26, 2008 at 4:24 PM, Wayne <[EMAIL PROTECTED]> wrote: >> >> I was trying to put livequery in place on the site, but it seems to >> attach to pre-known events, like click, instead of new events, like >> editable. >> >> For instance, I'm trying to do this: >> >> $(".editable, .bline_measure caption").livequery("editable", >> function(value, settings) { >> >> >> Wanting to watch these items and rebind editable to the newly created >> captions when I clone them. Is this not a good job for livequery? >> > > -- > Mika Tuupola > http://www.appelsiini.net/ > >
[jQuery] Re: jEditable Clone Referring to the Original Element, livequery ok to use?
Quickly looking over the jEditable docs, 'editable' isn't an actual event. You can instead use a function based live query like this: $('.editable, .bline_measure caption').livequery(function(){ $(this).editable(function(value, settings) { ... }); }); -- Brandon Aaron On Fri, Sep 26, 2008 at 4:24 PM, Wayne <[EMAIL PROTECTED]> wrote: > > I was trying to put livequery in place on the site, but it seems to > attach to pre-known events, like click, instead of new events, like > editable. > > For instance, I'm trying to do this: > >$(".editable, .bline_measure caption").livequery("editable", > function(value, settings) { > > > Wanting to watch these items and rebind editable to the newly created > captions when I clone them. Is this not a good job for livequery? > > -Wayne > > On Sep 22, 9:06 am, Wayne <[EMAIL PROTECTED]> wrote: > > Thanks, Mike. This info helps. Great work, btw. > > > > -Wayne > > > > On Sep 20, 12:22 pm, Mika Tuupola <[EMAIL PROTECTED]> wrote: > > > > > On Sep 19, 2008, at 6:20 PM, Wayne wrote: > > > > > > In short, I can clone jEditable items, but I can't edit them in place > > > > without a page reload and rewriting from the server side. Am I > > > > ignoring something or do I need to reset a binding somewhere when I > do > > > > the DOM modification? > > > > > This should help: > > > > >http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_st. > .. > > > > > basically you need to rebind events to cloned elements. > > > > > -- > > > Mika Tuupolahttp://www.appelsiini.net/ >
[jQuery] Re: livequery and iui
In this particular case event delegation might serve you better. Live Query really only works if you are using jQuery methods to modify/manipulate the DOM. The iui code does not use jQuery and that is why Live Query can't see those particular updates. -- Brandon Aaron On Fri, Sep 26, 2008 at 12:25 PM, pere roca <[EMAIL PROTECTED]> wrote: > > > hi, > I usually don't work with iui (iphone) but have some code and wanna adapt > it > to play with jquery. > The problem is to attache events to the new generated DOM at each ajax > request in iui (using jquery AJAX I would make a callback, but...). > Finally > discovered livequery but seems not to work this very very simple code in > http://edit.csic.es/fitxers/gbifs/index.html : > > var example=function() {alert("clickiiin")}; > $('li') > .livequery('click',example); > //each newly generated li should alert when clicking > > some help? thanks > > Pere Roca > visita l'EDIT mapViewer! http://edit.csic.es/edit_geo/prototype/edit.html > > > > > -- > View this message in context: > http://www.nabble.com/livequery-and-iui-tp19692949s27240p19692949.html > Sent from the jQuery General Discussion mailing list archive at Nabble.com. > >
[jQuery] Re: jquery/livequery assign behaviour to element by class
Replace the first line $('.deleteform').submit(function() { with this $('.deleteform').livequery('submit', function() { -- Brandon Aaron On Tue, Sep 16, 2008 at 8:30 PM, onmountain <[EMAIL PROTECTED]> wrote: > > Can I use livequery with ajax? For instance, I am adding and deleting > elements of a certain class that have .post associated with them > at .ready. > > For instance, if my last .post returns new html that create more items > with delete forms, how should I turn the code in the .ready below to > work? >$('.deleteform').submit(function() { >var gthis = this; >var delformData = $(this).serialize(); >$.post('eatchoices.php', delformData, delprocessData); >function delprocessData(data) { >$(gthis).parent().html(data); // get the parent of > the form so replace just below the date >} // end of delformData > return false; >}); // end of submit delete form > > > On Sep 15, 4:11 pm, "Brandon Aaron" <[EMAIL PROTECTED]> wrote: > > Typically with tables you want to do event delegation for performance > > reasons. However, this is how you'd do it with LiveQuery. > > $(document).ready(function() { > > $('table tbody td.hasContent') > > .livequery('mouseenter', showBox) > > .livequery('mouseleave', hideBox) > > .livequery('mousemove', position) > > .livequery('click', showDetail); > > > > }); > > > > You could also do a function based livequery like this: > > > > $(document).ready(function() { > > $('table tbody td.hasContent') > > .livequery(function() { > > $(this) > > .bind('mouseenter', showBox) > > .bind('mouseleave', hideBox) > > .bind('mousemove', position) > > .bind('click', showDetail); > > }); > > > > }); > > > > The mouseenter and mouseleave events are what the hover helper method use > > behind the scenes. > > > > -- > > Brandon Aaron > > > > On Mon, Sep 15, 2008 at 11:49 AM, jwynne <[EMAIL PROTECTED]> wrote: > > > > > Currently I am using $(document).ready to bind some behaviours to > elements > > > in > > > the DOM based on a class name (using jquery's .filter) - This works > great > > > on > > > the initial load of the page however these bindings get all screwy when > I > > > try injecting or editing new elements to the DOM dynamically via AJAX. > > > After researching the issue I have been trying to use the livequery > plug-in > > > but have been unsuccessful so far. > > > > > In $(document).ready I am assigning behaviour to td elements of the > class > > > "hasContent". I am looking to hook them up to livequery listeners so > that > > > the correct behaviours are assigned when the DOM is updated. > > > > > $(document).ready(function(event) { > > > > >var position = function() { > > >} > > >var showBox = function() { > > >} > > >var hideBox = function() { > > >} > > >var showDetail = function() { > > >} > > > > >//Syntax help below > > >$("table tbody td").filter(".hasContent").hover(showBox, > > > hideBox).mousemove(position); > > >$("table tbody td").filter(".hasContent").click(showDetail); > > > > > });//EOF > > > > > Can anybody help me with the syntax necessary to get livequery to > > > bind/unbind the necessary behaviours to the table tds? > > > > > Thanks for the help. > > > -- > > > View this message in context: > > >http://www.nabble.com/jquery-livequery-assign-behaviour-to-element-by. > .. > > > Sent from the jQuery General Discussion mailing list archive at > Nabble.com. >
[jQuery] Re: Convert MooTools to jQuery
This should be the equivalent in jQuery code. $(document).bind('ready', function() { $('.Boite') .find('div').hide().end() .find('a') .bind('click', function(event) { $(this).parent().find('div').toggle(); }) }); -- Brandon Aaron On Fri, Sep 5, 2008 at 12:38 PM, israel.hayes <[EMAIL PROTECTED]>wrote: > > Hi, > > I was using MooTools before and I'm kinda new to jQuery, I'd like to > know how you would modify this to use it in jQuery, Thanks, > > - Israel > > window.addEvent('domready', function() > { >var Boites = $$('.Boite'); > >Boites.each(function(Boite) >{ >var Lien = Boite.getElement('a'); > >Lien.addEvent('click', function() >{ >var Boite = Lien.getParent(); >var Contenu = Boite.getElement('div'); > >if(Contenu.style.display == "none") >{ >Contenu.style.display = "block"; >} >else >{ >Contenu.style.display = "none"; >} >}); > >var Contenu = Boite.getElement('div'); >Contenu.style.display = 'none'; >}); > }); >
[jQuery] Re: Possible jQuery versions conflict
Just use jQuery.noConflict(true) to rename the jQuery namespace to whatever you want. http://docs.jquery.com/Core/jQuery.noConflict#extreme var test = jQuery.noConflict(true); Now you can use test(selector) instead of $(selector) or jQuery(selector) -- Brandon Aaron On Thu, Sep 4, 2008 at 3:09 PM, Marcin <[EMAIL PROTECTED]> wrote: > > I am very interested in the answer to this question. Is there any > working solution to this problem (is this problem ever exists) ? > > Best regards, > Marcin > > On Jul 31 2007, 12:49 pm, Sagari <[EMAIL PROTECTED]> wrote: > > Greetings, > > > > The task: to insert a DOM-style JS code usingjQueryinto a thrid- > > party page. Example: code snippets used to generate AdSense blocks. > > > > This will require a user to include ajQuerysource (directly or > > indirectly - either the user includes it, or my code snippet does). > > > > The problem: if the page already usesjQuery, the problem looks > > inevitable when twojQuerylibraries, most probably of differentversions, > are loaded. > > > > What is the simplest way to loadjQueryin such a case without causing > > JS errors? > > > > Thank you. >
[jQuery] Re: Mouseover /Mouseout div issue
Try using the mouseenter and mouseleave special events. $(...).bind('mouseenter mouseleave', function(event) { if ( event.type == 'mouseenter' ) { // just entered } else { // just left } }); You can also use the .hover helper method which uses mouseenter and mouseleave behind the scenes. $(...).hover(fn1, fn2); -- Brandon Aaron On Sun, Aug 31, 2008 at 8:26 PM, MikeyJ <[EMAIL PROTECTED]> wrote: > > Hi All, > > I'm working on something similar in functionality to the lexus > website. > > I've got a nav element that shows a large div on mouseover and hides > it on mouseout. This div can hold other elements like thumbnails and > form fields. When I move the mouse into the div all is well until I > move over any other element in the div and then the div hides. > > How can I keep the div showing no matter where I move the mouse inside > of it? > > Thx, > Mike >
[jQuery] Re: jQuery 1.2.6 event.altKey is undefined
It has already been fixed in SVN. If you don't want to use the SVN version then simply reference the altKey property like this: event.originalEvent.altKey -- Brandon Aaron On Sun, Aug 24, 2008 at 1:06 PM, Tzury <[EMAIL PROTECTED]> wrote: > > The latest version that behave correctly is 1.2.4. > How could I submit a fix for this issue? > > > On Aug 23, 8:50 pm, Tzury <[EMAIL PROTECTED]> wrote: > > problem: > > event.altKey is undefined. > > > > environment: > > Linux/ FF 3.0.1 / jQuery-1.2.6 > > > > remark: > > when I am using older version (1.1.4) everything works fine. > > > > The following markup along with firebug will be handy to capture it. > > > > > > > > http://jqueryjs.googlecode.com/files/</a> > > jquery-1.2.6.js"> > > > > $(document).ready(function (){ > > $.event.add(document, 'keydown', showEventDetails); > > }); > > function showEventDetails(event){ > > console.log("Alt:%s", event.altKey); > > } > > > > > > > > > > >
[jQuery] Re: JQuery "exists" - anything in core or a plugin that does this?
Is there a particular method/plugin you are wanting to write this for? Most jQuery methods and plugins operate on 0 or more matched elements. -- Brandon Aaron On Fri, Aug 22, 2008 at 7:54 AM, James <[EMAIL PROTECTED]> wrote: > > Hi, > > I can't seem to find anything that does the following: > > $("img").exists(function(matches) { > /* do something with matches */ > }); > > the difference between "exists" and "each" being it is only run once > and supplies all the matches as an argument. > > The long-hand way of doing this is something along these lines: > > var matches = $("img"); > if (matches.length) { > /* do something */ > } > > Before I write myself a quick plugin, is there an obvious alternative > I've missed??? > > Regards, > > James > > > > > >
[jQuery] Re: offset() returns different values between resize and onload events
Are you using the offset method found in jQuery 1.2.6 or the one found in the older version of the dimensions plugin? I'm wondering if it is an issue with IE implementation of getBoundingClientRect ... or if it is an issue with document.documentElement.clientTop on reload. Might try using a setTimeout(fn, 0) to see if that corrects the issue. -- Brandon Aaron On Mon, Jul 21, 2008 at 6:56 PM, jquertil <[EMAIL PROTECTED]> wrote: > > That was my first thought, too, and it's been mentioned before on this > list. I always set margin and padding of html and body to 0; >
[jQuery] Re: offset() returns different values between resize and onload events
I haven't tried to reproduce this yet but I'm wondering if the body has any margin (default or not). If so try setting the margin to 0 on the body. -- Brandon Aaron On Jul 21, 4:20 pm, jquertil <[EMAIL PROTECTED]> wrote: > I'm checking offset() return values in both events: window resize and > load. > Te offset().left and position().left is 8px more in onload versus > resize. > I tried all options (scroll:false, etc). > > window.onresize = checkit(); > window.onload = checkit(); > > function checkit(){ > self.status=$('#positioned').offset().left; > > } > > hello
[jQuery] Re: Input field: focus=remove text; blur=put it back
It is in the comments ... if you don't have a default value set ... you'll need to set a value like so: $('#element').val("Search").clearonfocus(); or if your html looks like this: then you can just call it like this: $('#element').clearonfocus(); -- Brandon Aaron On Thu, Jul 17, 2008 at 12:40 PM, Andy Matthews <[EMAIL PROTECTED]> wrote: > I thought as much. Thanks Brandon. Standard usage applies? > > $('#element).clearonfocus(); > > ? > > -- > *From:* jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] *On > Behalf Of *Brandon Aaron > *Sent:* Thursday, July 17, 2008 12:27 PM > *To:* jquery-en@googlegroups.com > *Subject:* [jQuery] Re: Input field: focus=remove text; blur=put it back > > I wrote this a while back: > http://dev.jquery.com/browser/trunk/plugins/clearonfocus/jquery.clearonfocus.js > > -- > Brandon Aaron > > On Thu, Jul 17, 2008 at 11:19 AM, Andy Matthews <[EMAIL PROTECTED]> > wrote: > >> Is there a plugin for this by chance? I know it's pretty quick to write, >> but wanted to find out if someone's already done it better than I could. >> >> Also, would toggle() work for this sort of thing? Is there a focus/blur >> toggle in the jQuery core? >> >> * >> >> Andy Matthews >> *Senior ColdFusion Developer >> >> Office: 615.627.9747 >> Fax: 615.467.6249 >> www.dealerskins.com >> >> Total customer satisfaction is my number 1 priority! If you are not >> completely satisfied with the service I have provided, please let me know >> right away so I can correct the problem, or notify my manager Aaron West at >> [EMAIL PROTECTED] >> >> > > <<2008 Email NADA.jpg>>
[jQuery] Re: Input field: focus=remove text; blur=put it back
I wrote this a while back: http://dev.jquery.com/browser/trunk/plugins/clearonfocus/jquery.clearonfocus.js -- Brandon Aaron On Thu, Jul 17, 2008 at 11:19 AM, Andy Matthews <[EMAIL PROTECTED]> wrote: > Is there a plugin for this by chance? I know it's pretty quick to write, > but wanted to find out if someone's already done it better than I could. > > Also, would toggle() work for this sort of thing? Is there a focus/blur > toggle in the jQuery core? > > * > > Andy Matthews > *Senior ColdFusion Developer > > Office: 615.627.9747 > Fax: 615.467.6249 > www.dealerskins.com > > Total customer satisfaction is my number 1 priority! If you are not > completely satisfied with the service I have provided, please let me know > right away so I can correct the problem, or notify my manager Aaron West at > [EMAIL PROTECTED] > > <<2008 Email NADA.jpg>>
[jQuery] Re: Livequery event firing multiple times
After a quick glance at the code you pasted... it looks like you are using the Live Query plugin within the click event. This somewhat negates the purpose of Live Query. Try moving the Live Query block outside the 'click' binding block ... within the document.ready block. -- Brandon Aaron On Fri, May 30, 2008 at 8:35 AM, Gordon <[EMAIL PROTECTED]> wrote: > > I'm working on a survey builder which will allow users to create > online surveys and polls. I decided to use livequery to build it as > it involves lots of adding and deleting of DOM items that have > associated events. > > I'm still at an early stage of development but I've run into a snag. > The function I've attached with LiveQuery to the "Add new question" > button seems to fire once for every question group that has been > added, even though every time it fires the expected DOM element. For > example, if I add 3 groups, then click the "Add new question" button > for the second group, I get 3 DIV objects getting logged to the > console, although all 3 refer to the sane item, namely the second > div. > > I'm obviously doing something wrong but the livequery documentation is > rather sparse. I'm wondering if anyone else has run into this, what > do I need to be doing differently? > > http://www.w3.org/ > TR/xhtml11/DTD/xhtml11.dtd <http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd> > "> > http://www.w3.org/1999/xhtml";> > > > Untitled Document > > <!-- > .cmsDialog { >display: none; > } > --> > > type="text/css" media="screen" title="Flora (Default)"> > > </ > script> > <script type="text/javascript" src="/js/jquery/ui/ui.core.js"></ > script> > <script type="text/javascript" src="/js/jquery/ui/ui.draggable.js"></ > script> > <script type="text/javascript" src="/js/jquery/ui/ui.resizable.js"></ > script> > <script type="text/javascript" src="/js/jquery/ui/ui.dialog.js"></ > script> > <script type="text/javascript"> > <!-- > > function QuestionGroup (title, subtitle, target) > { >var self= this; >self.wrapper= $('<div></div>'); >self.header = $('<h3>' >+ title >+ > '</h3><h4>' >+ subtitle >+ '</h4>'); >self.fieldSet = $('<fieldset><legend>' >+ title >+ > '</legend></fieldset>'); >self.optBar = $('<div > class="optBar></div>'); >self.questionBut= $('<input type="button" > class="addQ" value="Add > question" />'); > >self.construct = function () >{ >self.optBar.append (self.questionBut); >self.wrapper.append (self.header); >self.wrapper.append (self.fieldSet); >self.wrapper.append (self.optBar); >target.append (self.wrapper); >}; > >self.construct (); > } > > function QuestionString (target, label) > { >var self= this; >self.container = $('<div></div>'); >self.label = $('<label>' + label + '</label>'); >self.input = $('<input type="text" />'); > >self.construct = function () >{ >self.container.append (self.label); >self.container.append (self.input); >target.append (self.container); >}; > >self.construct (); > } > > function QuestionText () > { > } > > function QuestionCheck () > { > } > > function QuestionRadio () > { > } > > function QuestionSelect () > { > } > > function QuestionGrid () > { > } > > function QuestionGridRow () > { > } > > $(document).ready (function () > { >v
[jQuery] Re: change innerHTML
You can do this several ways: $('#progressBarText')[0].innerHTML = '76%'; $('#progressBarText').attr('innerHTML', '76%'); And finally the preferred method: $('#progressBarText').html('76%'); The docs for the html method: http://docs.jquery.com/Attributes/html#val -- Brandon Aaron On Tue, May 27, 2008 at 3:45 PM, arden liu <[EMAIL PROTECTED]> wrote: > In my html, I have the following to show upload percentage: > 0% > > I tried to update the percentage using the following javascript: > $("#progressBarText").innerHTML = "76%"; > > But it does not work. :( > Thanks. > Arden >
[jQuery] Re: Return data from dimensions.js
The offset method returns and object with top and left properties. ... var coordsB = $(this).offset({ scroll: false }); ... Now you can get the top and left offsets like this: var top = coordsB.top; var left = coordsB.left; -- Brandon Aaron On Fri, May 23, 2008 at 1:51 PM, teazer <[EMAIL PROTECTED]> wrote: > > I need to save the coordinates of a div to be able to return it to the > same location and am having problems posting the offset from > dimensions.js > > This > > $(".dragL").mouseup(function(e){ >var stroke = $(this).attr("id"); >var coordsB = $(this).offset({ scroll: false }); >$.post("pre_scripts.cfm", { >coords: e.pageX +','+ e.pageY, >coordsDiv: coordsB, >strokeNo: stroke >}, >function(data){ > //alert(data); > var commaAt = data.indexOf(','); > $( '#' + data.substr(0, commaAt) ).text( > data.substr(commaAt > +1) ); >}); >}); > > posts this > > COORDSDIV: [object Object] > STROKENO: S2 > COORDS: 122,129 > > How do I read [object Object] >
[jQuery] Re: .get(0) fails in 1.2.5
This is working for me. Must be a little more deeply rooted. Could you try and narrow things down? Create a simplified test-case that we could all explore? -- Brandon Aaron On Wed, May 21, 2008 at 12:53 PM, jstrebel <[EMAIL PROTECTED]> wrote: > > Hi there, > > Noob.. and first post. Thanks for helping: > > When using jquery 1.2.1 this call > > var task = $("#task_"+checklist_id+"_"+task_id)[0]; > or > var task = $("#task_"+checklist_id+"_"+task_id).get(0); > > both return: [object HTMLTableRowElement] > > which is correct. (we are appending rows to a table...) > > But in 1.2.5 - same calls return: undefined > > which then makes my next function, > $.data(task, "name", id); fail.. w/ message "elem has no properties" > > Any ideas? Thanks. > > >
[jQuery] Re: livequery in navigation
I'm a little confused about your setup. Could you post a link to the site or an example of the issue you are having? Also, I'm sure it was just a typo but your missing the $ on ('#home') and ('#search'). -- Brandon Aaron On Wed, May 7, 2008 at 10:47 AM, kws452 <[EMAIL PROTECTED]> wrote: > > I am using jquery and superfish in my horizontal navigation menu. The > navigation is loaded via an external file. The drop down menus set > up nicely, and I have js set up so that when a user select a menu > item, different content is loaded into a in the middle of the > page depending on what they click on. I just switched to livequery, so > my js is: > > $(document).ready(function() { > ('#home') > .livequery('click', (function() { > $('#content').load('index.php') > return false; > }) > > ('#search') > .livequery('click', (function() { > $('#content').load('search.php') > return false; > }) > ); > > My goal is for the user to always be able to click on the navigation > menu and "start over" or load new content. So if the user chooses > "search", "search.php" is loaded, which is a form. They enter the > users company name and press submit. Data is shown in the in > the middle of the page. Now I want the user to be able to click on a > navigation link, or the home link to do whatever they want. This does > not work - it seems like once data is displayed in the #content , > the navigation menu doesn't work. I guess I thought this was what > livequery would do for me. Does anyone have time to look at this and > see what I am doing wrong? >
[jQuery] Re: JQuery and ASP.NET AJAX
We've fixed several specific issues in dealing with ASP.Net's AJAX framework in the past. As far as I know to date we play nice with ASP.Net. -- Brandon Aaron On Mon, May 19, 2008 at 10:12 AM, Mike <[EMAIL PROTECTED]> wrote: > > I used ASP.NET Ajax to make webmethod calls all the time and I know > some other frameworks wont work with it that is why I was asking. > MOOTOOLS doesnt play nice with ASP.NET Ajax. > > On May 19, 6:52 am, Steve D <[EMAIL PROTECTED]> wrote: > > I have used both successfully together, but that because the client > > wanted me too. > > > > Personally I would prefer to use jQuery on it's own. I understand what > > it's doing much better than I understand what the ajax extensions are > > doing in .Net. It's also a much smaller download (a simple update > > panel in .Net takes over 100k of downloads to do) >
[jQuery] Re: attr('form') not work in firefox
1.2.4 is available ... just not the release notes :) http://code.jquery.com/jquery.js -- Brandon Aaron On Mon, May 19, 2008 at 9:54 AM, Ariel Flesler <[EMAIL PROTECTED]> wrote: > > No, you're right. Form elements (input, select, textarea, etc) do have > a 'form' attribute. I think it's even cross-browser. > Your code WILL work with the new version (1.2.4) which will be > (hopefully) released soon. > > If you want to verify this will work, you can get it by doing a > checkout: > http://code.google.com/p/jqueryjs/source/checkout > And building it yourself. > > $().attr() will be much more intuitive and reliably (I hope so) from > now on. > > Cheers > > -- > Ariel Flesler > http://flesler.blogspot.com > > On 19 mayo, 10:55, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > Thanks all, it must be my misunderstanding of the dom. >
[jQuery] Re: Making all ids invisible except one
Like Karl said and here are the docs for the :not selector and the .not method http://docs.jquery.com/Selectors/not#selector http://docs.jquery.com/Traversing/not#expr -- Brandon Aaron On Thu, May 15, 2008 at 10:17 PM, Karl Rudd <[EMAIL PROTECTED]> wrote: > > $('div.subNav').not('#myId').hide(); > > or > > $('div.subNav:not(#myId)').hide(); > > Karl Rudd > > On Fri, May 16, 2008 at 1:13 PM, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > Given a bunch of divs with class = "subNav", how do I write a jquery > > expression to make all of their "display" attributes "none" except the > > one with id, "myId"? > > > > Thanks, - Dave > > >
[jQuery] Re: why is droppable() 's init method trying to read outerWidth() of a div?
jQuery UI depends on jQuery 1.2.4a because we are making new updates to jQuery to make sure jQuery UI performs its best. The final version of jQuery UI will also have a final version of jQuery to go along with it. -- Brandon Aaron On May 11, 8:59 pm, Eric Ongerth <[EMAIL PROTECTED]> wrote: > Oh, ok. Thank you. The jQuery website gave me no idea that jquery ui > 1.5b4 was dependent on jquery 1.2.4a. In fact I had no idea 1.2.4a > was even available. > > Allright... I switched to the (nightly) 1.2.4a, and the error of > course disappeared. > > The jqueryUI site could make it more clear that a specific jquery > build is required. Also, isn't it a little strange that a beta build > depends on an alpha in this case? (1.5b4 depending on 1.2.4a) ? > > What would I downgrade to if I wanted to run stable versions of both > jquery and jquery-ui? > > Thanks! > Eric > > On May 11, 6:38 pm, Ariel Flesler <[EMAIL PROTECTED]> wrote: > > > OuterWidth has been include along with the rest of Dimensions' methods > > into jQuery 1.2.4a which (as far as I know) is the release that comes > > with the last UI. > > > Are you seeing this on Safari ? I got a failing test on Safari for > > outerWidth. > > > -- > > Ariel Fleslerhttp://flesler.blogspot.com > > > On 11 mayo, 21:59, Eric Ongerth <[EMAIL PROTECTED]> wrote: > > > > Take a look the following from jquery.ui-all-1.5b4.js: -- it's inside > > > of the droppable() method's init method: > > > > 802 //Store the droppable's proportions > > > 803 this.proportions = { width: this.element.outerWidth(), height: > > > this.element.outerHeight() }; > > > > I have been stuck for a while on an error this causes. I am calling > > > droppable() on a div and I get an error saying this.element.outerWidth > > > is not a function. Of course, because elements don't have an > > > outerWidth! The div from which I'm calling droppable() has a width, > > > offsetWidth(), scrollWidth(), as checked with a Firebug breakpoint at > > > the time of calling droppable(). But it naturally does not have an > > > outerWidth(). > > > > This seems like an error in jquery-ui. But if that were true, > > > wouldn't people have tripped over it everywhere? Therefore it makes > > > me wonder what I am doing wrong instead. > > > > Can anyone offer some insight about this? > > > > Eric
[jQuery] Re: jQuery TShirt
Something like: $('people:female').find('girlfriend') => [] -- Brandon Aaron On Fri, May 9, 2008 at 10:33 AM, CVertex <[EMAIL PROTECTED]> wrote: > > love it. > > I'd prefer something clever with code on it than just the logo. > > just the way i eval... > > On May 9, 5:16 am, "Josh Nathanson" <[EMAIL PROTECTED]> wrote: > > It would be cool if said something like: > > > > $("code").less(); > > > > ...in Courier typeface...and then had the jQuery logo on it. > > > > -- Josh > > > > - Original Message - > > From: "Mike Branski" <[EMAIL PROTECTED]> > > To: "jQuery (English)" > > Sent: Thursday, May 08, 2008 11:36 AM > > Subject: [jQuery] Re: jQuery TShirt > > > > > Agreed! A darker blue with white text would look good (design > > > pending). > > > > > On May 8, 10:32 am, "Andy Matthews" <[EMAIL PROTECTED]> wrote: > > >> PLEASE PLEASE PLEASE offer colors other than just black!! > > > > >> -Original Message- > > >> From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] > On > > > > >> Behalf Of John Resig > > >> Sent: Thursday, May 08, 2008 10:24 AM > > >> To: jquery-en@googlegroups.com > > >> Subject: [jQuery] Re: jQuery TShirt > > > > >> There's one in the works right now - we're sending it to the producer > and > > >> will have a store to go along with it. We'll definitely make an > > >> announcement > > >> when it's ready. > > > > >> --John > > > > >> On Thu, May 8, 2008 at 8:09 AM, CVertex <[EMAIL PROTECTED]> > > >> wrote: > > > > >> > I noticed captain John Resig wearing a few nice threadless.com > > >> > tshirts, and he mentioned a few times in a recent talk that they > were > > >> > selling jQuery tshirts in this or that place. > > > > >> > I was wondering if anyone knew of any jQuery tshirts that were > around? > > > > >> > What would you put on your jQuery T? > > > > >> > $(body) > > > > >> > -CV >
[jQuery] Re: [jQuery][ANN] jQuery.batch 1.0
Oh ... you want to make sure the width of the li adds up to the width of all the images? The earlier snippet just made sure the li was as wide as the widest image. You could do something like this to add up all the widths. var width = 0; $.each( $('li.hello img').widths(), function(i,w){ width += w; }); $('li.hello').animate({ width: width }, 'slow'); As for the feature suggestion ... I think it is an interesting idea. It might be a little out of scope for this little extension/plugin but I'll have to give it some more thought. Most of the things you mentioned are already very easy to do with arrays and probably easy to extend the Array object to do them otherwise. -- Brandon Aaron On Fri, May 9, 2008 at 10:57 AM, Alexandre Plennevaux <[EMAIL PROTECTED]> wrote: > Hi Brandon! > > in your blog post you ask for suggested features. > > Frankly i'm stunned by how in one line you addition all the widths values > (although i didn't expect less from you). Personally, I had to loop through > the returned array in order to achieve that. > Wouldn't it be a nice feature to add some built-in manipulations to the > batch? i'm thinking 'sum' to add them all and return the result, 'concat', > 'join:,' to join each with a comma in-between, 'average' to get the average > of all integer values, etc. a kind of built-in callbacks if you like for > most common operations. > > $('li.hello img').widths('sum'); > > > thank you! > > alexandre > > > > On Fri, May 9, 2008 at 5:01 PM, Brandon Aaron <[EMAIL PROTECTED]> > wrote: > >> >> I misspelled reverse in my code example... It should be: >> >> var width = $('li.hello img').widths().sort().reverse()[0]; >> $('li.hello').animate({ width: width }, 'slow'); >> >> -- >> Brandon Aaron >> >> On May 9, 9:47 am, "Brandon Aaron" <[EMAIL PROTECTED]> wrote: >> > Close but in your example newWidths is an array of numbers. In your case >> > you'll want a way to extract the largest width from the array and then >> use >> > that value to animate the li width. Maybe something like this. >> > >> > var width = $('li.hello img').widths().sort().revers()[0]; >> > $('li.hello').animate({ width: width }, 'slow'); >> > >> > Thanks for a nice "real-world" example. :) >> > >> > In testing this I found a bug and created a new release 1.0.1. >> > >> > -- >> > Brandon Aaron >> > >> > On Fri, May 9, 2008 at 2:08 AM, Alexandre Plennevaux < >> [EMAIL PROTECTED]> >> > wrote: >> > >> > > Brandon, i believe this is a clever little plugin. I i understand >> > > correctly, here is a real life example i experienced just 2 days ago >> where >> > > i had such markup: >> > >> > > >> > > > src="photos/sombra/Image_001.jpg"/> >> > > > src="photos/sombra/Image_002.jpg"/> >> > > > src="photos/sombra/Image_003.jpg"/> >> > > > src="photos/sombra/Image_004.jpg"/> >> > > > src="photos/sombra/Image_005.jpg"/> >> > > > src="photos/sombra/Image_006.jpg"/> >> > > > src="photos/sombra/Image_007.jpg"/> >> > > >> > >> > > I needed to resize the LI element according to its children IMG >> element >> > > attr width. What i did is loop through the jquery collection looking >> for the >> > > width attribute value. >> > >> > > with your plugin it would be just >> > >> > > var newWidth = $('li.hello').attrs('width'); >> > > $('li.hello').animate({width: newWidth},"slow"); >> > >> > > Am i correct? >> > >> > > On Fri, May 9, 2008 at 5:40 AM, Brandon Aaron < >> [EMAIL PROTECTED]> >> > > wrote: >> > >> > >> jQuery.batch is a small extension (951 bytes min'd, 520 bytes >> gzipped) to >> > >> jQuery that allows you to batch the results of any jQuery method, >> plugin >> > >> into an array. By default the batch plugin aliases the getter methods >> in >> > >> jQuery by adding an 's' to the end (attrs, offsets, vals ...). You >> can also >> > >> just call $(...).batch('methodName', arg1, arg*n). >> > >> > >> Download:http://plugins.jquery.com/project/batch >> > >> Blog post:http://blog.brandonaaron.net/2008/05/08/jquery-batch/ >> > >> > >> -- >> > >> Brandon Aaron >> > >> > > -- >> > > Alexandre Plennevaux >> > > LAb[au] >> > >> > >http://www.lab-au.com >> > > > > -- > Alexandre Plennevaux > LAb[au] > > http://www.lab-au.com >
[jQuery] Re: [jQuery][ANN] jQuery.batch 1.0
I misspelled reverse in my code example... It should be: var width = $('li.hello img').widths().sort().reverse()[0]; $('li.hello').animate({ width: width }, 'slow'); -- Brandon Aaron On May 9, 9:47 am, "Brandon Aaron" <[EMAIL PROTECTED]> wrote: > Close but in your example newWidths is an array of numbers. In your case > you'll want a way to extract the largest width from the array and then use > that value to animate the li width. Maybe something like this. > > var width = $('li.hello img').widths().sort().revers()[0]; > $('li.hello').animate({ width: width }, 'slow'); > > Thanks for a nice "real-world" example. :) > > In testing this I found a bug and created a new release 1.0.1. > > -- > Brandon Aaron > > On Fri, May 9, 2008 at 2:08 AM, Alexandre Plennevaux <[EMAIL PROTECTED]> > wrote: > > > Brandon, i believe this is a clever little plugin. I i understand > > correctly, here is a real life example i experienced just 2 days ago where > > i had such markup: > > > > > > > > > > > > > > > > > > > > > > I needed to resize the LI element according to its children IMG element > > attr width. What i did is loop through the jquery collection looking for the > > width attribute value. > > > with your plugin it would be just > > > var newWidth = $('li.hello').attrs('width'); > > $('li.hello').animate({width: newWidth},"slow"); > > > Am i correct? > > > On Fri, May 9, 2008 at 5:40 AM, Brandon Aaron <[EMAIL PROTECTED]> > > wrote: > > >> jQuery.batch is a small extension (951 bytes min'd, 520 bytes gzipped) to > >> jQuery that allows you to batch the results of any jQuery method, plugin > >> into an array. By default the batch plugin aliases the getter methods in > >> jQuery by adding an 's' to the end (attrs, offsets, vals ...). You can also > >> just call $(...).batch('methodName', arg1, arg*n). > > >> Download:http://plugins.jquery.com/project/batch > >> Blog post:http://blog.brandonaaron.net/2008/05/08/jquery-batch/ > > >> -- > >> Brandon Aaron > > > -- > > Alexandre Plennevaux > > LAb[au] > > >http://www.lab-au.com
[jQuery] Re: [jQuery][ANN] jQuery.batch 1.0
Close but in your example newWidths is an array of numbers. In your case you'll want a way to extract the largest width from the array and then use that value to animate the li width. Maybe something like this. var width = $('li.hello img').widths().sort().revers()[0]; $('li.hello').animate({ width: width }, 'slow'); Thanks for a nice "real-world" example. :) In testing this I found a bug and created a new release 1.0.1. -- Brandon Aaron On Fri, May 9, 2008 at 2:08 AM, Alexandre Plennevaux <[EMAIL PROTECTED]> wrote: > Brandon, i believe this is a clever little plugin. I i understand > correctly, here is a real life example i experienced just 2 days ago where > i had such markup: > > > > > > > > > > > > > > I needed to resize the LI element according to its children IMG element > attr width. What i did is loop through the jquery collection looking for the > width attribute value. > > with your plugin it would be just > > var newWidth = $('li.hello').attrs('width'); > $('li.hello').animate({width: newWidth},"slow"); > > Am i correct? > > > > > On Fri, May 9, 2008 at 5:40 AM, Brandon Aaron <[EMAIL PROTECTED]> > wrote: > >> jQuery.batch is a small extension (951 bytes min'd, 520 bytes gzipped) to >> jQuery that allows you to batch the results of any jQuery method, plugin >> into an array. By default the batch plugin aliases the getter methods in >> jQuery by adding an 's' to the end (attrs, offsets, vals ...). You can also >> just call $(...).batch('methodName', arg1, arg*n). >> >> Download: http://plugins.jquery.com/project/batch >> Blog post: http://blog.brandonaaron.net/2008/05/08/jquery-batch/ >> >> -- >> Brandon Aaron >> > > > > -- > Alexandre Plennevaux > LAb[au] > > http://www.lab-au.com
[jQuery] [jQuery][ANN] jQuery.batch 1.0
jQuery.batch is a small extension (951 bytes min'd, 520 bytes gzipped) to jQuery that allows you to batch the results of any jQuery method, plugin into an array. By default the batch plugin aliases the getter methods in jQuery by adding an 's' to the end (attrs, offsets, vals ...). You can also just call $(...).batch('methodName', arg1, arg*n). Download: http://plugins.jquery.com/project/batch Blog post: http://blog.brandonaaron.net/2008/05/08/jquery-batch/ -- Brandon Aaron
[jQuery] [jQuery][ANN] New jQuery group on LinkedIn
You can join the LinkedIn group by following this invite link: http://www.linkedin.com/e/gis/100943/4C28294034F5 -- Brandon Aaron
[jQuery] Re: Attaching Events with Live Query
Adam, Live Query works so nicely because it sits on top of jQuery. It isn't working for you because you aren't using jQuery's methods to append the content to the DOM. You can however manually run the registered live queries by running the following: jQuery.livequery.run(); You might also investigate utilizing one of the event delegation plugins for jQuery such as Ariel Flesler's Listen plugin. -- Brandon Aaron On Tue, May 6, 2008 at 8:42 PM, Adam Weis <[EMAIL PROTECTED]> wrote: > > Hello, > > I'm having an issue attaching some events to a simple accordion that > is loaded via ajax. I've tried moving the accordion script into the > head with Live Query and also putting the accordion script after the > html that is loaded from the ajax for it to no avail. > > The ajax content is loaded by a non-jQuery ajax call, could that be > causing the problem? > > You can see the page at, http://efodev.thewonderlabs.com/about/company > and then clicking "Timeline" in left nav. > > Am I going about this entirely wrong? > > Any help would be appreciated. > > -Adam >
[jQuery] Re: dimensiosn plugin
To get the top and or left position of an element do the following: var position = $('#item1').position(); Now position.top is equal to the top and position.left is equal to the left. So if I wanted to assign the top position to another variable I could do it like this. var top = position.top; If you only needed the top you could simply just do the following. var top = $('#item1').position().top; Here are the docs for dimensions 1.2: http://docs.jquery.com/Plugins/dimensions -- Brandon Aaron On Fri, May 2, 2008 at 10:04 AM, bdee1 <[EMAIL PROTECTED]> wrote: > > > i'm sorry i still dotn think i follow entirely. > > so if i had an div element with an id of item1. and i wanted to get the > position of it. > > the dimensions documentation says i would do: > var position = {}; > $("#myElement").position(position); > > so then in this example it should be: > $("#item1").position(position); > > then to access the top position, i woudl do the following? > $("#item1").offset().top > > is that correct? > > > > Karl Swedberg-2 wrote: > > > > > > > > Since it returns an object, you can use either dot notation or bracket > > notation. So, to get the top position of an element, you could do > > this ... > > > > $(element).offset().top > > > > or this ... > > > > $(element).offset()['top'] > > > > hope that helps. > > > > --Karl > > _ > > Karl Swedberg > > www.englishrules.com > > www.learningjquery.com > > > > > > > > On May 1, 2008, at 3:56 PM, bdee1 wrote: > > > >> > >> > >> i am a little unclear on how exactly to get the position of an > >> element using > >> jquery dimensions plugin. > >> > >> documentation says it returns "An object with top and left > >> properties that > >> are numbers representing the offset in pixels." > >> > >> and it says the object looks like this: > >> { top: 10, left: 10 } > >> > >> so how do i access it? like a string? do i have to use string > >> functions to > >> pull out the height and width individually? > >> -- > >> View this message in context: > >> http://www.nabble.com/dimensiosn-plugin-tp16995030s27240p16995030.html > >> Sent from the jQuery General Discussion mailing list archive at > >> Nabble.com. > >> > > > > > > > > -- > View this message in context: > http://www.nabble.com/dimensiosn-plugin-tp16995030s27240p17021373.html > Sent from the jQuery General Discussion mailing list archive at > Nabble.com. > >
[jQuery] Re: livequery with hoverIntent
I don't see anything wrong with the code you posted. Could you post more of the code or a test page? -- Brandon Aaron On Fri, May 2, 2008 at 8:26 AM, Alexandre Plennevaux <[EMAIL PROTECTED]> wrote: > > hello! > > i need to assign a behaviour triggered via the hoverIntent plugin to > elements fetched via ajax. I would assume i should use the livequery plugin > for that, but my attempts have failed miserably so far. > > Here is the non livequery code, that works for DOM elements present on > document ready: > > $('ul.mainmenu:not(#applicationTitle)').hoverIntent({ > sensitivity: 2, > interval: 0, > over: function(){ > $('li, li a', $(this)).addClass('visible'); > }, > timeout: 0, > out: function(){ > $('li, li a', $(this)).removeClass('visible'); > } > }) > > > i tried this, but it doesn't work _ Any help *much* appreciated, thanks > !! > > $('ul.mainmenu:not(#applicationTitle)').livequery(function(){ > $(this).hoverIntent({ > sensitivity: 2, > interval: 0, > over: function(){ > $('li, li a', $(this)).addClass('visible'); > }, > timeout: 0, > out: function(){ > $('li, li a', $(this)).removeClass('visible'); > } > }); > }) > >
[jQuery] Re: Loading the bgiframe script only for IE
I'd recommend just using conditional comments to load the bgiframe plugin for IE 6 only. http://msdn2.microsoft.com/en-us/library/ms537512(VS.85).aspx -- Brandon Aaron On Tue, Apr 29, 2008 at 1:05 PM, Aaron Barker <[EMAIL PROTECTED]> wrote: > > I looked but couldn't find anything on this. So hopefully this isn't > a repeat. > > It's great that we have bgiframe to compensate for the sorry excuse > that is IE6, but it kind of sucks that we have to include it for all > browsers even though no one else needs it (both filesize [albeit > small] and the extra http request). > > With that in mind, is there any issue with the following: > > > if($.browser.msie&&parseInt($.browser.version)<=6) $.getScript("path/ > to/bgiframe.js"); > > > So if that were called after the inclusion of jquery.js and before any > plugins that may need to use bgiframe... would it work correctly? Any > issue with loading bgiframe via the getScript method? > > Thanks, > > Aaron Barker >
[jQuery] Re: [autocomplete] dimension.js requirement
Dimensions, as it is an oft-required plugin, is now part of the core in SVN. -- Brandon Aaron On Tue, Apr 29, 2008 at 11:43 AM, Aaron Barker <[EMAIL PROTECTED]> wrote: > > Is it possible to make this an optional component of the autocomplete > plugin? > > If I always only want 10 or so options to display, thus not having any > scrolling... the need to have this extra file (both in filesize > addition and http request addition) is worthless. But I must include > it to keep the JavaScript errors from occurring. > > I understand that the logic needs to stay in the autocomplete plugin, > but can there be a check if dimensions is on the page, and only run > that logic if it is there. Even if it is there, I would think the > option to have a scrollable div or not should be made available as I > may have included it for something else, but don't want the scrolling > in the autocomplete. > > Tossing this out for discussion sake first, can make a bug report or > feature request if it is seen as worth it. > > Thanks, > > Aaron Barker >
[jQuery] Re: Correct viewport height?
Which version of jQuery are you using? Dimensions 1.2 no longer has the width/height methods as they have been moved to the core. This sounds like a familiar issue in jQuery 1.2.1/2 but was fixed in jQuery 1.2.3. -- Brandon Aaron On Sun, Apr 27, 2008 at 1:06 PM, HertzaHaeon <[EMAIL PROTECTED]> wrote: > > When I use $(window).height() with Dimensions 1.2, it doesn't give me > the height of the viewable part of the document. Instead I get the > same number as for $(document).height(), i.e. the total height of > everything in the document, including off-screen parts. > > Is this a bug or am I using it wrong? I get the same behavior on > Firefox 2 and IE7. How do I get the height of the visible part of the > document with jQuery? >
[jQuery] Re: Livequery not binding on div after a .load method
Post up an example so that we can see where LiveQuery is breaking for you. -- Brandon Aaron On Apr 27, 8:19 am, Sid <[EMAIL PROTECTED]> wrote: > I face the same problem. > New classes are simply not recognized, making my links disfunctional.
[jQuery] Re: Livequery not binding on div after a .load method
LiveQuery has two types of "queries": event and function. A function based LiveQuery fires a given function when an element is added to the DOM and another function, if given, for when an element is removed from the dom. The function based LiveQuery is not attached to a particular event. The docs are here: http://docs.jquery.com/Plugins/livequery -- Brandon Aaron On Apr 26, 4:12 pm, "Alexandre Plennevaux" <[EMAIL PROTECTED]> wrote: > correct me if i'm wrong but i think livequery needs to know on which event > type it should be attached to: > > so something like this _ > > $("#pagetitle") > .livequery('load',function() { > //alert($(this).attr("class")); > $("title").text($(this).attr("class")); > return false; > }); > > see the doc for more info:http://brandonaaron.net/docs/livequery/
[jQuery] Re: Livequery not binding on div after a .load method
LiveQuery is actually working but jQuery's text method doesn't work on the title tag. To check that it is working simply add a console.log statement or uncomment your alert line. If you aren't getting the log statement/alert then please post a more complete example. -- Brandon Aaron On Apr 26, 3:01 pm, "Minsk Maz" <[EMAIL PROTECTED]> wrote: > I'm sure this isn't a bug. Here's the node I'm trying to grab -- > > > > The objective is to set the page title to #pagetitle('s) class attribute's > value - the node has no text and is delivered at the beginning of each new > page brought in through a .load ajax method > > The function seems to only fire on the initial page load -- not using .load > -- so when the new instance of pagetitle is brought in by .load livequery > doesn't seem to nortice. > > Thanks in advance for looking this over I've also posted the highlighted > code at -http://www.pastie.org/187268 > > # > > $(document).ready(function() { > > $("#pagetitle") > .livequery(function() { > //alert($(this).attr("class")); > $("title").text($(this).attr("class")); > return false; > > }); > > $(".main_link") > .livequery("click", function(){ > $.cntx = $(this).text().toLowerCase(); > $.div = ' #container'; > $.url = 'http://localhost:8080/test/'+ $.cntx + $.div; > $(".body_content").load($.url); > return false; > }); > > $("#container a") > .livequery("click", function(){ > $.div = ' #container'; > $.url = $(this).attr('href') + $.div; > $(".body_content").load($.url); > //alert($.url); > return false; > }); > > });
[jQuery] Re: how to bind one action to multiple events?
With jQuery 1.2.2 you can now bind multiple events at once. Just separate them with a space. I'd also suggest using the new mouseenter and mouseleave events. $('a') .bind("mouseenter focus mouseleave blur", function(event) { console.log(event.type); }); -- Brandon Aaron On Feb 3, 12:31 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > ... at least, that's what I think I need to do! > > Trying to do a simple a: rollover - but, being a perfectionist, I want > the rollover behaviour triggered by mouseover OR focus. And then, of > course, on mouseout OR blur. > > I tried sticking 2 events together with a | , without success. > However, this is my first attempt at 'binding' so might have done the > whole thing wrong. > > How should I do this? > > Thanks :) Cherry.
[jQuery] Re: How to bind to a dynamically created object
Ugh ... large tables always needs lots of optimizations. First ... you'll want to minimize the number of .append()s. Concat all your HTML into an array and then append. Something like this: var html = []; for (var i in data) { // generate your html like this html.push('blah'); } // once the loop is done ... make the array into one long string and append $('#eintragsliste').append( html.join('') ); Next, you are calling LiveQuery every time you append. That defeats the purpose of LiveQuery. Call LiveQuery once and it matches all new elements for you. None-the-less... When dealing with events on large tables my suggestion is to use event delegation. This is primarily to keep the number of event handlers to a minimum as having lots can cause issues of their own. Here is a new plugin that handles event delegation rather elegantly: http://dev.jquery.com/browser/trunk/plugins/delegate/jquery.delegate.js You'd need to use it like this: $('#eintragsliste') .delegate('click', '.expanding', collapser_expand_all) .delegate('click', '.collapsing', collapser_collapse_all); If you wanted to still use LiveQuery you can use the following: $('.expanding', '#eintragsliste').livequery('click', collapser_expand_all); $('.collapsing', '#eintragsliste').livequery('click', collapser_collapse_all); But remember to put whichever method you use (delegate or livequery) outside the loop and use these methods for their strengths. And remember ... optimize, optimize and optimize some more when dealing with large tables. -- Brandon Aaron On Feb 2, 11:06 am, wyo <[EMAIL PROTECTED]> wrote: > On Feb 2, 5:06 pm, "Glen Lipka" <[EMAIL PROTECTED]> > wrote:>http://brandonaaron.net/docs/livequery/ > > This will do the trick. > > Perfect. > > Yet if I rework the sample to bind each image separate, the script > takes for ages and the browser complains about stopping the script. > > for (var i in data) { >$('#eintragsliste').append( > '' + > ' ' + > ' th>' + > '...' + > ' ' + > ' ' + > '...' + > ' ' + > ''); >$('.expanding, id=#'+i+).bind('click', collapser_expand); > } > > Is this because of my code or livequery? any idea how to solve it? > > Seehttp://www.orpatec.ch/termola/index.php?page=orgslist.php > > O. Wyss
[jQuery] Re: Fighting a closure
One more reply for good measure ... Using jQuery.each will provide you the isolation you need to make your original code work. jQurey.each( [0,1,2,3,4], function(index, num) { $("#port"+num).click(function() { bigchart(num); }); }); You should also be able to write it like this: for ( i=0;i<5;i++ ) { (function(num) { $("#port"+num).click(function() { bigchart(num) }); })(i); } However I'd suggest using one of the other example posted here. :) -- Brandon Aaron On Jan 30, 2:10 pm, timothytoe <[EMAIL PROTECTED]> wrote: > I think I submitted a half-done version of this message by accident a > few minutes ago. Sorry. > > This works: > $("#port0").click(function() {bigchart(0)}); > $("#port1").click(function() {bigchart(1)}); > $("#port2").click(function() {bigchart(2)}); > $("#port3").click(function() {bigchart(3)}); > $("#port4").click(function() {bigchart(4)}); > > I try to roll it up like this: > for (i=0;i<5;i++) { > $("#port"+i).click(function() {bigchart(i)}); > } > > But the closure gets me. When the function is called, i is 5 for any > of the buttons. > What is the elegant solution here?
[jQuery] Re: .clone not work in FF or IE, please help
jQuery.clone(true) will only clone the events that it knows about ... in other words ... it clones the events it bound. -- Brandon Aaron On Jan 29, 10:35 am, chrismarx <[EMAIL PROTECTED]> wrote: > should clone also work for behaviors that were not added by jquery? > (like a google map?) i tried to clone a div with a google map, and > although clone successfully copied all the elements, the behaviors > were lost. append did the job for a workaround. should clone(true) be > able to also grab all the associated behavior from child elements? > > On Jan 29, 10:13 am, Eridius <[EMAIL PROTECTED]> wrote: > > > my code: > > > var append_to = self.element.children('.cr_tab_content'); > > var clone_element = self.element.children('#' + id).clone(true) > > $(clone_element).appendTo(append_to); > > > When I do this my element is still empty but should be filled with the > > cloned element > > > var append_to = self.element.children('.cr_tab_content'); > > var clone_element = self.element.children('#' + id).clone(true) > > $(append_to).append(element.html()); > > > work fine but I want to make sure and events are carried over. any help > > please? > > -- > > View this message in > > context:http://www.nabble.com/.clone-not-work-in-FF-or-IE%2C-please-help-tp15... > > Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: .clone not work in FF or IE, please help
What version of jQuery are you using? Are you getting an error message? Are you trying to clone a table row? jQuery 1.2.2 has a known issue with cloning a table row and a few other elements. The current SVN and jQuery 1.2.3a resolves this issue. Please try using jQuery 1.2.3a to see if that resolves the issue you are having. Otherwise, see if you can create an example for us to look at. -- Brandon Aaron On Jan 29, 9:13 am, Eridius <[EMAIL PROTECTED]> wrote: > my code: > > var append_to = self.element.children('.cr_tab_content'); > var clone_element = self.element.children('#' + id).clone(true) > $(clone_element).appendTo(append_to); > > When I do this my element is still empty but should be filled with the > cloned element > > var append_to = self.element.children('.cr_tab_content'); > var clone_element = self.element.children('#' + id).clone(true) > $(append_to).append(element.html()); > > work fine but I want to make sure and events are carried over. any help > please? > -- > View this message in > context:http://www.nabble.com/.clone-not-work-in-FF-or-IE%2C-please-help-tp15... > Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Bug with dimensions height() fn in IE7
The width and height methods are actually found in the core. If you are able ... Try using the latest SVN version (jQuery 1.2.2 beta2). There have been lots of improvements to the width/height methods. -- Brandon Aaron On Jan 10, 11:20 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > This is a cross post from the UI mailing list -- I mistakenly put it > there when it should have been here. Sorry about that! > > I have a div that has a height of 80%, and this line: > > $('.class:first').height() > > works fine in firefox, but when I try to use it in IE7 it always > returns 1. > > Is there a known workaround for this?
[jQuery] Re: 1.2.2--strictly bug fixes and optimizations? Or have features been added?
Here are the bugs that have been fixed in 1.2.2: http://dev.jquery.com/report/22 1.3 will most likely be the next major feature release but only a couple of ideas so far. -- Brandon Aaron On Jan 1, 7:07 am, Jörn Zaefferer <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb:> Is 1.2.2 a cleaner 1.2.1? Or are there some new > features as well? Is > > there a roadmap somewhere? What's next? 1.3 or 2.0? > > Its a bugfix release with some internal API improvements, most notable > in the event module. An example that uses the new "special" events > API:http://dev.jquery.com/view/trunk/plugins/delegate/jquery.delegate.js > > Jörn
[jQuery] Re: problem with $(String expr, JQuery context)
Try wrapping your context html in a tag. -- Brandon Aaron On Nov 24, 4:16 am, tarini <[EMAIL PROTECTED]> wrote: > If I use this script: > > var str = "xToDo - Gestire progetti con AJAXAttualmente ci > sono progetti e task inseriti nell'applicazione. > >"; > > var context = $(str) > $('b:eq(0)', context).html("example"); > > I'll get this error: > > ret[i].getElementsByTagName is not a function ( jquery.js (line > 1429) ) > > with this StackTrace: > > find("b:eq(0)", "Attualmente ci sono ")jquery.js (line 1429) > find("Attualmente ci sono ")jquery.js (line 247) > map([h1, "Attualmente ci sono ", b, 4 more...], function())jquery.js > (line 1045) > find("b:eq(0)")jquery.js (line 247) > init("b:eq(0)", [h1, "Attualmente ci sono ", b, 4 more...])jquery.js > (line 68) > jQuery("b:eq(0)", [h1, "Attualmente ci sono ", b, 4 more...])jquery.js > (line 23) > jQuery("b:eq(0)", [h1, "Attualmente ci sono ", b, 4 more...]) > myFunction() > > why?? > context is not a JQuery object??
[jQuery] Re: livequery $(this) is null? (this is second post, accidentally clicked post)
I created an example based on the code you provided and was unable to reproduce an error. Could you provide an example online somewhere? http://brandonaaron.net/jquery/issues/livequery/table_test/table_test_2.html -- Brandon Aaron On Nov 20, 7:09 pm, wahyudinata <[EMAIL PROTECTED]> wrote: > jQuery.create_table.prepare_add_item=function() > { > var items=$('#canvas > thead > tr > th'); > var prev_value=''; > var input_item=$('#input_item'); > var head=$('#canvas > thead > tr'); > >// FIRST METHOD > $('#canvas > thead > tr > th').click( > function() > { > alert($(this).attr('id')); > } > ); > ///SECOND METHOD > $('#canvas > thead > tr > th').livequery( > function() > { > $(this).click(function(){ > alert($(this).attr('id')); > }) > } > ); > //THIRD METHOD > $('#canvas > thead > tr > th').livequery('click', > function(event) > { > var elem=$(this); > alert(elem.attr('class')); > if (elem.is('.manipulated'))return; > > elem.addClass('manipulated');//add class that it is > being > manipulated > prev_value=elem.html();//store whatever it's in here > before > // alert(elem.id); > elem.empty(); > elem.append(input_item); > > } > > ); > > THIS IS THE HTML > > > > > > > was > First item to > compare > > > > > > > > > > > > > > > > > > text > number > time > true/false > video > > > > > > on clicking: > The first method works as advertised. > the second method gives me undefined > the third method gives me undefined and will throw an error on > elem.addClass() , the error is "t has no properties" > Am I missing something?
[jQuery] Re: dimensions plugin: relativeTo not working?
The relativeTo needs to be an offsetParent of the element you are trying to get the offset of. Otherwise you need to get the offset of both the elements and do the math. BTW ... jQuery 1.2.x and the upcoming Dimensions 1.2 does not have a relativeTo option. -- Brandon Aaron On Nov 17, 9:41 am, Codex <[EMAIL PROTECTED]> wrote: > Or am I trying to set it the wrong way? > > var getOffset = $(icon).offset({relativeTo: '#col-left' }); > > Also tried the variants: > > var getOffset = $(icon).offset({relativeTo: 'col-left' }); > var getOffset = $(icon).offset({relativeTo: ('col-left') }); > > but I keep getting the same result, and that is the offset relative to > the body. Am I missing something?
[jQuery] Re: how to use :empty selector
You can use the filter method to select what you need. It would look something like this: $(document).ready(function() { $('input[type=text]').filter(function() { return !!$(this).val(); }); }); -- Brandon Aaron On Nov 19, 5:42 am, James Dempster <[EMAIL PROTECTED]> wrote: > :empty "Matches all elements that are empty, be it elements or text." > I think what your checking is value so it isn't covered by this > selector. > > I think you'd have to loop though them all checking the value. > $(document).ready(function() { > $("input[type=text]").each(function () { > if ($(this).val() == '') { > alert("empty text"); > $(this).focus(); > } > }); > > }); > > On Nov 19, 10:19 am, Cyril C <[EMAIL PROTECTED]> wrote: > > > hi all, > > > i want to select all empty tag " > I try this : > > > $(document).ready(function() { > > $("input[type=text]:empty").each(function (i) { > > alert("vide"); > > $(this).val(i); > > }); > > > }); > > > But ALL tag " > one. > > > PLZ help.
[jQuery] Re: Scriptdoc-file for jQuery 1.2.1
We moved to the wiki for many good reasons. One of them being it provides a very good mechanism for allowing the community to contribute to the betterment of the docs. Another reason is it provides some necessary flexibility for documenting things like selectors. There are current efforts to get the results from the wiki into xml which will enable sites like Visual jQuery to run again! Please be patient while we transition the docs because soon they will be even better than what they were. -- Brandon Aaron On Nov 15, 8:03 pm, "Tom Sieroń" <[EMAIL PROTECTED]> wrote: > On Nov 15, 2007 3:47 PM, dehneg <[EMAIL PROTECTED]> wrote: > > > Scriptdoc file is a good **standard** to integrate documentation in > > any IDE. > > It is also a good way to work with documentation. I suppose that > > Yehuda Katz use the jQuery scriptdoc file to generate is Visual jQuery > > Documentation (http://www.visualjquery.com). The actual version of > > Visual jQuery is for jQuery 1.1.2. > > It would be great to have an up to date version of visualjquery! > > It's much easier and faster than the wiki where you have to wait for > all the page reloads just to see a snippet of code :(. It gets even > worse when you don't know what exactly you're looking for. So many > links, so many page reloads, so many tabs and relatively little > content :(. > > -- > Tom Sieroń. > Skype: tom.sieron :: GG 590961 :: T +48 505 034 > 253http://www.linkedin.com/pub/dir/tom/sieron
[jQuery] Re: Triggering event added by addEventListener
The best approach will be to just use jQuery to bind the method if you want to trigger that event. -- Brandon Aaron On Nov 15, 11:49 am, prakash <[EMAIL PROTECTED]> wrote: > Hello all, > > I recently started using jQuery in Greasemonkey scripts and am loving > it. > > I have two Greasemonkey scripts running on a page. Script A adds an > element to the page and binds a mouseover handler using DOM > addEventListener method. This script is not using jQuery. > > Script B wants to trigger the event on that element added by script A > using the jQuery .trigger('mouseover') method. But the event doesn't > fire. > > Looking at jQuery code (1.2.1) and with the help of Firebug, I found > that .trigger('...') fires if the event handler was specified using > 'on...' attributes to an element. But it doesn't fire if the event > handler was bound via addEventListener. This seems to be true whether > the element was "native" to the page or was dynamically added later by > Greasemonkey. > > Is there any way I can make this work, short of merging the two > scripts (which I'd rather not do), or rewriting the script A to use > jQuery .bind() method to bind the event handler? > > Thanks for your time. > /prakash
[jQuery] Re: offset() causes error in IE
Make sure that IE is actually selecting the checkbox. Otherwise it would seem as though IE doesn't implement getBoundingClientRect for checkboxes even though they claim it does. Would you mind filing a ticket for this: http://dev.jquery.com/newticket In the mean time ... try wrapping the input with a span. -- Brandon Aaron On Nov 14, 5:49 pm, Bernd Matzner <[EMAIL PROTECTED]> wrote: > Hi, > > I have a page in which I'm trying to use offset() on a checkbox (using > jQuery 1.2.1) > In FF, everything works fine, but I'm getting an "Object doesn't > support this property or method" in IE6 and IE7. > The debugger indicates that the error occurs where jQuery tries to do > "box=elem.getBoundingClientRect()". > The page is valid XHTML, and the checkbox is located in a table row. > Sorry, I don't have a test page I could post. Any hints? > > THanks, > Bernd
[jQuery] Re: Scriptdoc-file for jQuery 1.2.1
jQuery 1.2 has removed the scriptdoc from the source in favor of managing documentation via the wiki (http://docs.jquery.com/). -- Brandon Aaron On Nov 14, 7:35 am, dehneg <[EMAIL PROTECTED]> wrote: > Hi all, > > I am looking for the scriptdoc file (http://www.scriptdoc.org/) for > jQuery 1.2.1. > Any one knows where I can download it ? > > Thanks, > Alex
[jQuery] Re: gradient plugin - wont work on td's?
Try: $('.gradient').wrapInner('').find('> span').gradient(); On Nov 14, 1:29 pm, bdee1 <[EMAIL PROTECTED]> wrote: > currently i am matching the td's based on a gradient class. so like this: > $('.gradient').gradient(); > > how that work? > > > > Brandon Aaron wrote: > > > Try wrapping the contents of the td with a span first and then > > applying the gradient to the span. Something like this: > > > $('td').wrapInner('').find('> span').gradient(); > > > -- > > Brandon Aaron > > > On Nov 14, 12:13 pm, bdee1 <[EMAIL PROTECTED]> wrote: > >> anyone have an idea on this? > > >> bdee1 wrote: > > >> > i am trying to programatically add gradients to table header cells and > >> i > >> > came across the gradient plugin > >> > (http://jquery.com/plugins/project/gradient). it seems that this > >> plugin > >> > works well for creatign gradients in divs but when i try and apply it > >> to a > >> > td, it seems to work in ie but in firefox, it puts the gradient at the > >> top > >> > of the page rather than in the td. > > >> > can anyone think of a possible workaround for this? > > >> -- > >> View this message in > >> context:http://www.nabble.com/gradient-plugin---wont-work-on-td%27s--tf480594... > >> Sent from the jQuery General Discussion mailing list archive at > >> Nabble.com. > > -- > View this message in > context:http://www.nabble.com/gradient-plugin---wont-work-on-td%27s--tf480594... > Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: gradient plugin - wont work on td's?
Try wrapping the contents of the td with a span first and then applying the gradient to the span. Something like this: $('td').wrapInner('').find('> span').gradient(); -- Brandon Aaron On Nov 14, 12:13 pm, bdee1 <[EMAIL PROTECTED]> wrote: > anyone have an idea on this? > > bdee1 wrote: > > > i am trying to programatically add gradients to table header cells and i > > came across the gradient plugin > > (http://jquery.com/plugins/project/gradient). it seems that this plugin > > works well for creatign gradients in divs but when i try and apply it to a > > td, it seems to work in ie but in firefox, it puts the gradient at the top > > of the page rather than in the td. > > > can anyone think of a possible workaround for this? > > -- > View this message in > context:http://www.nabble.com/gradient-plugin---wont-work-on-td%27s--tf480594... > Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Scripts at the bottom of the page
Actually, it isn't outside the scope of jQuery and it is now fixed in Rev 3822. -- Brandon Aaron On Nov 13, 10:34 pm, Brandon Aaron <[EMAIL PROTECTED]> wrote: > This is pretty much outside the scope of jQuery :/. You should bind > events that have the potential to be triggered before the page is > loaded within $(window).bind('load', fn). This will insure that the > page is ready to accept your events ... otherwise the browser just > isn't ready for you to interact with the page. > > -- > Brandon Aaron > > On Nov 9, 4:55 pm, mike503 <[EMAIL PROTECTED]> wrote: > > > > Yes, please do. > > >http://dev.jquery.com/ticket/1911 > > > Hopefully it will get the right eyes looking at it now :)
[jQuery] Re: Scripts at the bottom of the page
This is pretty much outside the scope of jQuery :/. You should bind events that have the potential to be triggered before the page is loaded within $(window).bind('load', fn). This will insure that the page is ready to accept your events ... otherwise the browser just isn't ready for you to interact with the page. -- Brandon Aaron On Nov 9, 4:55 pm, mike503 <[EMAIL PROTECTED]> wrote: > > Yes, please do. > > http://dev.jquery.com/ticket/1911 > > Hopefully it will get the right eyes looking at it now :)
[jQuery] Re: Scripts at the bottom of the page
This is pretty much outside the scope of jQuery :/. You should bind events that have the potential to be triggered before the page is loaded within $(window).bind('load', fn). This will insure that the page is ready to accept your events ... otherwise the browser just isn't ready for you to interact with the page. -- Brandon Aaron On Nov 9, 4:55 pm, mike503 <[EMAIL PROTECTED]> wrote: > > Yes, please do. > > http://dev.jquery.com/ticket/1911 > > Hopefully it will get the right eyes looking at it now :)
[jQuery] Re: Event binding memory leak
This is fixed in the latest SVN. -- Brandon Aaron On Nov 4, 8:48 pm, tim connor <[EMAIL PROTECTED]> wrote: > When a page is unloaded, jQuery is not unbinding any bound events > causing a memory leak in IE6. > > Below is a very simple test page. If it is opened in IE6 you can see > the memory usage skyrocket. > > > > > > > $(document).ready(function() { > // Bind an onClick event to the body > $("body").click(aFunction); > > // Reload the page > window.location.reload(); > }); > > function aFunction() {} > > > > > > > > If you add the code below into the page somewhere, the memory no > longer increases. > $(window).unload(function() { > $('*').unbind(); > > }); > > Can something similar to this be added to the jQuery library?