[jQuery] please test my link - takes only 2 secs
Hello all, if you have 2 seconds to spare, please see http://www.tilmauder.com/as4/JS2ASinJquery.htm and send me errors you may (or rather hopefully WILL NOT) be getting. What's supposed to happen: the page displays an orange swf file with a dynamic text field. When you click the button at the top, the text inside the orange swf is supposed to change. I'm interested in people who run: IE7, IE8, FF3 on Windows XP, Vista, 7 Safari 4, FF3 on Mac OSX Thanks a bunch! Your help is appreciated.
[jQuery] Re: weird animate() flicker in strict DTD in FF3
I can't believe no one else has seen this? I've tried to isolate the problem but so far, it's pretty consistent.
[jQuery] weird animate() flicker in strict DTD in FF3
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/ TR/html4/strict.dtd script type=text/javascript src=jquery-1.3.2.min.js/script $('.item').click(function(){ $('#slider').animate({ // this element is inside another DIV that has CSS overflow:hidden; top: '-200px' },1200); } In FF3, this causes a jaggedy sliding of the elements, very ugly. Looks like the elements are literally jumping up and down while sliding. Not a problem in IE7, though... Has anyone else seen this?
[jQuery] Re: Ajax loaded pages..
no, you should normally be able to use javascript and jquery whereever you want. you probably aren't addressing your frames/iframes correctly. On Jul 20, 9:16 am, Spiatrax vedran.vuce...@gmail.com wrote: Ok, i got problem. When i load some page with jquery ajax i cant use javascript on loaded page. For example, when i load gallery.htm in some div in index.html, lightbox wont work. Is this usual or..?
[jQuery] Re: Scrolling between images in list item
you should separate the nav links from the image collection, i.e. place the images in one container and the anv anchors outside of it; that way you won't run into problems with siblings that aren't images.
[jQuery] yet another frames-related problem
I did this: $('body').append('iframe name=myFrameName3 src='... etc... now I want to attach a click event to something inside that frame. Does anyone know why the context parameter of the click() below does not work? I can't get the alert to show up. $('#someDiv', top.frames['myFrameName3'].document).click(function(){ alert( $(this).attr('id') ); });
[jQuery] frames references
$('#someDiv', top.frames['myFrame'].document) doesn't return anything, what am I doing wrong?
[jQuery] Re: Can JQuery solve the iframe height=100% problem?
I think you're going down the wrong path - you shouldnt need to script anything to get a CSS attribute to work. usually when I run into this problem it is because somewhere in my document tree there is a parent lement that has no height attribute set. So if you have html someDiv anotherDiv table tr td iframe every one of the elements should have a parent with height set At least this is how I usually end up solving the dreaded height 100% problem whenever I come to it. Alternatively, you can try $('#myIframe').css({height:$(this).parent('td').height()});
[jQuery] Re: what would be the opposite of top.frames as a jquery selector context?
it ended up being quite easy actually: $('#'+self.name, top.document).hide(); usually whenever I try to so something and it requires more than 1 line of code it's my fault, not jquery's...
[jQuery] what would be the opposite of top.frames as a jquery selector context?
If i want to do something in a parent frame, I would do this: $('#myDiv', top.document).hide(); but what about this following scenario? I'm inside a frame that was created like so: $('body', top.document).append('iframe id=myiframe/iframe'); inside myiframe, I now want to know the id of my iframe, because I would not know it. All I am able to see in the DOM is the topmost document. I could traverse through all the iframes and get their ID's but that's useless because I wouldn't know which of them is the one I'm currently in. I suppose I'm simply trying to pass a variable to a child frame so it becomes available on the frame's document.onload().
[jQuery] getting to a variable in the parent frame - stumped
I'm using frames (don't ask) and have exhausted my abilities (sniff)... here is some pseudo-code to illustrate the situation: first, CONTAINER.HTM: script src=jquery.js/script $(function(){ var module = { something1 : function(var1){ alert(var2); } } }); iframe src=iframe1.htm/iframe - now, IFRAME1.HTM script src=jquery.js/script $(function(){ $('#myDiv').click(function(){ top.frames[0].document.module.something1('hello'); // this line above is the part where I'm stuck. //why won't this darn thing cooperate and alert my variable? }); }); div id=mydivclick me/div
[jQuery] Re: getting to a variable in the parent frame - stumped
thanks - that was an interesting consideration. Unfortunately didn't make a difference. (still scratching head)
[jQuery] Re: getting to a variable in the parent frame - stumped
oh! I got it. thanks Jay, your suggestion gave me the hint I needed to figure it out. removing var did 1/2 the trick, the second 1/2 was me realizing that now I have module as object of the top document, so top.module.something1('hello'); works. yay! this drove me crazy last night!
[jQuery] trying to get parent frame from mouse event
whats the best way to find the frame name of a click event? in FF I managed to do this: $('#'+e.view.name, top.document) but e.view.name is undefined in IE.
[jQuery] Re: sd
sqrt
[jQuery] why does $('.myDiv', top.frames[0]).hide() not work?
I'm totally not getting it... but you might, I hope :) I appended an iframe: $('body').append('iframe...etc/iframe'); The iframe source has jquery in the header and it works. now I want to do something in that iframe, like hide a div. I want to do this from the top.frame... $('.myDiv', top.frames[0]).hide(); but, it doesn't work!??!? I'm lost. Been googling, all I find is stuff about getting stuff to work in the parent frame - why wouldnt the same work for a child frame? THanks for pointers! much obliged...
[jQuery] Re: why does $('.myDiv', top.frames[0]).hide() not work?
I love answering my own ?'s ;P $('.myDiv', top.frames[0] .DOCUMENT ).hide(); works - forgot to add the document reference.
[jQuery] ajax request on local machine and FF3/Firebug Access to restricted URI denied code: 1012
this has been discussed before, but I'm still hazy: In FF2 and old Firebug this function ran fine with local files (no local web server, just straight-up file on local desktop). Now Firebug complains Access to restricted URI denied code: 1012 $.ajax({ type: POST, url: myFileName, data: {}, dataType: jsonp, async: false, success: function(ret){ JSON=eval('('+ret+')'); } }); I added the line dataType:jsonp after reading up on this inside the list archives. This did nothing. I don't feel like running all my stuff on a local web server just so I can do some simple ajax - am I stuck? Should I downgrade to older Firebug? Any pointers much appreciated!
[jQuery] Re: ajax request on local machine and FF3/Firebug Access to restricted URI denied code: 1012
I should add that I'm calling just by file name myJsonSource.js - everything is very local, so I'm not even using any sort of domain at all, and feel that this should be just fine for running stuff locally. Looked at settings to see if there is anything I can turn off...
[jQuery] Re: ajax request on local machine and FF3/Firebug Access to restricted URI denied code: 1012
I downgraded both FF 2 and FB 1.2 so now things work again - but this sucks! Someone tell those nice folks at Mozilla they should at least allow a user setting to not get so uptight about script loading security - I was very surprised to see no ability to adjust that manually.
[jQuery] Re: ajax request on local machine and FF3/Firebug Access to restricted URI denied code: 1012
except its not a bug - its a feature request... On Jan 16, 2:39 pm, donb falconwatc...@comcast.net wrote: By the way, you are 'someone' so you can file a bug report. ;-) - note smily On Jan 16, 5:15 pm, jquertil til...@gmail.com wrote: I downgraded both FF 2 and FB 1.2 so now things work again - but this sucks! Someone tell those nice folks at Mozilla they should at least allow a user setting to not get so uptight about script loading security - I was very surprised to see no ability to adjust that manually.- Hide quoted text - - Show quoted text -
[jQuery] .hide() and .height()
I noticed today after much fiddling that .hide() causes the parent element to loose its height(). In other words, height() won't work on elements that have display:none -- causing me to use .hide() only AFTER I've done my .height() - based calculations. I suppose that makes sense but I somehow never really thought that element.height is an attribute that gets set to 0 if display:is set to none...or whatever is actually going on.
[jQuery] iframes and livequery
after searching I found this, which is close but no cigar. http://plugins.jquery.com/node/3997 I appended an iframe to my document, and use livequery: $('.LQelements').livequery(function(){... which works in the top.document, but not in the iframe. How can I re-use this? I don't want to have to copy the function into the body of my iframe source file. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups jQuery (English) group. To post to this group, send email to jquery-en@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/jquery-en?hl=en -~--~~~~--~~--~--~---
[jQuery] Re: iframes and livequery
$('.LQelements', frames[myIframe].document).livequery(function(){... doesn't work either :(
[jQuery] livequery Component returned failure code: 0xc1f30001
alright, this one is a different one... I don't even know what I'm supposed to be looking for in order to debug this. Below is a Firebug console error. Anyone has some insight? much obliged! [Exception... Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIDOMJSWindow.setTimeout] nsresult: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) location: JS frame :: file:///C:/lib/livequery-1.0.2.js :: anonymous :: line 1 data: no] data()(Document , events, undefined)jquery-1.2.6.js (line 679) remove()(Document , undefined, undefined)jquery-1.2.6.js (line 1912) unbind()()jquery-1.2.6.js (line 2244) each()(Object length=25 0=html 1=head 2=script 3=script 4=script, function(), undefined)jquery-1.2.6.js (line 745) each()(function(), undefined)jquery-1.2.6.js (line 138) unbind()(undefined, undefined)jquery-1.2.6.js (line 2243) (?)()()jquery-1.2.6.js (line 2414) one()(Object originalEvent=Event unload type=unload)jquery-1.2.6.js (line 2235) handle()(Object originalEvent=Event unload type=unload)jquery-1.2.6.js (line 2076) (?)()()jquery-1.2.6.js (line 1858) remove()(undefined)jquery-1.2.6.js (line 1317) each()(Object length=1 0=iframe.popupDetail prevObject=Object, function (), [])jquery-1.2.6.js (line 734) each()(function(), [])jquery-1.2.6.js (line 138) (?)()()jquery-1.2.6.js (line 1331) (?)()()3DYR8yd%...e3Q%3D%3D (line 1) (?)()()popup.htm (line 189) handle()(Object originalEvent=Event click which=1 view=window) jquery-1.2.6.js (line 2076) (?)()()jquery-1.2.6.js (line 1858) [Break on this error] jQuery.cache[ id ][ name ] :
[jQuery] toggleClass and CSS inheritance
.toggler {background:#fff;} .open {background:#000;} $('.toggler').click(function(){ $(this).toggleClass('open'); } It's really a CSS problem, because the DOM does toggle the classname. But the background does not change. div class=toggler openblah/div Only solution I can think of is not using toggleClass, but its so nice and simple that way. Anyone know a solution by chance? Thanks a lot!
[jQuery] Re: toggleClass and CSS inheritance
keeping in tradition of answering my own questions, I came up with this solution but I don't like it much because it's more code. I use jquery because its supposed to be less code :) $('.toggler').click(function(){ $(this).toggleClass('open'); $(this).attr('class')=='expander' ? $(this).attr('class','open') : $ (this).attr('class','expander'); } So the question still stands: any ideas on how to get this effect going more elegantly?
[jQuery] Re: How to select a group of similar named objects?
you're better served using class grouping and setting up your elements like div class=tag_cWeb_TSW id=Day01blah/div then you can select with the class, and the individual elements with the id attribute, respectively.
[jQuery] Re: How to select a group of similar named objects?
aslo, $('#tag_cWeb_TSW_Day*').css('visibility', 'hidden') that can just be $('#tag_cWeb_TSW_Day*').hide()
[jQuery] empty().append() slow
if I have a lot of elements inside div classfull.../div and then do $('.full').empty().append ('blah'); it takes a long time. Is there a way to speed that up?
[jQuery] Re: toggleClass and CSS inheritance
thats quite creative thinking, I like it! thanks!
[jQuery] Re: Link in an iFrame changing Parent window elements
sorry I dont really understand your question, but inter-frame actions work something like this: $('#button').click(function(){ $(#divInParentFrame,top.document).remove(); }); read up on jquery's selectors and additional parameters, its all in the documentation. notice the comma after the element selector, that's where you address the frame to which you want to talk to
[jQuery] Re: empty().append() slow
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] offset() returns different values between resize and onload events
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; } div id=positioned style=margin:0 auto;width:100px;hello/div
[jQuery] Re: Looking for always vertically centered select box....
can't use a select box (i.e html SELECT tag) because that is all O/S based. you would have to custom-build your popup as divs, position them based on the element you clicked on and have some conditional statement that decides whether to pop it at top or bottom of the clicked-on element. your questions sounds like you're not too familiar with these details and I doubt there is a plugin for it. most Select-replacement plugins simply try to recreate the standard popup behavior. HTH
[jQuery] Re: Finding the element which has focus
you should be able to return the focus() event. if( $('#navTable').focus() == true ) might need to play with the selector to get it right.
[jQuery] Re: offset() returns different values between resize and onload events
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] passing parameters to new Function as array... possible?
its really a javascript question... The 3 parameters var1, var2, var3 that are used my my new Function - I'd like to be able to do this using an array. After an hour on the web I haven't been able to find a way... var fn = new Function( 'var1','var2','var3', func); fn( var1, var2, var3); in my imagination I had hoped to do something like this: var my_array = new Array('var1','var2','var3'); var fn = new Function(my_array , func); fn( my_array);
[jQuery] Re: Superfish, it rolls... quiet complete
your page throws a few errors and I didn't see jquery being loaded, only some plugins.
[jQuery] Re: What's the syntax for this.find('input','textarea').each...?
'input','textarea' == this would try to find INPUT tags inside a context of TEXTAREA tags. you want: 'input, textarea' == remember the jquery selectors behave like CSS selectors.
[jQuery] Re: Query on JQuery - Related to Panels, AJAX Form Submit
you're looking at pretty much completely re-architecting your app. I originally thoguht ajax-loading scripts and css is a no-brainer, but discovered it's kind of a hassle, though certainly doable.
[jQuery] $.get(0) is causing trouble
$all = $('.listing .myDivs'); $all.get(0).css('color','#339900'); why would this throw an error function css does not exist ?? I tried this too with no luck: $('.listing .myDivs').get(0).css('color','#339900');
[jQuery] traversing list using keyboard
Hello... this has to be something poeple have done before. I managed to only do about half of what I intended to - I'm stuck in the middle (seee //comment). I got a list of stuff and want to be able to select items using the arrow keys. ol li class=itemblah/li ...etc... I've bound key events to the OL but am stuck getting a clean and simple solution for doing the following: 1. check if any Li has class 'active' 2. if no such luck, set the first Li 's class to active. 3. if I do find a Li with 'active' class, return its index So, I tried this: $('ol').bind('keydown, keyup', function(event) { if(event.keyCode==38 || event.keyCode==40){ $('ol li').each(function(element){ if( $(this).hasClass('active') ){ // and now I'm stuck and don't know what to do. is this even the right approach? } } } }
[jQuery] Re: Is there a plugin to zoom in/out an image
I would have guessed he was looking for something like google maps zoom (with scrollwheel support). I haven't seen one of those...
[jQuery] Re: i wish there was a way to get the entire CSS for an element... or is there?
ok fine so I use a class - still having the same lack of understanding: how do I get the contents of the CSS class into a variable?
[jQuery] Re: document.write and DOm creation - performance optimization?
huh. this is an interesting thought. why would the use of join() speed things up versus just appending a string variable? the reason I'm not concerned about the for() loop is that it seems to be quite fast when I output the strHTML in a document.write. I'm trying to figure out wasy to speed up the rendering by doing something other than html()... but I can't think of anything.
[jQuery] Re: $.getScript() - how to load into JSON formatted object?
they thanks for the reply. I don't fully understand what the parameters in this line do exactly. why is variable in 'quotation' marks? fn = new Function( 'variable', code ); thanks! On Jul 8, 4:03 pm, Michael Geary [EMAIL PROTECTED] wrote: OK, try this. It's the same idea as the code I posted before: var blah = { dynaLoad : function( variable ) { $.get( 'alert.js', function( code ) { var fn = new Function( 'variable', code ); fn( variable ); }); }, somethingElse : '' }; blah.dynaLoad('cool beans'); -Mike -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Ofjquertil Sent: Tuesday, July 08, 2008 1:37 AM To: jQuery (English) Subject: [jQuery] Re: $.getScript() - how to load into JSON formatted object? thanks for the answer Mike. I probably wasn't very clear. I'm trying to make the loading happen as part of blah.something(variable). something kinda like this: var blah ={ dynaLoad : function(variable){ $.getScript('alert.js',variable) // the script would simply contain the line alert(variable); }, somethingElse : '' } blah.dynaLoad('cool beans'); // this would now produce a cool beans alertbox.
[jQuery] i wish there was a way to get the entire CSS for an element... or is there?
#myDiv {height:200px;background: #FF9900;} $('#myDiv').css(height'); // returns 200px' but how can I get the whole enchilada so I have it in a nice and neat object? I imagine something like this: $myCSS = $('#myDiv').css(); $('.otherDivs').css( $myCSS);
[jQuery] proposing a new function for swapping classnames
$(p).hover(function(){ $(this).addClass(hover); },function(){ $(this).removeClass(hover); }); this is kind of a verbose way of swapping classes, isn't it? I imagine it would not add much to the lightweightness of jquery if it allowed something like: $(p).hoverSwap(hover); or, if more versatility is desired, perhaps something like: $(p).swapClass(hover, click); // hover is class name and click is the event name I can use my own extension I suppose, but then again, swapping classes on hover and click seems like such an often-used functionality it might just warrant inclusion into the library... just an idea...
[jQuery] document.write and DOm creation - performance optimization?
I searched the group for this and came across my own old post (http:// groups.google.com/group/jquery-en/msg/18d7fa95c5f01d2d) I've noticed that when displaying a large number of elements into a page, it takes a bit of time to render. but in order to use document.write, I would have to write to an iframe, and I don't want to do that. is there a particuarly efficient way to populate a page with results in jquery? I can't afford a 2.5 second lag. any ideas much appreciated.
[jQuery] Re: document.write and DOm creation - performance optimization?
posting all code would be crazy but here is relevant snippets. First the loop I use to iterate ofer an array and write some stuff into a bunch of DIV elements. I then want that tho show up someplace on my page. iframe and document.write displays 500 items basically instantly. the html() to div element takes about 4 seconds or so in IE7. for ( var k = 0; k v_foundarray.length; k++ ) { strHTML += 'div'+v_foundarray[k] + '/div'; } //window.ifrm.document.open(); //window.ifrm.document.write(strHTML); //window.ifrm.document.close(); $('div.displayer').html(strHTML);
[jQuery] array find (more of a JS question) and regex (regular expression)
okay i hope no one flames me for posting something thats really about javascript, but then again my toiling is ultimately geared towards a jquery plugin, so maybe you will forgive me... the code sample below uses a prototype function that searches an array. There is a sampe array, and then I am trying to test it with the alert(). it works fine when I just search for something like 30 or blue (uncomment the other vars below to check for yourself), but it returns FALSE if I use a regex. The prototype seems to be commonly known because it's the only one I keep coming across when searching fopr this... Anybody got any ideas on how to make the regex work? I've searched all evening... Thanks! Array.prototype.find = function(searchStr) { var returnArray = false; for (i=0; ithis.length; i++) { if (typeof(searchStr) == 'function') { if (searchStr.test(this[i])) { if (!returnArray) { returnArray = [] } returnArray.push(i); } } else { if (this[i]===searchStr) { if (!returnArray) { returnArray = [] } returnArray.push(i); } } } return returnArray; } var tmp = [5,9,12,18,56,1,10,42,'blue',30, 7,97,53,'gcycle', 30,35,27,30,'35','Ball', 'bubble']; var regexp1=tmp.find(/^Bal/); //var regexp1=tmp.find(/^b/); //var regexp1=tmp.find(30); alert(regexp1);
[jQuery] Re: $.getScript() - how to load into JSON formatted object?
thanks for the answer Mike. I probably wasn't very clear. I'm trying to make the loading happen as part of blah.something(variable). something kinda like this: var blah ={ dynaLoad : function(variable){ $.getScript('alert.js',variable) // the script would simply contain the line alert(variable); }, somethingElse : '' } blah.dynaLoad('cool beans'); // this would now produce a cool beans alertbox.
[jQuery] is dimensions now part of jquery or not? (I hear different opinions)
the other day was told latest jquery now includes dimensions plugin but I was certain it does not... I still assume it does not, thus I compile the dimensions plugin into my standard jquery deployments... can anyone shed light on this? thanks.
[jQuery] Re: is dimensions now part of jquery or not? (I hear different opinions)
excellent! Yes, Dimensions is completely a part of jQuery as of jQuery 1.2.6.
[jQuery] Re: Running a loop for array numbers
not knowing your actual HTML I would try something like this: $('.equipment a.i-right1:gt(0)').each(function(){ $(this).hide(); }); loops over the colletion of your tabs or whatever it is except the one that has index 0. read up jquery docs on each() and :gt() for details .
[jQuery] $.getScript() - how to load into JSON formatted object?
var blah = { something : function(variable){ alert(variable); }, something_else : 'hello' } alert( blah.something_else() ); // 'hello' blah.something('whatsup'); // 'whatsup' so far nothing unusual... but... how can I put the blah.something function into a separate .js file and load it? Played around with $.getScript() but nothing works :( Ideally, my file alert.js would contain only the line with alert(variable); in it. Can that be done?
[jQuery] Re: jQuery toggle at first click
gotta do .each() - look it up in documentation $('div').each(function(){ $(this).toggle(...etc...) });
[jQuery] jquery and event binging - livequery
wouldn't it make sense to combine the livequery functionality with jquery directly? the nice thing about jquery is the ability do build elements on the fly. then why not have event capture natively to all newly created elements?
[jQuery] recursive function that includes event binding
trying to do something pretty simple: 1. build a list from an ajax request 2. build a sub-list for the list item on click. this is also made via ajax request Clearly, we're talking recursion here, since I'd lik to get away with just one single function that is kind of a template. All I pass to the function is a set of name-value pairs, and those create the list label and a variable for the respective hyperlink. The tricky bit: There actually aren't hyperlinks, but rather div elements that need a click event bound to it. I can make my divs, but the problem is I can't click them - and I don't want to have to use livequery... I'm sure someone has done this already and is willing to cut/paste code? meanwhile I shall keep searching the group for this... thanks!
[jQuery] Re: jQuery toggle at first click
you don't need the click() function. toggle() does that for you already
[jQuery] jquery documentation of exlusion pseudo-class
according to jquery documentation I should be able to select an element that is NOT something, i.e. exclusion. DOM: divhello spanthere, how are/span you?/div JQUERY SELECTOR: $('DIV :not(SPAN)') SHOULD RETURN: divhello you?/div right? well, it's not happening for me... what am I dogin wrong?
[jQuery] Re: New Plugin: Magnify
dude, that's a totally sweet plugin.
[jQuery] checkbox manipulation and toggle()
Hello... short version: how do I exclude an element in my selector expression? long version: you know those checkboxes in windows where you can actuyally click the label to check the box? I'm recreating this with a toggle() like this: DIV id=CheckContainerINPUT type=checkbox id=Check/ Click here/div $(#CheckContainer).toggle( function(){ $('#Check')[0].checked=true;}, function(){ $('#Check')[0].checked=false;} ); All fine and dandy as you click the DIV to toggle the checkbox. But try to click the checkbox itself and the darn thing won't work. I think the solution is in using the right sleector, like some kind of :not or !:input or something ??? Ii DONT want to have to add a span element around the label to assign the click to, I'd like to just exclude the checkbox.
[jQuery] Re: checkbox manipulation and toggle()
OK I tried my own anticipated solution after looking at some comment from The Man Himself, but didn't work. $(#CheckContainer:not(#Check)).toggle(...); --- does not work. stil can not click the checkbox :(
[jQuery] Re: event binding on dynamically created elements? stumped
Ah, yes, livequery looks nice. Thanks. I'm really trying to get away without any plugins however. Is livequery the only option for binding events to ajax-loaded DOM elements? All the suggestions so far would require the event handler to reside inside the function that loads the new DOM element. Thanks.
[jQuery] event binding on dynamically created elements? stumped
Hello... I'm creating an input element like this: $(this).after('input type=text name=symptom value=Enter Symptom class=focusClear/ '); then I want to clear the value on focus like so: $('.focusClear').focus(function(){ $(this).val(''); }); Obviously this doesnt work cine jquery doesnt know about the element yet. Do I need to write it as an extension? Thanks!
[jQuery] JSON array size different in IE than in FF
I'm at the end of my rope and REALLY hope someone knows how to address this: got some JSON like so: var Data= { Music : [ {Band:The Beatles,Title:Hey Jude}, {Band:The Beatles,Title:Help!}, ] } And I'm simply looping over it like so: $(Data.Music).each(function(i){ alert( Data.Music.length); }); in FF all is well, but in IE I get 2 alerts and a fatal error (null or not an object) because the length is 3, not 2! I wish I had any clue what's going on. How can I fix this? Thanks!!!
[jQuery] $.each() versus for() -- array size inconsistency between IE and FF
I just posted something around problems with IE counting an object variable size differently than FF does. I dont know how to fix it without changing the $.each() statement with a for() loop. for(i=0; iJ.length-1; i++){ alert (J.length); } this works. But this code below makes IE think J.length is larger by 1, compared to FF. Because of that, IE throws a fatal error in its last loop, since J is no longer defined. $(J).each(function(i){ alert (J.length); }); Am I wrong to assume that his each() function from jquery should behave exactly the same way across browsers? I'm sure there is something I'm missing, I just don't know what.
[jQuery] Re: JSON array size different in IE than in FF
I just posted something around problems with IE counting an object variable size differently than FF does. I dont know how to fix it without changing the $.each() statement with a for() loop. for(i=0; iJ.length-1; i++){ alert (J.length); } this works. But this code below makes IE think J.length is larger by 1, compared to FF. Because of that, IE throws a fatal error in its last loop, since J is no longer defined. $(J).each(function(i){ alert (J.length); }); Am I wrong to assume that his each() function from jquery should behave exactly the same way across browsers? I'm sure there is something I'm missing, I just don't know what. PS: sorry for all the double-posting, but something weird happening on googlegroups, telling me the posts are all empty.
[jQuery] Re: jQuery and JSON - newbie!
assuming your hover links also have a class name like tip, and your JSON is set like a proper variable named, say, allTolltips, it probably will look something like this: $('.tip').hover( function(){ if( allTooltips.items.id) == $(this).attr('id') ) {showToolTip();} }, function(){ hideTooltip(); });
[jQuery] Re: JSON array size different in IE than in FF
Karl, thanks -- that's nice but its got the same problem: the length of the object is 1 item larger in IE than it is supposed to be. I wonder why jquery adds an extra empty item into the object?!
[jQuery] Re: JSON array size different in IE than in FF
OMG !! Karl, U R the Gr8est! I should have gone home... but how can you leave work with a silly bug in your script, right? The stray comma was of course the culprit. A, I can go home now.. Dude, if you are in S.F. Bay Area send me a message I will totally buy you a beer! Seriously! [heaves big sigh of relief] On Apr 30, 6:40 pm, Karl Rudd [EMAIL PROTECTED] wrote: You've got a stray comma (,) at the end of the last object in the array: {Band:The Beatles,Title:Help!}, -- Firefox ignores it, IE creates a blank object. Karl Rudd On Thu, May 1, 2008 at 11:35 AM, jquertil [EMAIL PROTECTED] wrote: Karl, thanks -- that's nice but its got the same problem: the length of the object is 1 item larger in IE than it is supposed to be. I wonder why jquery adds an extra empty item into the object?!
[jQuery] Re: JSON array size different in IE than in FF
dont forget TBB, temporary bracket-blindness :)
[jQuery] hover and event bubbling (return false)
hello... I cant seem to solve this on my own. I've built a little tooltip hover widget that remains open even on mouseout so as to allow the mouse to click inline links etc. but it does not disappear when the mouse just moves off the span id=tools I think the code below is totally wrong structure but I can't logically figure out how I need to build this right. $('#tools').hoverhelp('this is help text',1); $.fn.hoverhelp = function(txt,sticky) { // second attribute is used in switch () below return this.each(function() { $(this).hover( function(e){ // mouseover '#tools' $('#helpdiv').html(txt); }, function(){ // mouseout '#tools' switch(sticky){ case 1 : // keep tooltip open $('#hoverhelp').hover( function(){$(this).show();}, function(){$(this).hide();} ); break; default : $('#hoverhelp').hide(); break; } } ); }); };
[jQuery] event logic
not sure if my problem actually can be solved - it might be to inconsistent with the event logic of any programming language... bt anyhow, here goes: 1. a mouse rolls over an element, firing the mouseover event. 2. the action bound to the mouseover executes 3. the mouse rolls off the element, firing the mouseout event 4. the action bound to the mouseout event executes. The twist: while still *inside* the element, the mouse rolls over *another* element which was created in step 2. , thus firing the mouseout. This is not supposed to happen. Now what? Thanks for thinking about this...
[jQuery] hover() and flickering problem
I use this extension code to make a hover tooltip. I want the tooltip (a div with position:absolute) to display on top of the hovered element. This works great. But when moving the mouse, the mouseout and mouseover events are being fired all the time, causing a flicker effect. How do I escape that? I tried to place a 'return false' in the hover but no luck. $.fn.hoverhelp = function(txt) { $T = $(this).position().top; $L = $(this).position().left; $(this).hover( function(e){$('#hoverhelp').empty().html(txt).css({top:$T,left: $L}).show();return false;}, function(){$('#hoverhelp').hide();} ); };
[jQuery] Re: Calling a jQuery function from within an ajax-loaded div
you want to ook into the getScript() function. the SCRIPT tags arent interpreted by jquery, so you have to load the script separately. On Mar 27, 4:10 pm, echobase [EMAIL PROTECTED] wrote: I'm loading a div using this .ajax function: $.ajax({ type: GET, contentType: html, url: url, async: true, success: function (conf) { $(#myDiv).html( conf );} }); div id=myDiv /div In that url that's being loaded I have this jQuery function: script type=text/javascript $(document).ready(function() { $('#user_list th').hover( function () { alert(test test); }); }); /script table id=user_list /table But this simple function doesn't work. Why not? If I type the url for this page directly then the function does work. How do you get a jQuery function to work from a div loaded by ajax? Thanks.
[jQuery] Re: tooltip in select
I have had so many problems of similar sort with select's that I finally gave up and now I just use a library to generate a select box that's got only DIV tags. That way I can have multi-line items, tooltips, fading, etc... death to select input form tag :P especially I see google using similar technigues everywhere in their apps - yahoo as well. did I say 'death to select input form tag' ? On Mar 25, 10:45 am, alexanmtz [EMAIL PROTECTED] wrote: When you hover a tooltip in a select, it should disappear when you are selecting a option. In this case, the tooltip are putting the box of tip completely in wrong place. And worse: when you are hovering the option the tooltip keeps behind them, whats its strange user experience. I try to solve this problem with this code $(select).click(function(){ $.Tooltip.blocked ? $.Tooltip.blocked = false : $.Tooltip.blocked = true; $(#tooltip:hidden).length ? $(#tooltip).show() : $ (#tooltip).hide(); }); $(select).blur(function(){ $.Tooltip.blocked = false; }); It works in firefox, blocking the tooltip when you click in a select and when you exit the tooltip back to act But didnt works in safari and IE. Anyone know a way to handler the tooltip properly with select when you are choosing a option?
[jQuery] Re: hover() only working on DOM elements NOT loaded via jQuery?
thanks Karl, but you see, I thought I circumvent the issue by actually having loaded the new content into an invisible DIV already. hence lis line: $('#tab_1').html( $('#tabcontent_1').html() ); it's moving the contents of the invisible DIV into the tab DIV. scratching head still...
[jQuery] hover() only working on DOM elements NOT loaded via jQuery?
I'm befuddled... my hover effects work only during initial load -when content is reloaded via click() - the hover stops working. // First, I populate a tab box with the contents of a hidden div $('#tab_1').html( $('#tabcontent_1').html() ); // inside tabcontent_1 I am doing hover business on images whose filenames end with hover.png $('[EMAIL PROTECTED]').hover(...); this works fine for images loaded like in line 1 above. BUT! - here comes the weird thing: // my tabs have click events that load other divs into place // and now the hover stuff doesn't work any more :( $('#tab_1button').click(function(){ $('#tab_1').html( $('#tabcontent_'+this.id).html() ); } anyone know the issue? I imagine it's something about how jQuery loads the DOM objects, and now that I move this stuff around, it seems to loose track of which element i want the hover assigned to - is html() building just a string-copy? what do I have to do to get this straight? load the tab contents via append? I tired that and nothing showed up so I'm sticking with html() for now.
[jQuery] Re: jqGrid final preview
/* rant */ oh man, lemme tell you something... cross-browser display for scrolling grids is a NIGHTMARE. either you end up doing a zliilion lines of old-school JS coding to get the table rewritten on the fly, which slows down rendering-time a LOT, or you end up loosing column header alignment, especially with liquid table layouts. Its a HUGE pain. The crux of it is that IE and FF either include (or don't include) the scrollbar when calculating the width - and the dimensions plugin does NOT fix this, in case you were wondering. I have looked at jqGrid before, wanting to use it and it's the best grid out there in terms of feature-set. Especially I love the expanding rows, something i really needed. But because I'm more interested in having the layout perfect, versus having column resizing and in-place editing, and all that nifty stuff, I ended up writing my own grid that's a hybrid between regular JS, some jQuery, and a couple of CSS-hacks to get that @!#*#$ scrollbar positioned correctly. Things are so bad that I had to set up my entire layout in absolute- positioned elements and use jQuery to position everything onload and onresize. It's crazy! But at least I am getting away without needing any fancy libraries. only jquery123.js And if anyone can show me a working cross-browser implementation of a liquid grid - without using a ton of javascript to rewrite the whole table - with the scrollbar sitting INSIDE the whole table, and all columns aligning perfectly like you would think it would be, I will personally award you the Nobel Code Prize (sic) /* end rant */ On Mar 7, 5:55 am, Rey Bango [EMAIL PROTECTED] wrote: Another thing. Is there a way to make the scrollbar fit within the control itself? Currently, it sits out to the right and, IMO, seems a little out of place just floating there. Rey... Tony wrote: Hi all, At end I have done a lot of work to finalize the jqGrid. More information you can found here http://www.trirand.com/blog Note that this is not official release, since of missing documentation. I'm working hard on this and hope to finish the documentation at end of week. Enjoy Tony
[jQuery] toggle() animation - maybe there is a neater way to do this?
I have this code shown below - it works fine but I imagine there is a neater way to accomplish this... anyone? I would love to somehow shrink this to less lines of code. stoggle = 0; $(#button).).click(function(){ var extra = 150; if(stoggle==0){ $('#div').animate({top:parseInt($('#div').css('top'))+extra},400); stoggle = 1; }else{ $('#div').animate({top:parseInt($('#div').css('top'))-extra},400); stoggle = 0; } });
[jQuery] yet another post about the $(this) scope
been reading other posts about $(this) and what it refers to. And still I dont understand. I thought $(this) is a refernce to the object I am operating on, no? So this (no pun intended, tee hee) should work ,I thought: $('#div').animate({top:parseInt($(this).css('top'))+50},400); because my absolute-positioned element $('#div').css('top') definitely returns '100px'. and the parseint returns, as expected, '100' what gives? what am I missing?
[jQuery] bizarre width inconsistency between FF and IE using dimensions plugin
hello... I'm using the dimensions plugin. I'm using UL, LI to generate a scrolling grid. #datatableHead ul has my column headers #datatable is a div that's scrollable first I set widths for the head and scroller: $('#datatableHead ul, #datatable').css({width: $(window).width()-20}); then I set my grid rows' width based on the scroller's width - since its all based on viewport size. $('#datatable ul').css({width: $('#datatable').width()}); looks perfect in IE - but in FF the width of the #datatable ul is about 20 px bigger than in IE. now, please don't say: why use dimensions you should use CSS widths - trust me I tried all of that, it's not working. If only i could figure out why FF renders widths differently? I thought the whole point of dimensions plugin is to make that no longer matter. Thanks! (now I shall look over the list and see if I can help someone else :P )
[jQuery] Re: Execute JavaScript that is added to the page by AJAX?
sounds like you want $.getscript(blah.js); On Mar 4, 2:01 pm, Jonny [EMAIL PROTECTED] wrote: Basically, I have a JavaScript function (let's call the function displayDiv) that ends up writing a div to the page. If displayDiv is called within a table cell, the div will be added and displayed in that table cell. Now, what I'm trying to accomplish is replicating this behaviour with an AJAX function (let's call the function callAJAX) that returns HTML containing displayDiv and adding the code to a specific location in the page. I have tried this, problem is that the JavaScript returned from callAJAX was not executed. I then did some research and tried a few things: 1. I tried parsing out the JavaScript (displayDiv) from the returned HTML (callAJAX) and adding it to the head tag, which in theory, should be executed. This approach did not work for me because displayDiv writes a div to the page and from the head it would not know where to write the div. 2. I have tried parsing out the JavaScript (displayDiv) from the returned HTML (callAJAX) and executing it with EVAL() but this would not work because the AJAX function would not know where to write the div created within the displayDiv function. I guess what I'm hoping for is some magical piece of code that would tell the browser to parse the page again and execute the JavaScript that was added to the page by the AJAX function. I am posting this on behalf of a friend who is to busy today :) If anyone can tell me if this is even possible, and if so, where to go next, that would be most excellent! Many thanks, - Jonny
[jQuery] Re: Plugin Authoring Help pt 2
ugh, I' min the same boat. I hope some of the superstars will eventually get around to writing more detailed tutorials. been struggling with extension writing myself. On Mar 4, 11:09 am, Leanan [EMAIL PROTECTED] wrote: Ok, I'm really trying to wrap my head around this, and it's irritating me. I've checked out the following pages: http://docs.jquery.com/Plugins/Authoringhttp://www.learningjquery.com/2007/10/a-plugin-development-pattern And they help some but there's one problem I'm running into. I have: $.fn.myPlugin = function(options) { $.myPlugin.defaults = $.extend($.myPlugin.defaults, options); return(this); }; $.myPlugin = { defaults: { def1: 'default1', def2: 'default2', ... defx: 'defaultx' }, myFunc: function() { var options = $.myPlugin.defaults; //do something here, anything really }, myFunc2: function() { var options = $.myPlugin.defaults; //do something here, again, anything } }; Now, I want to do something like this: jQuery().myPlugin({def1: 'other_def1', def2: 'other_def2'}).myFunc(); Can I? Because it's not working. It tells me that jQuery().myPlugin({def1: 'other_def1', def2: 'other_def2'}) is not a function. However, if I change it so that myFunc is $.fn.myFunc = function() { }, then I can, but I have to do it as: jQuery().myPlugin({def1: 'other_def1', def2: 'other_def2'}).myPlugin.myFunc(); Which I don't like. None of the tutorials or documentation I can find is clear on this point, though they do refer to the functions in $.myPlugin as being user-accessable... and they are, but only if I do $.myPlugin.myFunc. I can't chain. And I want to be able to do that.
[jQuery] Re: Evaluation ajax response data
try converting it to a string value theData.toString(); probably wont work though - maybe better to have the PHP script return a boolean true or false or 1 and 0 and then making sure your response type is value. On Mar 4, 9:43 am, rpupkin77 [EMAIL PROTECTED] wrote: Hi, I have a simple ajax app that returns a dataType of text with a string of either yes or no. The script works fine, but for some reason, when I try to use an if/ else statement to evealutae the response, it always return false. in the following example, my code will alert yes but the if statement acts as if the data variable is not equal to it, even when it is For example: var d = page.php?params; $.ajax({ type: GET, url: /ajax/processEmail.php, data: d, dataType: text, success: function(theData, msg){ alert(theData); if(theData==yes) { do this;} else { do this; } }); any ideas?
[jQuery] Re: Moving select box options up and down
you should check out the interface plugin on the jquery site. There is code sample to show you how that is used. On Mar 4, 3:44 pm, Diddly Doo [EMAIL PROTECTED] wrote: I wonder if anyone has some sample code or plugin for moving select box options up and down using jQuery. Similar to this: http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256C5F006... Thanks!
[jQuery] Re: calling a php function with jquery
if you look up the docs for $.ajax() function you will see how to pass variables to the PHP from your calling page. for example: $.ajax({ type: POST, url: some.php, data: name=Johnlocation=Boston, success: function(msg){ alert( Data Saved: + msg ); } }); On Mar 5, 9:18 am, everdream [EMAIL PROTECTED] wrote: Hello ! I have a php function : helloUser in the file : myFunctions.php. This is my function : ... function helloUser($user) { return Welcome $user !;} ... I'm using jquery for an application but i don't know how to call a php function and give parameter (here :$user) and recover the result (here : welcome ...). Can somebody help me? Thanks a lot. -- View this message in context:http://www.nabble.com/calling-a-php-function-with-jquery-tp15853808s2... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] css({width: varwidth, height: varheight}) and dimensions causing document.resize event?
odd... when setting css based on variables like shown in subject line, IE and FF keep firing a document.resize event. if I use only 1 single attribute inside the {} its fine, but it seems to have issues with multiple, comma-separated attributes. anyone else seen this?
[jQuery] document.onmousedown=selectmouse vs $(document).mousedown(function(){})
this is interesting: I have a standard function in JS, and call it like so: document.onmousedown=trackmouse function trackmouse(){...} works very nicely. I tired to make it happen jQuery-style, but no dice. $(document).mousedown(function(){}) Of course my function is inside an extender jQuery.fn.extend({ trackmouse: function(){...}); It's more of an exercise really, because the plain JS syntax is actually less obtrusive than the jQuery version.
[jQuery] Re: document.onmousedown=selectmouse vs $(document).mousedown(function(){})
klaus, hmmm well, basically I want to ultimately be able to do this: $('.trackerdiv').trackit(); right now, my trackmouse function looks at the srcEvent and figures out which div the mouse was clicked on. that works fine. if(srcEvent.className== ' trackerdiv') i want to pass 'trackerdiv' as variable to the extension. make sense? On Feb 25, 3:33 pm, Klaus Hartl [EMAIL PROTECTED] wrote: On Feb 25, 7:33 pm, jquertil [EMAIL PROTECTED] wrote: this is interesting: I have a standard function in JS, and call it like so: document.onmousedown=trackmouse function trackmouse(){...} works very nicely. I tired to make it happen jQuery-style, but no dice. $(document).mousedown(function(){}) Is this the code you're using? You're attaching an empty function to the mousedown event. Shouldn't that be: $(document).mousedown(trackmouse); I don't see why you need to extend the jQuery object prototype (== fn) here. You do this if you want to create chainable methods, which doesn't seem to be the case. --Klaus
[jQuery] Re: before() and after() does not work on unclosed tags?
after a litle thinking i realized this could be done easier by doing the opposite, using wrapinner() tabletr class=headtdgeneric header stuff/td/tr tr class=maintd id=wrapit/td/tr/table $('#wrapit').wrapinner('div id=somediv.../div');
[jQuery] Re: before() and after() does not work on unclosed tags?
yea, that is workable. until you apply it to 100 elements on a page. document.write is way faster, but only works during an initial page load. sigh... thanks karl...
[jQuery] Re: before() and after() does not work on unclosed tags?
John, I had simplified my example, sorry. From what I gather, wrap() won't work for this kind of table: tabletr class=headtdgeneric header stuff/td/tr tr class=main/td...now wrap this.../td/tr/table John Resig wrote: I think you want .wrap():
[jQuery] Re: preventDefault() not working in FF?
TT thanks a lot! for this - it works. Interesting comparison: the jQuery version of my dragger is 23 lines of code inluding all callbacks. The plain javascript version is 22 lines (but, alas, doesnt require the jQuery library of course). I also notice that while dragging, especially in firefox, the motion is a bit choppy compared to the plain javascript version. It looks like the jquery in this particualr case doesn't really offer an advantage. Next, I will try to figure out how to use the plain javascript version and make it into a plugin. I'm having problems with the document.mousemove event (what else is new).
[jQuery] Re: trying to parse XML
if you have problems, take a peek at my XML parsing extension function. Might not be exactly what you're looking for but it works for me. http://jquery-and-javascript.blogspot.com/ loadXML2array: function() { return this.each(function() { var data = $.ajax({ type: GET, url: echo.php?xml=datatable1, async: false, success: function(xml) { objectArray = new Array(); $(xml).find('row').each(function(i){ rowObj = new Object(); rowObj.col1 = $(this).children('col_1').text(); rowObj.col2 = $(this).children('col_2').text(); rowObj.col3 = $(this).children('col_3').text(); objectArray.push(rowObj); }); } }) }); } On Feb 22, 12:54 pm, Steve Davis [EMAIL PROTECTED] wrote: hey folks, could you look at this site: http://craniumdesigns.com/new/ and tell me why my xml isnt parsing on the portfolio area? i'm just trying to have SOME sort of output. once it works i want to generate all the portfolio images/info as li tags. the code is in the top of index.html for easy viewing. i'm very new to jquery and not really sure what i'm doing wrong.
[jQuery] Re: preventDefault() not working in FF?
thanks again timothy. I decided to keep a blog with workable code snippets. check it out, y'all :) http://jquery-and-javascript.blogspot.com/
[jQuery] using functions as extensions - why does FF not take it?
has anyone had the following problem before? VERSION 1 =// works in IE and FF myFunction(){ ... } document.onmousedown=myFunction; VERSION 2 =// works in IE but not in FF jQuery.fn.extend({ myFunction: function() { ... } }); $(document).mousedown(function(){ $().myFunction(); });