[jQuery] Re: Is any one else experiencing serious slowdowns on their site due to 'waiting for jqueryui.com' ?
Hi Stasch, Be careful before you blame others of wrong deeds... unless you enjoy making a fool of yourself. Make sure you check the issue is not from your side as there is absolutely no such code in jquery, nor in jquery-ui. My guess is that you did some wild copy/pasting from the jquery-ui demos, and didn't actually change the URLS. Another possibility is that one of your plugins calls for jquery right from the server, which is really not a good idea, as you mentionned. Otherwise, as Michael just said, post a link so we can really help. Cheers, a. On Sat, May 2, 2009 at 8:18 PM, stasch stash...@gmail.com wrote: I was surprised to today to discover that my site was running much slower than usual (3 to 4 times slower!). Most of the delay was spent with the message 'waiting for jqueryui.com'. This really freaked me out. First of all what gives the jquery folks the right to ping their site from their code? Second of all, if they're going to do that they'd better make sure that the site they are pinging is super fast. Can anybody enlighten me as to what is going on here? Better yet, how can I remove that code from my jquery library? I can't afford to have this kind of performance hit due to uncontrollable 'features' like this in my code. And if I'm legally bound to keep that code in the library please advise me so that I can go back to Prototype. Totally unacceptable!
[jQuery] Re: problem filtering out via parents() and :not()
hi Ricardo! in fact i removed all code that was out of the realm of this issue, to not make you guys read 50 lines of codes. i keep the hasClass() suggestion though ! i don't understand why parents().is(':not() does not work though. I wonder if there isn't a bug because it used to work before, with jquery 1.2.6. Maybe the switch to sizzle provoked it. I'll have to investigate to confirm that. thanks! On Fri, May 1, 2009 at 7:35 PM, Ricardo ricardob...@gmail.com wrote: No #detailsNavigation in your HTML.. and why not simply $ (.metaSection a).click(function(){... ? Also you can swap $thisA.is (:not... for !$thisA.hasClass('noSwap'), much less overhead. Despite that code looks fine, could you provide a working sample at jsbin.com or the likes? On May 1, 12:29 pm, pixeline aplennev...@gmail.com wrote: Hello ! I'm assigning a specific swap position behaviour on click to a list of links, all sitting inside a multilevel unordered list with id detailsNavigation That behaviour only concerns specific anchors and those with class noSwap shouldn't ... swap. Can you explain me why this does not work? $(#detailsNavigation li ul li a).bind(click, function() { var $thisA = $(this); var $thisLI = $thisA.parent(); var $thisUL = $thisLI.parent(); if ($thisUL.parents('li').is(':not(#metadesign, #editions, #timeline, #related)') || $thisA.is(':not(.noSwap)')) { // do that swappin' thingy } }); Here is the related html: ul li class=clearfix id=metadesign ul style=display: block; class=detailsSubnav clearfix selected li class=clearfix style=width: 100%; ul class=metaSection clearfix li class=skinColor metaSectionTitleconcepts/li lia class=ajax noSwap href=http://m2.lab- au.com/projects/f551/metadesign/concepts/8/ electrosensing/a/li /ul ul class=metaSection clearfix li style=display: list-item; a class=ajax selected noSwap href=http:// m2.lab-au.com/projects/f551/metadesign/methods/ referencing/referencing/a /li li class=skinColor metaSectionTitlemethods/li li class=inactivespan class=inactiveData mining/span/li /ul /li /ul /li /ul Thanks a lot for your help! Alexandre
[jQuery] Re: how can I call php function in jquery ?
you'd send to your ajax.php script a value that it can process such as ajax.php?do=deletecommentid=5 then your ajax.php : switch($_GET['do']){ case 'delete': // check for an id, delete it break; default: // do nothing; break; } On Thu, Apr 2, 2009 at 3:11 PM, dziobacz aaabbbcccda...@gmail.com wrote: I have in PHP file ajax.php: class Data { public function __construct() { } public function select($idl) { } public function delete($id) { . } } My jquery function looks now: function deleteComment(id) { $.post(ajax.php, { }, function(data) { ... } ); } How can I in function deleteComment(id) call php function delete($id) from file ajax.php ?
[jQuery] Re: must show an element if exists
you don't have to do that check. If the element does not exist, the show() code will not be run. On Thu, Mar 26, 2009 at 4:40 AM, shobhitsoftskills shobhitsing...@gmail.com wrote: hi, i am learning jQuery and confused about one thing.below is simple code using jQuery. !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/TR/html4/strict.dtd; html head script type=text/javascript src=jquery.js/script script type=text/javascript $(document).ready(function() { if ( $('#myDiv').length ) $('#myDiv').show(); }); /script /head body div id=myDivSearch Engines/div /body /html i am trying below lines. if ( $('#myDiv').length ) $('#myDiv').show(); according to this code if element exists then element should be show but i did not look any thing. kindly post your thoughts.
[jQuery] Re: Pointless but fun jQuery experiment
kelvin, that's wicked ! On Thu, Mar 26, 2009 at 11:37 AM, kanna mail4ka...@gmail.com wrote: Nice effects, Kelvin!! JQuery Rocks!!! On Mar 26, 8:49 am, Nikola nik.cod...@gmail.com wrote: That was really neat... jQuery physics! On Mar 25, 11:40 pm, brian bally.z...@gmail.com wrote: I'll second that! On Wed, Mar 25, 2009 at 9:26 PM, Rick Faircloth r...@whitestonemedia.com wrote: Pretty cool, Kelvin! Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Kelvin Luck Sent: Wednesday, March 25, 2009 9:22 PM To: jquery-en Subject: [jQuery] Pointless but fun jQuery experiment Inspired by google's chrome experiments I recently put together a pointless but fun experiment with the help of jQuery and I thought that people on the list might like to check it out: http://www.kelvinluck.com/assets/jquery/boingPic/index.html As I said, completely pointless but makes a nice change from serious progressive enhancement! Hope you like it, Kelvin :)
[jQuery] Re: jqmodal Ajax issue
1/ i would make sure the div exist before initalising the jqModal, so add the jqm initialisation to your createDiv function or through a callback executed when the createDiv is done.2/ for your specific question: your check is incorrect. The good use would be to use jqmodal onShow() callback and check at that moment whether the link is valid or not. onshow:function(hash){ if (hash.t.attr('href') ==='#' || hash.t.attr('href') ===''){ return false; } // otherwise, launch the popup hash.w.css('opacity',0.88).show(); } from the doc: Each callback is passed the jqModal hash for a window. Relevant hash properties are; --- w: (jQuery object) The window element. e.g. '#example' in the sample above c: (object) The config object (holds passed+default parameters) o: (jQuery object) The overlay t: (DOM object) The triggering element NOTE; If you supply a onHide callback, you MUST execute hash.o.remove(); to remove the overlay. You should also hide the window via hash.w.hide();, or with a special effect. NOTE; If you supply a onShow callback, you should make the dialog visible via hash.w.show();, or with a special effect. NOTE; onLoad callbacks are ONLY executed if the ajax parameter was passed. onLoad is called after the ajax response. As with $.load(), the this scope is a reference to the ajax target as a DOM element. On Wed, Mar 25, 2009 at 6:13 PM, Tad tad.ni...@gmail.com wrote: Hello, I'm new to jquery and jqmodal. I have a script that runs fine except when the URL (href) of the anchor tag is Blank or #. so what I want to do is check for that possibility and stop the Jqmodal from acting or put up an error message, without my page being messed up. I've tried to use callbacks, but get an error that the hash is not defined. I tried to use the click event of the anchor, but the Jqmodal would load the content but only show it after clicking another anchor tag or clicking the same one again. the goal here is to have a default pop Up jqmodal that checks the link it is given and doesn't use it if it will cause an error. ~~ code that works but doesn't check href of anchor~~ $(function(){ /* init pop-up/overlay */ popUp.init(); }); /* pop-up/overlay Functionality */ var popUp = { init: function(){ var link = $(a.popup); if(link.length = 0) return false; popUp.createDiv(); $('div#popup-wraper').jqm({ trigger: $(a.popup), closeClass: 'close', toTop: true, ajax: '@href', target: $(div#popup-wraper div#popup), ajaxText: (loading...), cache: false }) }, createDiv: function(){ var strJq = div id='popup-wraper' class='jqmWindow'; strJq += div id='overlay-utility'; strJq += a class='close' href='#'Close/a; strJq += /div; strJq += div id='popup'; strJq += /div; strJq += /div; $(body).append(strJq); } } /* pop-up/overlay Functionality END */ ~~ end code ~~
[jQuery] access :hover css properties of an element via jquery
hello! imagine i style the :hover pseudo-class of an element via css: .myitem{ background-color:green; } .myitem:hover{ background-color:red } Is it possible to retrieve the background-color property of the elemnent's :hover class via jquery? i tried the obvious : http://jsbin.com/idudi/edit $(function(){ var temp = $('#myitem:hover').css('background-color'); alert(color is +temp); }); But that didn't work. It returns the default state.
[jQuery] Re: how to load(text with the + sign in it)
well the missing + sign is in the returned (loaded) html data, not in the url variables. there are none. basically i do a $('#container').load(href); what gets display in the container is A magazine instead of A+ magazine . if in my php script i urlencode($string) the data, then the + sign is displayed. non sense... On Sat, Mar 21, 2009 at 1:04 AM, James james.gp@gmail.com wrote: Could you post how you're doing the .load() jQuery part? It sounds like you're passing it through the url, like: $.load(page.php+myVar); In this case, you should use some kind of Javascript function to encode the variable: $.load(page.php?q=+encodeURIComponent(myVar)); Else, it's recommended you should try putting the data in as a separate parameter: $.load(page.php, {q:myVar}); the + sign should not be converted. Note that if you do this you're POST-ing the data. On Mar 20, 5:14 am, Alexandre Plennevaux aplennev...@gmail.com wrote: Hello, i tried that, but htmlentities(A+) echos A+, so it does not convert it. On Fri, Mar 20, 2009 at 4:06 PM, Martijn Houtman martijn.hout...@gmail.com wrote: On Mar 20, 2009, at 3:59 PM, Alexandre Plennevaux wrote: i'm doing an ajax call via the load() function. The fetched string contains the + sign, and it gets removed in the resulting html. Why is that? note: i'm using php. The only way i found to have the string shown, is to urlencode() it. But i don't want to urlencode() entire texts that should remain human-readable. I'm sure there is an obvious solution, however i can't seem to find it. try htmlentities() rather than urlencode() (PHP). I believe the plus sign is interpreted as a space. Please do note that this escapes _all_ HTML code, so it will not be interpreted as HTML (if it contains any). Regards, -- Martijn.
[jQuery] how to load(text with the + sign in it)
friends, i'm doing an ajax call via the load() function. The fetched string contains the + sign, and it gets removed in the resulting html. Why is that? note: i'm using php. The only way i found to have the string shown, is to urlencode() it. But i don't want to urlencode() entire texts that should remain human-readable. I'm sure there is an obvious solution, however i can't seem to find it. thank you in advance for your help in solving this weird issue. Alexandre
[jQuery] Re: how to load(text with the + sign in it)
Hello, i tried that, but htmlentities(A+) echos A+, so it does not convert it. On Fri, Mar 20, 2009 at 4:06 PM, Martijn Houtman martijn.hout...@gmail.com wrote: On Mar 20, 2009, at 3:59 PM, Alexandre Plennevaux wrote: i'm doing an ajax call via the load() function. The fetched string contains the + sign, and it gets removed in the resulting html. Why is that? note: i'm using php. The only way i found to have the string shown, is to urlencode() it. But i don't want to urlencode() entire texts that should remain human-readable. I'm sure there is an obvious solution, however i can't seem to find it. try htmlentities() rather than urlencode() (PHP). I believe the plus sign is interpreted as a space. Please do note that this escapes _all_ HTML code, so it will not be interpreted as HTML (if it contains any). Regards, -- Martijn.
[jQuery] Re: Call for contributors: A simple, fast and flexible grid/spreadsheet component.
really impressive. As soon as it gets to a stable release i'll try it out on my addressbook application. the only thing i will miss is less semantic data (no use of a table anymore). But i know all my users have javascript enabled. In that case, i guess it's not such a relevant criteria anymore. On Tue, Mar 17, 2009 at 8:20 AM, Tin michael.leib...@gmail.com wrote: More updates to the Model (DataView). Added: - addItem - insertItem - updateItem - deleteItem Plus a bunch of bug fixes and code cleanup. Demo: http://slickgrid.googlecode.com/svn/trunk/example4-model.html
[jQuery] Re: jScoll Pane and Hidden Divs
yep it's correct: you need to initialise it then hide it. you could also position it outside the view port, initialise it, hide it, then position it back in the viewport to avoid the initial display. On Fri, Mar 13, 2009 at 6:43 AM, Nic Hubbard nnhubb...@gmail.com wrote: I have a hidden div that uses the .fadeIn() function when a link is clicked. Inside this is a div that uses jScroll Pane. But, for some reason when I hide that parent div first, jScroll pane won't work. It seems like it might not be initialized inside a hidden div. Is this true? Any ideas on how to get this working? http://67.207.148.241/exhibitions (Mouse over Exhibitions) Thanks!
[jQuery] Re: jScoll Pane and Hidden Divs
can u put up an online demo somewhere? ( http://jsbin.com/ ) On Fri, Mar 13, 2009 at 8:55 AM, Nic Hubbard nnhubb...@gmail.com wrote: Well, I had thought of that, but I am needing to fade it in with the fadeIn() function. Not sure how how to do this when the jScroll is inside the hidden div... On Mar 13, 12:41 am, Alexandre Plennevaux aplennev...@gmail.com wrote: yep it's correct: you need to initialise it then hide it. you could also position it outside the view port, initialise it, hide it, then position it back in the viewport to avoid the initial display. On Fri, Mar 13, 2009 at 6:43 AM, Nic Hubbard nnhubb...@gmail.com wrote: I have a hidden div that uses the .fadeIn() function when a link is clicked. Inside this is a div that uses jScroll Pane. But, for some reason when I hide that parent div first, jScroll pane won't work. It seems like it might not be initialized inside a hidden div. Is this true? Any ideas on how to get this working? http://67.207.148.241/exhibitions(Mouse over Exhibitions) Thanks!
[jQuery] Re: How to remove li inside UL
this is probably because your selector returns no object. show the html code you run your script against, to be able to properly diagnose. On Mon, Mar 9, 2009 at 11:53 AM, niraj nirajke...@lucent.com wrote: Hi, I want to remove selected list items from a UL. Can i do using remove (). I get an error when i get a list of items: var li = $('.items'); li[0].remove(); I am getting error li[0].remove() is not a function in Mozilla Firefox firebird debugger. ~nk
[jQuery] ajaxStart() question
Hello! I would like to launch a function each time an ajax call is made, that places a loading throbber in the container in which the new content will be inserted. Typically, these will be $('#mycontainer').load() calls. I'm puzzled on how to detect the container upon calling my function. Someone has an idea? Thanks! Alexandre
[jQuery] Re: ajaxStart() question
yes, thanks but that does not help my specific need: what i need to know is if the ajax object stores the container in which it will load the content in a property that i can retrieve, so that the load animation goes on top of it. On Fri, Mar 6, 2009 at 11:11 AM, ryan.j ryan.joyce...@googlemail.com wrote: oh and it may or may not be any use, but you can grab all manner of nice animated loading graphics here... http://www.ajaxload.info/
[jQuery] Re: ajaxStart() question
thanks ryan, but i want to set it generically for all ajax calls, for instance, via ajaxStart() instead of having to attach the behaviour to every single trigger element. On Fri, Mar 6, 2009 at 11:30 AM, ryan.j ryan.joyce...@googlemail.com wrote: but since you already specify the target element for the .load() at some point, you'll already have it to put in the callback? function doLoad(el, url) { var contEl = $(el) contEl .append('img id=loadIcon src=loading.png /'); contEl .load( url, function(){ contEl .remove('#loadIcon'); }); } a href=# onclick=doload('#myContainer','http:// www.google.co.uk')load/a On Mar 6, 10:14 am, Alexandre Plennevaux aplennev...@gmail.com wrote: yes, thanks but that does not help my specific need: what i need to know is if the ajax object stores the container in which it will load the content in a property that i can retrieve, so that the load animation goes on top of it. On Fri, Mar 6, 2009 at 11:11 AM, ryan.j ryan.joyce...@googlemail.com wrote: oh and it may or may not be any use, but you can grab all manner of nice animated loading graphics here...http://www.ajaxload.info/
[jQuery] Re: ajaxStart() question
just in case it helps, here is the code i have so far: var $loadAnim = $('div id=loadAnimimg src=ajax-loader_light2.gif //div').appendTo('body'); $loadAnim.ajaxStart(function(el) { // the following behavior will be done each time an ajax call is triggered var $loadTarget = $('#container'); // !-- #container should be a variable or $.ajax stored property since in my case, it changes often console.log(el); $loadAnim.css({ top: $loadTarget.offset().top, left: $loadTarget.offset().left, width: $loadTarget.width(), height: $loadTarget.height() }).show(); $loadTarget.load('demo_content.html', function() { $loadAnim.fadeOut(2000); }); }); On Fri, Mar 6, 2009 at 11:44 AM, Alexandre Plennevaux aplennev...@gmail.com wrote: thanks ryan, but i want to set it generically for all ajax calls, for instance, via ajaxStart() instead of having to attach the behaviour to every single trigger element. On Fri, Mar 6, 2009 at 11:30 AM, ryan.j ryan.joyce...@googlemail.com wrote: but since you already specify the target element for the .load() at some point, you'll already have it to put in the callback? function doLoad(el, url) { var contEl = $(el) contEl .append('img id=loadIcon src=loading.png /'); contEl .load( url, function(){ contEl .remove('#loadIcon'); }); } a href=# onclick=doload('#myContainer','http:// www.google.co.uk')load/a On Mar 6, 10:14 am, Alexandre Plennevaux aplennev...@gmail.com wrote: yes, thanks but that does not help my specific need: what i need to know is if the ajax object stores the container in which it will load the content in a property that i can retrieve, so that the load animation goes on top of it. On Fri, Mar 6, 2009 at 11:11 AM, ryan.j ryan.joyce...@googlemail.com wrote: oh and it may or may not be any use, but you can grab all manner of nice animated loading graphics here...http://www.ajaxload.info/
[jQuery] Re: ajaxStart() question
hi there, well, i trigger the ajax request much like this: no matter what they role is, all my interface buttons finish by an action called UI.refresh({section:'projects', sortby:'time', item:'love-me'}); this function compares the sent properties to the current UI stored properties, and if there is a change, trigger specific actions. That UI.refresh() function is therefore structured like this: ui.refresh:function(Obj){ // 1. compare the 2 objects: current UI and Obj. If changes, update UI if(Obj.section Obj.section!== UI.section){ queueArray.push('section'); UI.section= Obj.section; } // same for all properties 2. loop through the queueArray and make necessary UI changes for (i = 0; i queueArray.length; i++) { switch (queueArray[i]) { case 'section': // Animating the strata var $thisLI = $('#' + UI.section); $thisLI.strataToCenter(); $('#leftcol').load(UI.CURRENT_URL); break; case 'item': //do this and that... $('#projectNav').load('thatpage'); break; } } } it may seems like overwork to you guys, but my app is quite big and this structure helps me keep the code well structured. Thanks for taking the time to help me... On Fri, Mar 6, 2009 at 4:16 PM, ryan.j ryan.joyce...@googlemail.com wrote: that crossed my mind, but from the comments above i think he he wants multiple content boxes being populated from a number of different triggers, although he's using an id (of which he can only have one instance of anyway) as the identifier for the loading icon. i'm not sure this is the best way of doing it, cos unless i'm misunderstanding quite what he wants to do he'll only be able to process one ajax request at a time doing it like this. Alexandre, how are you triggering the ajax request?
[jQuery] Re: ajaxStart() question
no, nothing depend on it. I see now that there is a potential problem with the way i set up my throbber logic: there is only one available loading div for several zones. So if one zone is loading and another call is triggered, the loading panel will move to the second zone before zone1 is actually done loading. So i should create the divs each time or create directly as many divs as there are updatable zones, thus using a class instead of an id. On Fri, Mar 6, 2009 at 5:02 PM, Rick Faircloth r...@whitestonemedia.com wrote: Is anything in your code dependent on your loading graphic id, or would a class identifier be sufficient? -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Alexandre Plennevaux Sent: Friday, March 06, 2009 10:31 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: ajaxStart() question hi there, well, i trigger the ajax request much like this: no matter what they role is, all my interface buttons finish by an action called UI.refresh({section:'projects', sortby:'time', item:'love-me'}); this function compares the sent properties to the current UI stored properties, and if there is a change, trigger specific actions. That UI.refresh() function is therefore structured like this: ui.refresh:function(Obj){ // 1. compare the 2 objects: current UI and Obj. If changes, update UI if(Obj.section Obj.section!== UI.section){ queueArray.push('section'); UI.section= Obj.section; } // same for all properties 2. loop through the queueArray and make necessary UI changes for (i = 0; i queueArray.length; i++) { switch (queueArray[i]) { case 'section': // Animating the strata var $thisLI = $('#' + UI.section); $thisLI.strataToCenter(); $('#leftcol').load(UI.CURRENT_URL); break; case 'item': //do this and that... $('#projectNav').load('thatpage'); break; } } } it may seems like overwork to you guys, but my app is quite big and this structure helps me keep the code well structured. Thanks for taking the time to help me... On Fri, Mar 6, 2009 at 4:16 PM, ryan.j ryan.joyce...@googlemail.com wrote: that crossed my mind, but from the comments above i think he he wants multiple content boxes being populated from a number of different triggers, although he's using an id (of which he can only have one instance of anyway) as the identifier for the loading icon. i'm not sure this is the best way of doing it, cos unless i'm misunderstanding quite what he wants to do he'll only be able to process one ajax request at a time doing it like this. Alexandre, how are you triggering the ajax request?
[jQuery] Re: ajaxStart() question
Thank you Ryan, Thus my initial question becomes : does jquery stores somewhere all dom elements in the process of being updated by an ajax call ? like $.ajax.processingElements = ['container1','container2']; if not, i guess that i could turn this into a plugin that adds on ajaxStart() an element to a global array and removes on ajaxComplete or ajaxError. °-¨ On Fri, Mar 6, 2009 at 5:35 PM, ryan.j ryan.joyce...@googlemail.com wrote: yeah, thats basically what i was thinking. personally i'd try to track the container and use a generic piece of code for the the loading image. that way you could just use $ (container).children(.loading) to traverse the DOM. or if for any reason you want to make them unique perhaps even build an id for each loading image based on the container's id. (eg. cont1 cont1_Img or something) On Mar 6, 4:12 pm, Alexandre Plennevaux aplennev...@gmail.com wrote: no, nothing depend on it. I see now that there is a potential problem with the way i set up my throbber logic: there is only one available loading div for several zones. So if one zone is loading and another call is triggered, the loading panel will move to the second zone before zone1 is actually done loading. So i should create the divs each time or create directly as many divs as there are updatable zones, thus using a class instead of an id. On Fri, Mar 6, 2009 at 5:02 PM, Rick Faircloth r...@whitestonemedia.com wrote: Is anything in your code dependent on your loading graphic id, or would a class identifier be sufficient? -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Alexandre Plennevaux Sent: Friday, March 06, 2009 10:31 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: ajaxStart() question hi there, well, i trigger the ajax request much like this: no matter what they role is, all my interface buttons finish by an action called UI.refresh({section:'projects', sortby:'time', item:'love-me'}); this function compares the sent properties to the current UI stored properties, and if there is a change, trigger specific actions. That UI.refresh() function is therefore structured like this: ui.refresh:function(Obj){ // 1. compare the 2 objects: current UI and Obj. If changes, update UI if(Obj.section Obj.section!== UI.section){ queueArray.push('section'); UI.section= Obj.section; } // same for all properties 2. loop through the queueArray and make necessary UI changes for (i = 0; i queueArray.length; i++) { switch (queueArray[i]) { case 'section': // Animating the strata var $thisLI = $('#' + UI.section); $thisLI.strataToCenter(); $('#leftcol').load(UI.CURRENT_URL); break; case 'item': //do this and that... $('#projectNav').load('thatpage'); break; } } } it may seems like overwork to you guys, but my app is quite big and this structure helps me keep the code well structured. Thanks for taking the time to help me... On Fri, Mar 6, 2009 at 4:16 PM, ryan.j ryan.joyce...@googlemail.com wrote: that crossed my mind, but from the comments above i think he he wants multiple content boxes being populated from a number of different triggers, although he's using an id (of which he can only have one instance of anyway) as the identifier for the loading icon. i'm not sure this is the best way of doing it, cos unless i'm misunderstanding quite what he wants to do he'll only be able to process one ajax request at a time doing it like this. Alexandre, how are you triggering the ajax request?
[jQuery] next() question
Hello, say i have this markup: ul class=tab-nav-menu tab-menu lia class=tab-menu-item tab-menu-item-selected href=#fragment00/a/li lia class=tab-menu-item href=#fragment11/a/li lia class=tab-menu-item href=#fragment22/a/li lia class=tab-menu-item href=#fragment33/a/li lia class=tab-menu-item href=#fragment44/a/li lia class=tab-menu-item href=#fragment55/a/li lia class=tab-menu-item href=#fragment66/a/li li id=imageLegendArca 180/li /ul I need to find the anchor link that immediately follows a.tab-menu-item-selected. i tried using next but i never get it right $('a.tab-menu-item-selected').next('a.tab-menu-item').length returns always 0 any idea how to find this selector would be greatly appreciated. Thanks Alexandre
[jQuery] Re: next() question
thanks i got it to work, sort of. $('#tabs img.albumImage').each(function(index) { var $img = $(this).data('tabindex', index); $img.click(function() { // in albums, clicking on an image brings the user to the next image var index = $(this).data('tabindex'); $('ul.tab-menu a:after(a.tab-menu-item-selected)').eq(index + 1).trigger('click'); }); }); :after is not documented on the jquery selector page: http://docs.jquery.com/Selectors should it be added? On Wed, Mar 4, 2009 at 4:21 PM, Joseph Le Brech jlebr...@hotmail.comwrote: you should be able to use the :after pseudo element http://www.w3.org/TR/CSS2/selector.html#before-and-after Date: Wed, 4 Mar 2009 16:10:03 +0100 Subject: [jQuery] next() question From: aplennev...@gmail.com To: jquery...@googlegroups.com- Show quoted text - Hello, say i have this markup: ul class=tab-nav-menu tab-menu lia class=tab-menu-item tab-menu-item-selected href=#fragment00/a/li lia class=tab-menu-item href=#fragment11/a/li lia class=tab-menu-item href=#fragment22/a/li lia class=tab-menu-item href=#fragment33/a/li lia class=tab-menu-item href=#fragment44/a/li lia class=tab-menu-item href=#fragment55/a/li lia class=tab-menu-item href=#fragment66/a/li li id=imageLegendArca 180/li /ul I need to find the anchor link that immediately follows a.tab-menu-item-selected. i tried using next but i never get it right $('a.tab-menu-item-selected').next('a.tab-menu-item').length returns always 0 any idea how to find this selector would be greatly appreciated. Thanks Alexandre -- Windows Live Messenger just got better. Find out more!http://clk.atdmt.com/UKM/go/134665230/direct/01/
[jQuery] Re: next() question
wow, clever, that does the trick ! $('ul.tab-menu a.tab-menu-item-selected').parent().next().children('a.tab-menu-item').trigger('click.simplyTabs'); On Wed, Mar 4, 2009 at 4:58 PM, mkmanning michaell...@gmail.com wrote: next() finds the the unique next siblings for that element (in this case their are none). You want the a that is the child of the element's parent's next sibling, which takes longer to write in English than in jQuery :) $('a.tab-menu-item-selected').parent().next().children(); nb this assumes the a is the only child, otherwise add a filter expr in children On Mar 4, 7:21 am, Joseph Le Brech jlebr...@hotmail.com wrote: you should be able to use the :after pseudo element http://www.w3.org/TR/CSS2/selector.html#before-and-after Date: Wed, 4 Mar 2009 16:10:03 +0100 Subject: [jQuery] next() question From: aplennev...@gmail.com To: jquery-en@googlegroups.com Hello, say i have this markup: ul class=tab-nav-menu tab-menu lia class=tab-menu-item tab-menu-item-selected href=#fragment00/a/li lia class=tab-menu-item href=#fragment11/a/li lia class=tab-menu-item href=#fragment22/a/li lia class=tab-menu-item href=#fragment33/a/li lia class=tab-menu-item href=#fragment44/a/li lia class=tab-menu-item href=#fragment55/a/li lia class=tab-menu-item href=#fragment66/a/li li id=imageLegendArca 180/li /ul I need to find the anchor link that immediately follows a.tab-menu-item-selected. i tried using next but i never get it right $('a.tab-menu-item-selected').next('a.tab-menu-item').length returns always 0 any idea how to find this selector would be greatly appreciated. Thanks Alexandre _ Free photo editing software from Windows Live . Try it now!http://clk.atdmt.com/UKM/go/134665240/direct/01/
[jQuery] Re: next() question
Thank you Ricardo, that's an illuminating break down. On Wed, Mar 4, 2009 at 5:20 PM, ricardobeat ricardob...@gmail.com wrote: :after is used to insert generated content after an element, not to select the next element. In your code, the :after(...) is doing nothing, it reads as $('ul.tab-menu a').eq(index + 1) - what's working is the index. You don't need to save the index as it's in the scope of the function: $('#tabs img.albumImage').each(function(index) { var $tabs = $('ul.tab-menu a'); $(this).click(function() { // in albums, clicking on an image brings the user to the next image $( $tabs[index + 1] ).click(); }); }); The selector you were after is $('li:has(.tab-menu-item-selected) + li a.tab-menu-item'), but doing the whole parent().next().children('a.tab- menu-item') stuff is faster, despite being verbose. cheers, - ricardo On Mar 4, 1:01 pm, Joseph Le Brech jlebr...@hotmail.com wrote: http://docs.jquery.com/DOM/Traversing/Selectors#Not_supported i seen the + operator seems to do something similar, it means an element preceding. Date: Wed, 4 Mar 2009 16:54:46 +0100 Subject: [jQuery] Re: next() question From: aplennev...@gmail.com To: jquery-en@googlegroups.com thanks i got it to work, sort of. $('#tabs img.albumImage').each(function(index) { var $img = $(this).data('tabindex', index); $img.click(function() { // in albums, clicking on an image brings the user to the next image var index = $(this).data('tabindex'); $('ul.tab-menu a:after(a.tab-menu-item-selected)').eq(index + 1).trigger('click'); }); }); :after is not documented on the jquery selector page:http://docs.jquery.com/Selectors should it be added? On Wed, Mar 4, 2009 at 4:21 PM, Joseph Le Brech jlebr...@hotmail.com wrote: you should be able to use the :after pseudo element http://www.w3.org/TR/CSS2/selector.html#before-and-after Date: Wed, 4 Mar 2009 16:10:03 +0100 Subject: [jQuery] next() question From: aplennev...@gmail.com To: jquery-en@googlegroups.com - Show quoted text - Hello, say i have this markup: ul class=tab-nav-menu tab-menu lia class=tab-menu-item tab-menu-item-selected href=#fragment00/a/li lia class=tab-menu-item href=#fragment11/a/li lia class=tab-menu-item href=#fragment22/a/li lia class=tab-menu-item href=#fragment33/a/li lia class=tab-menu-item href=#fragment44/a/li lia class=tab-menu-item href=#fragment55/a/li lia class=tab-menu-item href=#fragment66/a/li li id=imageLegendArca 180/li /ul I need to find the anchor link that immediately follows a.tab-menu-item-selected. i tried using next but i never get it right $('a.tab-menu-item-selected').next('a.tab-menu-item').length returns always 0 any idea how to find this selector would be greatly appreciated. Thanks Alexandre Windows Live Messenger just got better. Find out more! _ 25GB of FREE Online Storage – Find out morehttp://clk.atdmt.com/UKM/go/134665320/direct/01/
[jQuery] Re: [plugin] jqModal +r14 updated
that's a nice upgrade Brice! On Sun, Mar 1, 2009 at 9:21 AM, Brice Burgess b...@iceburg.net wrote: Plugin Page: http://dev.iceburg.net/jquery/jqModal/ updated jqModal to +r14 Changes include smart detection of the triggering element. This allows you to call $.jqmShow() and $.jqmHide() within the event context of a non-initialized triggering element, and that element will mask a proper initialized trigger. This (very minor) change is intended to improve the plugin's natural behavior -- that is; to behave as expected. It will make live querying modal triggers easier for some. A simple example of the new behavior follows. It will show and load the remote content of all anchor links into the modal window whenever they are clicked. a href=http://my.ajax/content;open modal with my.ajax/content/a div id=jqModal class=jqmWindow style=display: none;/div script type=text/javascript jQuery().ready(function($){ // initialize modal, // load the container with a remote return based on the 'href' // attribute of triggering element(s) $('#jqModal').jqm({ajax:'@href'}); // open the modal whenever anchor links on the page are clicked $('a').live('click',function(){ $('#jqModal').jqmShow(); }); }); /script NOTE: Before this change, you would normally either a) pass triggers on $.jqm() initialization (e.g.) $('#jqModal').jqm({trigger:'a.openModal',...}); or b) pass the triggering element to $.jqmShow() calls -- [which you still can, and which will override auto-detection.] $('a.openModal').click(function(){ $('#jqModal').jqmShow(this); }); $('#jqModal').jqmShow($('a.openModal')[0]); I realize the new behavior is similar to b) above, but passing the element to $.jqmShow() did not seem a natural fit. The new method is easier for those without scope/context knowledge [and the new method uses less bytes in your client code!! ;) (j/k) :pony_skiing==1] So; I hope you all enjoy. And yes; a rewrite, lint-loving spawn of jqModal with quiteExpressiveVariableNames is a necessity eventually ;) ~ Brice
[jQuery] Advertising in jquery docs: normal?
Hi there, Since the docs are based on a wiki, i wonder if this is intended or not by the jquery team: on this page, the links chapter contains an incentive to buy a jquery book. http://docs.jquery.com/Removeclass see: For more details buy the jQuery Reference Guide here in this site http://www.packtpub.com/jQuery/book/mid/1004077zztq0 Not that it's out of context,, irrelevant or overly visually invasive, but is this not a hidden advertisement? Is this allowed? Alexandre
[jQuery] ui tabs : what are the only necessary CSS files ?
Hi, I'm trying to use ui Tabs , but i don't need all the rest of the UI distribution, yet they all come into the generated download. I'm a bit lost in all those css files. What is the bare minimum css that i absolutely need to make the ui.tabs work? Thank you, Alexandre
[jQuery] Re: ui tabs : what are the only necessary CSS files ?
thanks Richard, I'm having a lot of trouble upgrading to ui tabs so see you around on the jquery ui group :) Alexandre On Mon, Feb 23, 2009 at 11:32 AM, Richard D. Worth rdwo...@gmail.com wrote: ui.core.css ui.tabs.css ui.theme.css Note: if you have any further questions about jQuery UI, we'd love to answer them over here: http://groups.google.com/group/jquery-ui Thanks. - Richard On Mon, Feb 23, 2009 at 4:32 AM, Alexandre Plennevaux aplennev...@gmail.com wrote: Hi, I'm trying to use ui Tabs , but i don't need all the rest of the UI distribution, yet they all come into the generated download. I'm a bit lost in all those css files. What is the bare minimum css that i absolutely need to make the ui.tabs work? Thank you, Alexandre
[jQuery] Re: Horizontal animation works on F.F. IE7. Fails on IE6
can you check taht for IE6, the element is not ALREADY at position left=0 ? hence no animation? On Mon, Feb 23, 2009 at 6:22 PM, ab2qik ab2...@googlemail.com wrote: Hi, Horizontal animation of an element works on F.F. IE7. It fails to work on IE6? Example: From: http://codesolv.net/se-update/library-slide.html Click on any radio button under Form factors heading. An element slides open. This can be closed by the top right close button. Works on F.F./IE7. Any suggegstions for a fix for IE6? Thankyou, ab2qik
[jQuery] Re: Horizontal animation works on F.F. IE7. Fails on IE6
in fact, i just tested it on IE6, and i can't even click on the form inputs, so i 'd assume either you disabled them, or there is a transparent div with a higher z-index that prevents from clicking it. On Mon, Feb 23, 2009 at 10:36 PM, Alexandre Plennevaux aplennev...@gmail.com wrote: can you check taht for IE6, the element is not ALREADY at position left=0 ? hence no animation? On Mon, Feb 23, 2009 at 6:22 PM, ab2qik ab2...@googlemail.com wrote: Hi, Horizontal animation of an element works on F.F. IE7. It fails to work on IE6? Example: From: http://codesolv.net/se-update/library-slide.html Click on any radio button under Form factors heading. An element slides open. This can be closed by the top right close button. Works on F.F./IE7. Any suggegstions for a fix for IE6? Thankyou, ab2qik
[jQuery] Re: Javascript Generated by $()load does not render
you can use load, you just have to setup the ajaxSetup controlling your ajax main parameters so you set it to your liking, then you call the load(). It is built on top of the ajax method to ease its use. See: http://docs.jquery.com/Ajax/jQuery.ajaxSetup#options On Wed, Feb 18, 2009 at 5:18 PM, Tim Johnson t...@johnsons-web.com wrote: On Tuesday 17 February 2009, Alexandre Plennevaux wrote: i suppose that you change try specifying the dataType as script that your ajax calls expect: Taken from: http://docs.jquery.com/Ajax/jQuery.ajax dataType The type of data that you're expecting back from the server. If none is specified, jQuery will intelligently pass either responseXML or responseText to your success callback, based on the MIME type of the response. The available types (and the result passed as the first argument to your success callback) are: Thank you. That clears up a lot. But the question that remains is that two different types of data are returned: 1)Script 2)Text The answer may be in the mime type. $()load is so much easier to use. I will research futher. regards tim
[jQuery] default value of an object's property
hi there, a quick question: i'm using an object to pass a series of variables. Sometimes, i test for a specific property, which might not exist. I can't seem to find the right way, i tried Obj.sortby = (typeof Obj.sortby == 'undefined' || Obj.sortby=='' ||Obj.sortby == null) ? 'time' : Obj.sortby; but everytime that property sortby hasn't been set, firebug returns it as null can you clear that up for me? Thanks a lot! Alexandre
[jQuery] Re: default value of an object's property
thanks guys, so if i understand correctly, an unset property, if tested, returns false. Correct ? On Wed, Feb 18, 2009 at 11:35 PM, mkmanning michaell...@gmail.com wrote: The method that Josh posted is (in some people's opinion) the preferred method for assigning values, and is sometimes called the 'default pattern' for obvious reasons (the other common form is the guard pattern ). It, along with the ternary, is usually more succinct than if/else, the latter being better suited to logic flow. On Feb 18, 1:24 pm, Ricardo Tomasi ricardob...@gmail.com wrote: or simply if (!Obj.sortby) Obj.sortby = 'time'; it's a bit more efficient. All of undefined, null, 0 or will evaluate to false, there's no need to check for each of them. Anyway, Alexandre, the ternary you posted should also work, there is probably something else wrong in your code. - ricardo On Feb 18, 3:52 pm, Josh Nathanson joshnathan...@gmail.com wrote: I think this might work, give it a try: Obj.sortby = Obj.sortby || 'time'; -- Josh -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Alexandre Plennevaux Sent: Wednesday, February 18, 2009 9:07 AM To: Jquery-en Subject: [jQuery] default value of an object's property hi there, a quick question: i'm using an object to pass a series of variables. Sometimes, i test for a specific property, which might not exist. I can't seem to find the right way, i tried Obj.sortby = (typeof Obj.sortby == 'undefined' || Obj.sortby=='' ||Obj.sortby == null) ? 'time' : Obj.sortby; but everytime that property sortby hasn't been set, firebug returns it as null can you clear that up for me? Thanks a lot! Alexandre
[jQuery] Re: default value of an object's property
@josh: it works superbly. Thanks a lot for this elegant solution ! On Thu, Feb 19, 2009 at 12:44 AM, Alexandre Plennevaux aplennev...@gmail.com wrote: thanks guys, so if i understand correctly, an unset property, if tested, returns false. Correct ? On Wed, Feb 18, 2009 at 11:35 PM, mkmanning michaell...@gmail.com wrote: The method that Josh posted is (in some people's opinion) the preferred method for assigning values, and is sometimes called the 'default pattern' for obvious reasons (the other common form is the guard pattern ). It, along with the ternary, is usually more succinct than if/else, the latter being better suited to logic flow. On Feb 18, 1:24 pm, Ricardo Tomasi ricardob...@gmail.com wrote: or simply if (!Obj.sortby) Obj.sortby = 'time'; it's a bit more efficient. All of undefined, null, 0 or will evaluate to false, there's no need to check for each of them. Anyway, Alexandre, the ternary you posted should also work, there is probably something else wrong in your code. - ricardo On Feb 18, 3:52 pm, Josh Nathanson joshnathan...@gmail.com wrote: I think this might work, give it a try: Obj.sortby = Obj.sortby || 'time'; -- Josh -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Alexandre Plennevaux Sent: Wednesday, February 18, 2009 9:07 AM To: Jquery-en Subject: [jQuery] default value of an object's property hi there, a quick question: i'm using an object to pass a series of variables. Sometimes, i test for a specific property, which might not exist. I can't seem to find the right way, i tried Obj.sortby = (typeof Obj.sortby == 'undefined' || Obj.sortby=='' ||Obj.sortby == null) ? 'time' : Obj.sortby; but everytime that property sortby hasn't been set, firebug returns it as null can you clear that up for me? Thanks a lot! Alexandre
[jQuery] Re: Javascript Generated by $()load does not render
see if this resolves your issue: ... $(document).ready(function(){ $.ajaxSetup( { dataType: 'script' }) ; $(#dynamic_content).load(myscript,task=entry, function(resp,stat,xhr){ //alert(resp); // leave for testing } ); }); On Wed, Feb 18, 2009 at 6:31 PM, Tim Johnson t...@johnsons-web.com wrote: On Wednesday 18 February 2009, Alexandre Plennevaux wrote: you can use load, you just have to setup the ajaxSetup controlling your ajax main parameters so you set it to your liking, then you call the load(). It is built on top of the ajax method to ease its use. See: http://docs.jquery.com/Ajax/jQuery.ajaxSetup#options I am looking at: http://docs.jquery.com/Types#Options in addition I am looking at printed material I see from the book: jQuery In Action - page 252 documentation for $.ajaxSetup(properties). The properties object can contain a dataType value. 1)What datatype value would configure $load so that it would handle both script and html. IOWS the CGI script returns both javascript and html? 2)Are these datatype strings themselves case sensitive. Time is limited for me right now, I'll do my home work a little later. :-) thanks again
[jQuery] Re: default value of an object's property
thanks a lot. But why did they made it so complex? do we really need the granularity to differenciate between undefined, null, 0, and false ? On Thu, Feb 19, 2009 at 1:51 AM, RobG rg...@iinet.net.au wrote: On Feb 19, 9:44 am, Alexandre Plennevaux aplennev...@gmail.com wrote: thanks guys, so if i understand correctly, an unset property, if tested, returns false. Correct ? Strictly, no. It returns undefined, which may evaluate to false depending on the test, which should be based on the possible values and how they should be treated. If you just want to see if it has some value that is or isn't falsey, use: if (obj.property) {...} which will evaluate to false where obj.property has one of a number of values - undefined, null, NaN, 0 (i.e. the number zero but not the string zero), boolean false and so on. If you declare the property but don't give it a value, its value is undefined (as in not defined) and if evaluated as part of an exrpession, undefined (the special undefined value) is returned. Therefore if you declare it and later want to see if it has been assigned a value, the best test is probably: if (obj.property === undefined) {...} It's your decision as to which is more appropriate. -- Rob
[jQuery] Re: default value of an object's property
ok thanks a lot for all this. I'll summarize it in a blog post for my own recurring memory leaks :) On Thu, Feb 19, 2009 at 3:20 AM, RobG rg...@iinet.net.au wrote: On Feb 19, 10:56 am, Alexandre Plennevaux aplennev...@gmail.com wrote: thanks a lot. But why did they made it so complex? do we really need the granularity to differenciate between undefined, null, 0, and false ? Yes, they are all have their uses in different circumstances. For example, host methods like getElementById return null if they can't find the element they're after. It lets you know that the method ran OK, it just didn't find the element. Others, like getElementsByTagName, always return a collection. If it's empty, a test like: if (nodeCollection) {...} will evaluate to true, however since there are no elements in the collection, it's length with be zero so: if (nodeCollection.length) {...} will evaluate to false (and true if there is at least one node in the collection). Javascript was intended to be a simple, easy to learn language so it has lots of features that are designed to make programming easier - e.g. lose typing and automatic conversion of primitives to objects where required. Those same features raise other issues when you dig into the detail. -- Rob
[jQuery] Re: Javascript Generated by $()load does not render
i suppose that you change try specifying the dataType as script that your ajax calls expect: Taken from: http://docs.jquery.com/Ajax/jQuery.ajax dataType The type of data that you're expecting back from the server. If none is specified, jQuery will intelligently pass either responseXML or responseText to your success callback, based on the MIME type of the response. The available types (and the result passed as the first argument to your success callback) are: * xml: Returns a XML document that can be processed via jQuery. * html: Returns HTML as plain text; included script tags are evaluated when inserted in the DOM. * script: Evaluates the response as JavaScript and returns it as plain text. Disables caching unless option cache is used. Note: This will turn POSTs into GETs for remote-domain requests. * json: Evaluates the response as JSON and returns a JavaScript Object. * jsonp: Loads in a JSON block using JSONP. Will add an extra ?callback=? to the end of your URL to specify the callback. (Added in jQuery 1.2) * text: A plain text string. On Wed, Feb 18, 2009 at 1:34 AM, Tim Johnson t...@johnsons-web.com wrote: I have a script that generates javascript validation code when called in the following code: $(document).ready(function(){ $(#dynamic_content).load(myscript,task=entry, function(resp,stat,xhr){ //alert(resp); // leave for testing } ); }); All of the contented rendered by 'myscript' is written to the innerHtml of div dynamic_content *except for the javascript*. I am viewing the content rendered by the script in firefox using the View Formatted Source add-on. If I uncomment the alert() above, I see the javascript in the response. Does anyone have an answer for this mystery. Or a work-around. Any links to discussions on this topic? thanks Tim
[jQuery] jquery context menu plugin: issue with find()
Hi there, Please save the life of those few hairs left on my skull. I've been trying to understand why this doesn't work: i'm using the jquery Context Menu (http://abeautifulsite.net/notebook/80 ) to display a context menu which options vary according to each item. So i'm using a data custom attribute to store which options should be active and the metadata plugin to retrieve the values. Works fine. Now, i need to disable context menu options according to the fetched data, but there, the functionality advertised on the plugin website does not seem to work for me. It is this part of the code which fails: // THE PLUGIN CODE BIT // Disable context menu items on the fly disableContextMenuItems: function(o) { if (o == undefined) { // Disable all $(this).find('li').addClass('disabled'); return ($(this)); } $(this).each(function() { if (o != undefined) { var d = o.split(','); for (var i = 0; i d.length; i++) { console.log('plugin is disabling option : ' + d[i]); // RETURNS A VALID ANSWER $(this).find('a[href=' + d[i] + ']').parent().addClass('disabled'); // THE SELECTOR RETURNS 0 ELEMENTS, ALTHOUGH THE MARKUP IS CORRECT. } } }); return ($(this)); }, // MY SCRIPT // it creates the contextMenu and disables for each file, the relevant options $(a.folderLink).each(function() { var thisFolder = $(this); thisFolder.contextMenu({ menu: 'contextMenu' }, function(action, el, pos) { var url = $(el).attr('href'); var directoryItem = $(el).attr('id'); alert('url : ' + $(el).attr('href') + '\nAction: ' + action + ' \nElement ID: ' + directoryItem); }); // disable non allowed options var menuOptions = thisFolder.metadata({ type: 'attr', name: 'data' }); var optionsToDisable = []; for (var my_option in menuOptions) { if (menuOptions.my_option == '0' || menuOptions.my_option == null || typeof menuOptions.my_option === 'undefined') { optionsToDisable.push('#' + my_option); } } if (optionsToDisable.length 0) { optionsToDisable = optionsToDisable.join(','); //optionsToDisable = ' + optionsToDisable + '; console.log(optionsToDisable = + optionsToDisable); thisFolder.disableContextMenuItems(optionsToDisable); } thisFolder.disableContextMenuItems(); }); So that's it: the issue is with the find() call, which does not find an element that is there in the markup.
[jQuery] Re: Custom ScrollBar
i personally have no issue with jscrollpane and jquery 1.3.1 _ i use it extensively so i suggest that you recheck your code. On Mon, Feb 16, 2009 at 4:29 PM, Alexandru Dinulescu alex.d.a...@gmail.com wrote: Hello. I am looking for a custom vertical scrollbar plugin. I want to put it in a fluid width / height div, and so far i havent found anything. The only thing i did found is jScrollpane which doesnt like to work with jquery 1.3.1 so if anyone has any info please let me know. Thanks --- Alexandru Dinulescu Web Developer (X)HTML/CSS Specialist Expert Guarantee Certified Developer XHTML: http://www.expertrating.com/transcript.asp?transcriptid=1879053 CSS : http://www.expertrating.com/transcript.asp?transcriptid=1870619 RentACoder Profile: http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInfo.aspx?lngAuthorId=6995323 MainWebsite: http://alexd.adore.ro Portofolio: http://alexd.adore.ro/project_page.php
[jQuery] Re: jquery context menu plugin: issue with find()
hi dave, thanks for the reply. In fact, it's my fault: i was calling the command against the wrong selector set. It has to be the context menu itself, not the element which triggers the context menu. it makes sense when you know it , but i wish i wouldn't have had to look into the online example source code to find that out. thanks! alexandre On Tue, Feb 17, 2009 at 3:38 AM, Dave Methvin dave.meth...@gmail.com wrote: console.log('plugin is disabling option : ' + d[i]); // RETURNS A VALID ANSWER $(this).find('a[href=' + d[i] + ']').parent().addClass('disabled'); // THE SELECTOR RETURNS 0 ELEMENTS, ALTHOUGH THE MARKUP IS CORRECT. Break down the selector there a bit. It seems like the most likely broken spot is the check for an exact match between the href and d[i]. If you switch it to [href~='+d[i]+']' do you still get a match?
[jQuery] Re: ui.tabs question
So i've tried using the latest build of ui1.6rc5, including the tabs + jquery 1.3 and i reproduced exactly the demo sample available on the jqueryUI ui.Tabs demo page with the required CSS files, but it still breaks the tabbing functionality. I've reduced my code to simply call $(#mydiv ul).tabs(); Klaus can you please tell me if something has changed in the necessary html markup from tabs 3 to the latest tab release? Is there something else, specific, that i should look for ? I'll try to isolate further my implementation to understand what the problem is in the meanwhile but any pointers would be time savers for me. Thanks a lot alexandre On Wed, Jan 21, 2009 at 11:30 PM, Alexandre Plennevaux aplennev...@gmail.com wrote: In that case, thank you Klaus for the preventive comment. On Wed, Jan 21, 2009 at 11:25 PM, Klaus Hartl klaus.ha...@googlemail.com wrote: Sorry to hear that, but I was only referring to MorningZ's example, which contained an outdated syntax and I wanted to prevent you (and everybody else) to use it and wonder why it wouldn't work. I'll try to quote better next time. --Klaus On 21 Jan., 22:43, Alexandre Plennevaux aplennev...@gmail.com wrote: Well, quite Frankly Klaus, i started this project 3 years ago and i used the tabs when it was but a plugin like another. The fact that now i have to integrate ui.core with ui.tabs is not really a good thing in my case: i don't have needs for anything else from the ui library, therefore i wish that alongside, there was a distro as a standalone plugin. I'm using jquery 1.3 so i've made myself a personalised ui distro using rc5, but now it breaks the hell out of my app, i don't have tabs anymore so here i go, back to the starting point, redoing things that were actually working well, but for that one missing callback. ah, it's hard to have a reproach to make to jquery. First in 3 years in my case, and it's not like i'm mad or anything. Just ... annoyed. :) On Wed, Jan 21, 2009 at 7:30 PM, Klaus Hartl klaus.ha...@googlemail.com wrote: Seems to be using a fairly outdated version. The event's name to bind has changed since quite a while. Why not take a look at the documentation: http://docs.jquery.com/UI/Tabs#Events --Klaus On 21 Jan., 16:36, MorningZ morni...@gmail.com wrote: I've got this code working if it helps $(#TabContainer ul.tabs).tabs().bind(select.ui-tabs, function(e, ui) { //Code inside here runs when tab is selected }); On Jan 21, 10:29 am, Alexandre Plennevaux aplennev...@gmail.com wrote: Hi all, I'm using ui.tabs and i would like to trigger a function when a tab is clicked, or more precisely, when a new panel gets shown. I figured from the doc i should use the select callback but that does not work... HEre is the code i use var $tabs = $(#tabbedTextContent).tabs({ selected: 0, fx: { opacity: 'toggle', duration: 200 }, select: function(e, ui) { alert(hi); //!-- the alert() never gets called var $img = $('#tabbedTextContent div.ui-tabs_panel:visible img.albumImage'); if ($img.length) { $('#imageLegend').text($img.attr('title')); } } }); So, the tabs are displayed and work correctly, but the select callback (namely, the alert() call) never gets fired... Right after that block of code i have $('#tabbedTextContent img.albumImage') .css('cursor', 'pointer') //.attr('title', Click to view the next image) .click(function() { // in image albums, clicking on an image brings the user to the next image var currentTab = $tabs.data('selected.tabs'); $('#imageLegend').text($(this).attr('title')); var nextTab = (currentTab $tabs.length - 1) ? currentTab + 1 : 0; $tabs.tabs('select', nextTab); return false; }); which works just fine.
[jQuery] ui.tabs question
Hi all, I'm using ui.tabs and i would like to trigger a function when a tab is clicked, or more precisely, when a new panel gets shown. I figured from the doc i should use the select callback but that does not work... HEre is the code i use var $tabs = $(#tabbedTextContent).tabs({ selected: 0, fx: { opacity: 'toggle', duration: 200 }, select: function(e, ui) { alert(hi); //!-- the alert() never gets called var $img = $('#tabbedTextContent div.ui-tabs_panel:visible img.albumImage'); if ($img.length) { $('#imageLegend').text($img.attr('title')); } } }); So, the tabs are displayed and work correctly, but the select callback (namely, the alert() call) never gets fired... Right after that block of code i have $('#tabbedTextContent img.albumImage') .css('cursor', 'pointer') //.attr('title', Click to view the next image) .click(function() { // in image albums, clicking on an image brings the user to the next image var currentTab = $tabs.data('selected.tabs'); $('#imageLegend').text($(this).attr('title')); var nextTab = (currentTab $tabs.length - 1) ? currentTab + 1 : 0; $tabs.tabs('select', nextTab); return false; }); which works just fine.
[jQuery] Re: ui.tabs question
hi MorningZ unfortunately that doesn't seem to work for me. Question: you attach that event to the tabs ul element ? On Wed, Jan 21, 2009 at 4:36 PM, MorningZ morni...@gmail.com wrote: I've got this code working if it helps $(#TabContainer ul.tabs).tabs().bind(select.ui-tabs, function(e, ui) { //Code inside here runs when tab is selected }); On Jan 21, 10:29 am, Alexandre Plennevaux aplennev...@gmail.com wrote: Hi all, I'm using ui.tabs and i would like to trigger a function when a tab is clicked, or more precisely, when a new panel gets shown. I figured from the doc i should use the select callback but that does not work... HEre is the code i use var $tabs = $(#tabbedTextContent).tabs({ selected: 0, fx: { opacity: 'toggle', duration: 200 }, select: function(e, ui) { alert(hi); //!-- the alert() never gets called var $img = $('#tabbedTextContent div.ui-tabs_panel:visible img.albumImage'); if ($img.length) { $('#imageLegend').text($img.attr('title')); } } }); So, the tabs are displayed and work correctly, but the select callback (namely, the alert() call) never gets fired... Right after that block of code i have $('#tabbedTextContent img.albumImage') .css('cursor', 'pointer') //.attr('title', Click to view the next image) .click(function() { // in image albums, clicking on an image brings the user to the next image var currentTab = $tabs.data('selected.tabs'); $('#imageLegend').text($(this).attr('title')); var nextTab = (currentTab $tabs.length - 1) ? currentTab + 1 : 0; $tabs.tabs('select', nextTab); return false; }); which works just fine.
[jQuery] Re: ui.tabs question
Well, quite Frankly Klaus, i started this project 3 years ago and i used the tabs when it was but a plugin like another. The fact that now i have to integrate ui.core with ui.tabs is not really a good thing in my case: i don't have needs for anything else from the ui library, therefore i wish that alongside, there was a distro as a standalone plugin. I'm using jquery 1.3 so i've made myself a personalised ui distro using rc5, but now it breaks the hell out of my app, i don't have tabs anymore so here i go, back to the starting point, redoing things that were actually working well, but for that one missing callback. ah, it's hard to have a reproach to make to jquery. First in 3 years in my case, and it's not like i'm mad or anything. Just ... annoyed. :) On Wed, Jan 21, 2009 at 7:30 PM, Klaus Hartl klaus.ha...@googlemail.com wrote: Seems to be using a fairly outdated version. The event's name to bind has changed since quite a while. Why not take a look at the documentation: http://docs.jquery.com/UI/Tabs#Events --Klaus On 21 Jan., 16:36, MorningZ morni...@gmail.com wrote: I've got this code working if it helps $(#TabContainer ul.tabs).tabs().bind(select.ui-tabs, function(e, ui) { //Code inside here runs when tab is selected }); On Jan 21, 10:29 am, Alexandre Plennevaux aplennev...@gmail.com wrote: Hi all, I'm using ui.tabs and i would like to trigger a function when a tab is clicked, or more precisely, when a new panel gets shown. I figured from the doc i should use the select callback but that does not work... HEre is the code i use var $tabs = $(#tabbedTextContent).tabs({ selected: 0, fx: { opacity: 'toggle', duration: 200 }, select: function(e, ui) { alert(hi); //!-- the alert() never gets called var $img = $('#tabbedTextContent div.ui-tabs_panel:visible img.albumImage'); if ($img.length) { $('#imageLegend').text($img.attr('title')); } } }); So, the tabs are displayed and work correctly, but the select callback (namely, the alert() call) never gets fired... Right after that block of code i have $('#tabbedTextContent img.albumImage') .css('cursor', 'pointer') //.attr('title', Click to view the next image) .click(function() { // in image albums, clicking on an image brings the user to the next image var currentTab = $tabs.data('selected.tabs'); $('#imageLegend').text($(this).attr('title')); var nextTab = (currentTab $tabs.length - 1) ? currentTab + 1 : 0; $tabs.tabs('select', nextTab); return false; }); which works just fine.
[jQuery] Re: ui.tabs question
In that case, thank you Klaus for the preventive comment. On Wed, Jan 21, 2009 at 11:25 PM, Klaus Hartl klaus.ha...@googlemail.com wrote: Sorry to hear that, but I was only referring to MorningZ's example, which contained an outdated syntax and I wanted to prevent you (and everybody else) to use it and wonder why it wouldn't work. I'll try to quote better next time. --Klaus On 21 Jan., 22:43, Alexandre Plennevaux aplennev...@gmail.com wrote: Well, quite Frankly Klaus, i started this project 3 years ago and i used the tabs when it was but a plugin like another. The fact that now i have to integrate ui.core with ui.tabs is not really a good thing in my case: i don't have needs for anything else from the ui library, therefore i wish that alongside, there was a distro as a standalone plugin. I'm using jquery 1.3 so i've made myself a personalised ui distro using rc5, but now it breaks the hell out of my app, i don't have tabs anymore so here i go, back to the starting point, redoing things that were actually working well, but for that one missing callback. ah, it's hard to have a reproach to make to jquery. First in 3 years in my case, and it's not like i'm mad or anything. Just ... annoyed. :) On Wed, Jan 21, 2009 at 7:30 PM, Klaus Hartl klaus.ha...@googlemail.com wrote: Seems to be using a fairly outdated version. The event's name to bind has changed since quite a while. Why not take a look at the documentation: http://docs.jquery.com/UI/Tabs#Events --Klaus On 21 Jan., 16:36, MorningZ morni...@gmail.com wrote: I've got this code working if it helps $(#TabContainer ul.tabs).tabs().bind(select.ui-tabs, function(e, ui) { //Code inside here runs when tab is selected }); On Jan 21, 10:29 am, Alexandre Plennevaux aplennev...@gmail.com wrote: Hi all, I'm using ui.tabs and i would like to trigger a function when a tab is clicked, or more precisely, when a new panel gets shown. I figured from the doc i should use the select callback but that does not work... HEre is the code i use var $tabs = $(#tabbedTextContent).tabs({ selected: 0, fx: { opacity: 'toggle', duration: 200 }, select: function(e, ui) { alert(hi); //!-- the alert() never gets called var $img = $('#tabbedTextContent div.ui-tabs_panel:visible img.albumImage'); if ($img.length) { $('#imageLegend').text($img.attr('title')); } } }); So, the tabs are displayed and work correctly, but the select callback (namely, the alert() call) never gets fired... Right after that block of code i have $('#tabbedTextContent img.albumImage') .css('cursor', 'pointer') //.attr('title', Click to view the next image) .click(function() { // in image albums, clicking on an image brings the user to the next image var currentTab = $tabs.data('selected.tabs'); $('#imageLegend').text($(this).attr('title')); var nextTab = (currentTab $tabs.length - 1) ? currentTab + 1 : 0; $tabs.tabs('select', nextTab); return false; }); which works just fine.
[jQuery] Re: Download a file from server...
Well, AFAIK It HAS to be triggered by a click event on a A anchor, so, just make sure your onclick handler returns true. For the force download functionality, this writeup of mine might help you: http://www.pixeline.be/blog/2009/php-force-download-script-convert-url-to-localpath/ On Thu, Jan 22, 2009 at 2:30 AM, MorningZ morni...@gmail.com wrote: You don't want AJAX in this situation have the page post like normal and do what you lay out above... AJAX is *not* the solution to every problem On Jan 21, 6:46 pm, AlexDeLarge perkeleenperkelesaat...@gmail.com wrote: Hi, I have situation like this: I post certain data with $.post to PHP- script which is supposed to handle the data, create a file from it and then trigger browser to open a Save As-dialog. Everything works just fine except the Save As-dialog, I just can't make it pop-up. For the Save As dialog the PHP-script ha s following statements: header('Content-disposition: attachment; filename=stats.txt'); header('Content-type: text/plain'); readfile('stats.txt'); And this just doesn't work through $.post, or at least I can't make it happen. Is there any way to make this work?
[jQuery] Re: Problems with the New API Browser
Well, i for one really love the new API interface _ such a much less noisy interface than the docs.jquery.com interface! clearer, snappier. it turns out i don't use the navigation menu much, i use the filter box mostly. that's probably why i'm not so annoyed by its limits. really liked the interfacing with jsbin, yet i would like to be able to contribute with a comments system (like the awesome php doc, where people conribute snippets related to the php function displayed on that page). congratz Remy, and let us designers know if u need help ! On Fri, Jan 16, 2009 at 12:40 AM, Remy Sharp r...@leftlogic.com wrote: I think the animation of menus is one for the options as well then. I understand what you mean, once you're familiar with it, you just want to get on with it. On Jan 15, 9:28 pm, Ricardo Tomasi ricardob...@gmail.com wrote: Two things bother me more: - James' #3 point, that other categories hide when you click one, an accordion would be a better fit for quick navigation. - the subcategories. I like to see the method's names directly, deciding between Hierarchy or Child filters is not an intuitive task. They should be in a kind of tree with the subcategories as separators. These two things would speed up navigation a lot. As it is, it's quite interesting the first time, but gets irritating after a while. Thanks for this Remy, and long live JSBin! :) cheers, - ricardo On Jan 15, 6:35 pm, Remy Sharp r...@leftlogic.com wrote: Hi James, Thank you for your detailed feedback - all good points. I want to push out another release when 1.3.1 goes live - so I'd like to get some, if not all, of the feedback addressed (including others). 1 + 2) almost the same thing - the first problem I see is the AIR browser, which obviously doesn't have a back browser button (which would be solved by your first point). This needs some UI input (which I'll come on to in a minute). 3) I've talked with Yehuda Katz, the original author of Visual jQuery, about navigation interfaces - there's two options (as alternatives to what I have now) that we talked about: tree nav and accordion. Generally speaking, the tree navigation didn't take as well as the Visual jQuery approach. An accordion (I think) would solve the issues you've specifically mentioned, but would also solve some similar feedback I've read, i.e. wanting to be able to scan a category whilst maintaining some hierarchy. (note that you can do this - but it doesn't quite solve the problem:http://api.jquery.com?category=attributes ). 4) Easy to solve - I didn't have access to a designer (I'm a coder through and through) but a few simple tweaks to the CSS (I suspect) should sort this out. 5) I've had the same feedback, but both as a pro *and* as a con (as you have) - so I was going to create an options area that would maintain some certain settings - the focus opacity being one of them. 6) This is common piece of feedback - and simply a technical block I ran in to and ran out of time. Permalinks are my to priority right now, I want people to link straight in to a specific function. I won't be able to have the URL change as the user browses - but the title of the function (and probably some other visual que, i.e. icon) will give the user a permalink to the function. I also want this to work for categories too, so: http://api.jquery.com/attr-would show a list of all the matched functions (alahttp://api.jquery.com/?attr) - but I'd like it if the category hierarchy would also show in left sidebar. In addition: http://api.jquery.com/Core-would land open the Core category - and so on through the subcategories. I'd be more than happy if you contact me offline to lend a hand with some of the UI changes required. @Pappy - there's more I want to do with landing pages, but it's a slightly more complicated job (given that, I think, 1.3.1 is supposed to be going out next week) - but some fast view on all the functions would be useful - I agree. If there's more feedback - I'd love to hear it - particular the issues people have. Many thanks, Remy. On Jan 15, 4:22 am, James Van Dyke jame...@gmail.com wrote: Does anyone else find the new API browser to be a bit cumbersome? My gripes: 1) No back link at top of vertical navigation list. You must click the category to cancel your choice and essentially go back. However, this isn't very intuitive and there aren't any affordances to this behavior save for a small 'x' in the highlighted category box that doesn't do anything on hover or even have a tooltip. 2) The browser's back button is broken. Kind of a big annoyance when you're not used to the application. 3) Recovering from a mistake is more punishing than it should be. Clicking on a category hide the other categories. Since the title of the category moved from under your mouse, you now have to scan to
[jQuery] feature suggestion: .attr() without params returns the whole list of attributes
I would like to suggest a feature to add to jquery attributes commands: I 'm using custom attributes to store UI states. At some point i would find it handy to be able to just console.log($(this).attr() ) to see all the attributes and their value. Not a groundbreaking change, but a nice -to-have... thanks Alexandre
[jQuery] Re: feature suggestion: .attr() without params returns the whole list of attributes
quite nice karl, thanx ! On Tue, Jan 6, 2009 at 6:09 PM, Karl Swedberg k...@englishrules.com wrote: I just played around in Firebug and noticed that DOM elements have an attributes property (in Firefox, at least), so I tried this, using the first textarea in my document as an example: var a = $('textarea')[0].attributes, attrs = []; for (i=0; i a.length; i++) { attrs.push(a[i].nodeName + ': ' + a[i].nodeValue); } attrs.join('\n'); and Firebug displayed all of the attributes, including expandos: id: other_qualifications name: other_qualifications class: optional rows: 3 itsalltext_uid: 212w1e1b2r3d231z2g232q302c2x231i1e172v342v3b1p1p Not exactly what you wanted, but I still thought it was kind of cool/worth sharing. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Jan 6, 2009, at 11:06 AM, Ricardo Tomasi wrote: You can't see all data saved either.. On Jan 6, 12:01 pm, Balazs Endresz balazs.endr...@gmail.com wrote: Why not use $(el).data() for that? On Jan 6, 12:57 pm, Alexandre Plennevaux aplennev...@gmail.com wrote: I would like to suggest a feature to add to jquery attributes commands: I 'm using custom attributes to store UI states. At some point i would find it handy to be able to just console.log($(this).attr() ) to see all the attributes and their value. Not a groundbreaking change, but a nice -to-have... thanks Alexandre
[jQuery] Re: example on site, have question
Basically, what this snippet does, is 1/ adding a DIV element at the end of the BODY element; 2/ counting the new amount of DIV 3/ printing the string there are XX dvis in every SPAN element available in the DOM 4/ triggering the onclick() event so the script runs once on page ready. So the whole script actually runs whenever the document is ready, and then every time someone clicks on the body. On Tue, Jan 6, 2009 at 5:05 PM, Andy adharb...@gmail.com wrote: I'm trying to figure out how this works. It appears it is re- iterating the click function in this call. Why would this work? I don't see how I would know to create the method this way if I was going to recreate this. $(document).ready(function(){ $(document.body).click(function () { $(document.body).append($(div)); var n = $(div).size(); $(span).text(There are + n + divs. + Click to add more.); }).click(); // trigger the click to start });
[jQuery] Re: Call object method onclick
this worked for me: http://jsbin.com/utahi On Sun, Jan 4, 2009 at 5:31 PM, fatslags2...@gmail.com fatslags2...@googlemail.com wrote: function Viewer() { }; Viewer.prototype.constructor = Viewer; Viewer.prototype = { getFullAreaId: function() { return this._fullAreaId; }, setFullAreaId: function(fullAreaId) { this._fullAreaId = fullAreaId; }, initialize: function() { $(#thumbs img:first).click(/* execute this.doX on mouse click */); }, doX: function() { alert(this.getFullAreaId()); } }; How can I make the click event execute the doX method? Regards, FatSlags2004
[jQuery] animations staggering when $().load called _ advise please
Hello friends, I have a dropdown menu that animates horziontally each time you click on one its links. Some of them reveal a submenu, others load some html via ajax ($(container).load();) and others do both. I notice that animations tend to stagger when ajax calls are under progress . What would be a good approach to remove these lags? Of course, once the data is loaded and in the cache, no more staggering. There is a lot of html bits so preloading all of them is not really my favourite option, so here i stand, asking for your advises. Thank you and have a great week ! Alexandre
[jQuery] event binding issue
hello friends, i'm injecting a menu ( UL LI A markup) and binding each A anchor a click event, but the event fails to trigger. Can you explain me what i'm dooing wrong? here is the code sample: $('a' + linkText + '/a').appendTo($dsanchors).attr({ 'href': '#' + index, 'id': index, 'class': (linkText == selected) ? 'selected' : 'notSelected' }).bind('click', function() { alert(hi); return false; }).wrap('li/li'); the html is correctly injected, but the event is not attached.
[jQuery] Re: event binding issue
Hi Michael , sorry it's my fault i made a stupid mistake somewhere else ( i dare not tell you what it was, I think i'd better get some sleep :) ). The code as such worked, so i would assume the wrap() does not unbind the events. Thanks again! alexandre On Sat, Jan 3, 2009 at 11:50 PM, Michael Geary m...@mg.to wrote: Without testing it, off the top of my head I think it may be the .wrap() that is doing you in. That has to remove the element from the DOM and re-insert it, and I think that loses the event binding. Also, I take it that $dsanchors refers to a UL, is that right? Then you're temporarily inserting the A element directly into the UL, which is invalid. Maybe browsers allow it anyway, but there's no guarantee what they will do. I would try this instead: $('a' + linkText + '/a') .attr({ 'href': '#' + index, 'id': index, 'class': linkText == selected ? 'selected' : 'notSelected' }) .wrap('li/li') .appendTo($dsanchors); $('#'+index).bind('click', function() { alert(hi); return false; }); -Mike -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Alexandre Plennevaux Sent: Saturday, January 03, 2009 2:20 PM To: Jquery-en Subject: [jQuery] event binding issue hello friends, i'm injecting a menu ( UL LI A markup) and binding each A anchor a click event, but the event fails to trigger. Can you explain me what i'm dooing wrong? here is the code sample: $('a' + linkText + '/a').appendTo($dsanchors).attr({ 'href': '#' + index, 'id': index, 'class': (linkText == selected) ? 'selected' : 'notSelected' }).bind('click', function() { alert(hi); return false; }).wrap('li/li'); the html is correctly injected, but the event is not attached.
[jQuery] Re: setInterval(obj.method,200) problem: scoping?
Michael, did you know that i 'm becoming a big fan of your explanations? if i follow your explanation correctly, this should have worked, isn't it ? datascape.myInterval = setInterval(window.datascape.move,400); Yet it didn't. I guess i 'm kind of assimilating the javascript window object to actionscript's _root object, and that assumption is probably plain wrong :) On Fri, Jan 2, 2009 at 11:49 PM, Michael Geary m...@mg.to wrote: Hi Alexandre, Don't go adopting a coding practice just because of a single mailing list message. :-) There's nothing wrong with quoting property names in an object literal, but the majority of experienced JavaScript programmers do not quote them except when necessary. As an example, browse through the jQuery source code: http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js Most of the property names in the code are not quoted, except for those few that are invalid identifiers or reserved words. Regarding setTimeout and setInterval, a minor nitpick on terminology: setTimeout and setInterval scope the called function to the window object. Actually, the *scope* of the called function is determined by its position in the source code. JavaScript uses lexical scoping, where a nested function can directly refer to variables declared in outer functions or in the global scope. That's why your setInterval callback is able to use your thisObj variable, because the interpreter follows the scope chain from the inner function up to the outer function and finds the variable there. What you're talking about is the value of this in the setInterval callback. setInterval and setTimeout call your callback function as a method of the global object (which is the window object in a browser). Or another way to put it is that they don't call the function as a method of any object at all, and by default this is set to the global object. In any case, terminology nitpicks aside, your code is the right way to solve the problem! :-) -Mike From: Alexandre Plennevaux hi donb, according to a lengthy discussion we had on this mailinglist yesterday the quotes are good practice. see: http://groups.google.com/group/jquery-en/msg/821f4eb134c51d3d (is is just one message on a 31-long thread, if u have time ,read the whole thread it is interesting ) As for this issue after extensive googling i found out that setTimeout and setInterval scope the called function to the window object, not the object the setinterval is called in. Therefore here is how to do it: var datascape = { 'mouseX': 0, 'myInterval': 0, 'create': function(){ var thisObj = this; //-- store this object instance in a variable $('#datascape').bind('mousemove', function(e) { this.mouseX = e.pageX; }).bind(mouseover, function() { datascape.myInterval = setInterval(function() { thisObj.move(); }, 1000); // -- use the vairable referencing the instance }).bind(mouseout, function() { clearInterval(datascape.myInterval); }); }, 'move': function(){ $.log('datascape.move : mouseX = ' + this.mouseX); } } On Thu, Jan 1, 2009 at 3:46 PM, donb falconwatc...@comcast.net wrote: You should change 'move' to move (remove apostrophes). On Jan 1, 9:01 am, Alexandre Plennevaux aplennev...@gmail.com wrote: Hello mates, i have an object datascape which among other things, contains a property storing the mouse position, and a function that uses that property. Inside another method i var datascape = { 'mouseX': 0, 'myInterval': 0, 'create': function(){ $('#datascape').bind('mousemove', function(e) { this.mouseX = e.pageX; }).bind(mouseover, function() { this.myInterval = setInterval(this.move, 200); }).bind(mouseout, function() { clearInterval(this.myInterval); }); }, 'move': function(){ $.log('datascape.move : mouseX = ' + this.mouseX); } } Yet the script does not work: firebug console points at the setInterval call, saying: useless setInterval call (missing quotes around argument?)http://localhost/prototype/_js/frontend/proto.03.js Line 172 can someone help me / explain what i'm doing wrong ? Thank you, Alexandre PS: to all jquerians: happy 2009 !!
[jQuery] Re: setInterval(obj.method,200) problem: scoping?
Thanks a lot Peter, that function is really neat ! On Sat, Jan 3, 2009 at 2:25 AM, pete higgins phigg...@gmail.com wrote: Here is your orig snippet rewritten to use the rescope function I pasted: var datascape = { 'mouseX': 0, 'myInterval': 0, 'create': function(){ $('#datascape').bind('mousemove', rescope(this, function(e) { this.mouseX = e.pageX; })).bind(mouseover, rescope(this, function() { this.myInterval = setInterval(rescope(this, move), 200); })).bind(mouseout, rescope(this, function() { clearInterval(this.myInterval); })); }, 'move': function(){ $.log('datascape.move : mouseX = ' + this.mouseX); } } Though I didn't test it ... You are calling window.datascape.move still in the window scope, when you want the scope (this) to be retained throughout your function calls. Saving a ref to it (var self = this) and accessing it in a function is still the solution. rescope is just that wrapped in a function for sugar (more or less). By passing 'this' to the rescope() function, you are effectively doing the same as self = this; function(){ self.foo(); } .. I find it much cleaner (the non-stripped version of rescope() allows for passing an ambigious number of parameters to the rescope'd function) and easier to work with when I'm explicitly setting the execution scope. Regards, Peter Higgins On Fri, Jan 2, 2009 at 8:06 PM, Alexandre Plennevaux aplennev...@gmail.com wrote: Michael, did you know that i 'm becoming a big fan of your explanations? if i follow your explanation correctly, this should have worked, isn't it ? datascape.myInterval = setInterval(window.datascape.move,400); Yet it didn't. I guess i 'm kind of assimilating the javascript window object to actionscript's _root object, and that assumption is probably plain wrong :) On Fri, Jan 2, 2009 at 11:49 PM, Michael Geary m...@mg.to wrote: Hi Alexandre, Don't go adopting a coding practice just because of a single mailing list message. :-) There's nothing wrong with quoting property names in an object literal, but the majority of experienced JavaScript programmers do not quote them except when necessary. As an example, browse through the jQuery source code: http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js Most of the property names in the code are not quoted, except for those few that are invalid identifiers or reserved words. Regarding setTimeout and setInterval, a minor nitpick on terminology: setTimeout and setInterval scope the called function to the window object. Actually, the *scope* of the called function is determined by its position in the source code. JavaScript uses lexical scoping, where a nested function can directly refer to variables declared in outer functions or in the global scope. That's why your setInterval callback is able to use your thisObj variable, because the interpreter follows the scope chain from the inner function up to the outer function and finds the variable there. What you're talking about is the value of this in the setInterval callback. setInterval and setTimeout call your callback function as a method of the global object (which is the window object in a browser). Or another way to put it is that they don't call the function as a method of any object at all, and by default this is set to the global object. In any case, terminology nitpicks aside, your code is the right way to solve the problem! :-) -Mike From: Alexandre Plennevaux hi donb, according to a lengthy discussion we had on this mailinglist yesterday the quotes are good practice. see: http://groups.google.com/group/jquery-en/msg/821f4eb134c51d3d (is is just one message on a 31-long thread, if u have time ,read the whole thread it is interesting ) As for this issue after extensive googling i found out that setTimeout and setInterval scope the called function to the window object, not the object the setinterval is called in. Therefore here is how to do it: var datascape = { 'mouseX': 0, 'myInterval': 0, 'create': function(){ var thisObj = this; //-- store this object instance in a variable $('#datascape').bind('mousemove', function(e) { this.mouseX = e.pageX; }).bind(mouseover, function() { datascape.myInterval = setInterval(function() { thisObj.move(); }, 1000); // -- use the vairable referencing the instance }).bind(mouseout, function() { clearInterval(datascape.myInterval); }); }, 'move': function(){ $.log('datascape.move : mouseX = ' + this.mouseX); } } On Thu, Jan 1, 2009 at 3:46 PM, donb falconwatc...@comcast.net wrote: You should change 'move' to move (remove apostrophes). On Jan 1, 9:01 am, Alexandre Plennevaux aplennev...@gmail.com wrote: Hello mates, i have
[jQuery] Re: setInterval(obj.method,200) problem: scoping?
nice example, now i think i get it. Indeed actionscript (v2 at least) is based on ecmascript, much like javascript if i'm not mistaken. I came to web design/dev from actionscript one and gradually made my way to jquery. Anyway, actionscript keeps you away from the internal cooking by using a metaphor, timeline: basically you work with objects and organise them on a main timeline, _root (or _level0). Each object has its own timeline, can be put inside another object, so you would address it as _root.myStepMother.face.hairyChin; I wrongly assumed javascript would allow me to do it for setInterval(). hehe, how boring would be the world without all these little variations, now wouldn't it :) ? That's pretty much the problem with using metaphors: it's nice to get you fast into a certain task, but you have to actually break it up to be able to master the technology behind. Thank you Mike and Peter for your excellent help ! On Sat, Jan 3, 2009 at 2:44 AM, Michael Geary m...@mg.to wrote: Thanks, Alexandre, it's kind of you to say that. About this code... datascape.myInterval = setInterval(window.datascape.move,400); Let's break it down a little. It's exactly the same as doing: var callback = window.datascape.move; datascape.myInterval = setInterval( callback, 400 ); As you can see from this code, JavaScript doesn't remember that the callback function was a property of the datascape object. When you get a reference to the function, that's all you get, a reference to the function itself, without any information about what object the function may have been a method of. So when setInterval calls the function later, it just calls it as a plain old function, and this is the global/window object. Doesn't ActionScript work the same way? It may have a different global object, but I thought most of the JavaScript semantics were similar except for the ActionScript extensions. I haven't worked with ActionScript so I don't know. -Mike From: Alexandre Plennevaux Michael, did you know that i 'm becoming a big fan of your explanations? if i follow your explanation correctly, this should have worked, isn't it ? datascape.myInterval = setInterval(window.datascape.move,400); Yet it didn't. I guess i 'm kind of assimilating the javascript window object to actionscript's _root object, and that assumption is probably plain wrong :) On Fri, Jan 2, 2009 at 11:49 PM, Michael Geary m...@mg.to wrote: Hi Alexandre, Don't go adopting a coding practice just because of a single mailing list message. :-) There's nothing wrong with quoting property names in an object literal, but the majority of experienced JavaScript programmers do not quote them except when necessary. As an example, browse through the jQuery source code: http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js Most of the property names in the code are not quoted, except for those few that are invalid identifiers or reserved words. Regarding setTimeout and setInterval, a minor nitpick on terminology: setTimeout and setInterval scope the called function to the window object. Actually, the *scope* of the called function is determined by its position in the source code. JavaScript uses lexical scoping, where a nested function can directly refer to variables declared in outer functions or in the global scope. That's why your setInterval callback is able to use your thisObj variable, because the interpreter follows the scope chain from the inner function up to the outer function and finds the variable there. What you're talking about is the value of this in the setInterval callback. setInterval and setTimeout call your callback function as a method of the global object (which is the window object in a browser). Or another way to put it is that they don't call the function as a method of any object at all, and by default this is set to the global object. In any case, terminology nitpicks aside, your code is the right way to solve the problem! :-) -Mike From: Alexandre Plennevaux hi donb, according to a lengthy discussion we had on this mailinglist yesterday the quotes are good practice. see: http://groups.google.com/group/jquery-en/msg/821f4eb134c51d3d (is is just one message on a 31-long thread, if u have time ,read the whole thread it is interesting ) As for this issue after extensive googling i found out that setTimeout and setInterval scope the called function to the window object, not the object the setinterval is called in. Therefore here is how to do it: var datascape = { 'mouseX': 0, 'myInterval': 0, 'create': function(){ var thisObj = this; //-- store this object instance in a variable $('#datascape').bind('mousemove', function(e) { this.mouseX = e.pageX; }).bind(mouseover, function() { datascape.myInterval
[jQuery] Re: A beautiful diagram
wow, that's an amazing library, some demos are really impressive! i like the polar clock for instance: http://raphaeljs.com/polar-clock.html thanks for the link ricardo ! On Wed, Dec 31, 2008 at 10:50 PM, Ricardo Tomasi ricardob...@gmail.com wrote: raphael js might be of help: raphaeljs.com On Dec 31, 9:39 am, vlain rudi.ver...@gmail.com wrote: Hi to everybody (happy 2009), I have to create a diagram (a view from some data). The diagram includes objects (rectangle, rounded rectangle, ellipse...) and connection beetween objects (different kind of lines). Each object have to display some informations as clickable text and image. Diagram has to allow simple cute effects (zoom_in, zoom_out, highlight...) for example on mouse hover and so on. Any hints for a library/plugin above jQuery?
[jQuery] Re: Unable to populate my div in Firefox
try this: function doData(p_id,cat,cat_id,first,last){ var url = doData.php?p_id=+ p_id +cat=+ cat +cat_id= + cat_id; $('#doContainer').empty().load(url,function(htmlData,result)); if(result==success){ $(this).html(htmlData); }else{ $(this).html(ERROR LOADING +url); } } On Thu, Jan 1, 2009 at 10:06 AM, sho...@ckwi.net sho...@ckwi.net wrote: i m getting strange problem. i m unable to pupulate my div in Firefox Mozilla. but in IE i m getting no problem. i m using following function. function doData(p_id,cat,cat_id,first,last){ document.getElementById(doContainer).innerHTML=; $.ajax({ url : doData.php?p_id=+ p_id +cat=+ cat +cat_id= + cat_id , success : function (data) { $(#doContainer).html(data); // this is not working in firefox } }); } $(#doContainer).html(data) is not working in firefox. plz give my any alternative solution r assist me to get it done. as i m in trouble due to this.
[jQuery] setInterval(obj.method,200) problem: scoping?
Hello mates, i have an object datascape which among other things, contains a property storing the mouse position, and a function that uses that property. Inside another method i var datascape = { 'mouseX': 0, 'myInterval': 0, 'create': function(){ $('#datascape').bind('mousemove', function(e) { this.mouseX = e.pageX; }).bind(mouseover, function() { this.myInterval = setInterval(this.move, 200); }).bind(mouseout, function() { clearInterval(this.myInterval); }); }, 'move': function(){ $.log('datascape.move : mouseX = ' + this.mouseX); } } Yet the script does not work: firebug console points at the setInterval call, saying: useless setInterval call (missing quotes around argument?) http://localhost/prototype/_js/frontend/proto.03.js Line 172 can someone help me / explain what i'm doing wrong ? Thank you, Alexandre PS: to all jquerians: happy 2009 !!
[jQuery] Re: setInterval(obj.method,200) problem: scoping?
hi donb, according to a lengthy discussion we had on this mailinglist yesterday the quotes are good practice. see: http://groups.google.com/group/jquery-en/msg/821f4eb134c51d3d (is is just one message on a 31-long thread, if u have time ,read the whole thread it is interesting ) As for this issue after extensive googling i found out that setTimeout and setInterval scope the called function to the window object, not the object the setinterval is called in. Therefore here is how to do it: var datascape = { 'mouseX': 0, 'myInterval': 0, 'create': function(){ var thisObj = this; //-- store this object instance in a variable $('#datascape').bind('mousemove', function(e) { this.mouseX = e.pageX; }).bind(mouseover, function() { datascape.myInterval = setInterval(function() { thisObj.move(); }, 1000); // -- use the vairable referencing the instance }).bind(mouseout, function() { clearInterval(datascape.myInterval); }); }, 'move': function(){ $.log('datascape.move : mouseX = ' + this.mouseX); } } On Thu, Jan 1, 2009 at 3:46 PM, donb falconwatc...@comcast.net wrote: You should change 'move' to move (remove apostrophes). On Jan 1, 9:01 am, Alexandre Plennevaux aplennev...@gmail.com wrote: Hello mates, i have an object datascape which among other things, contains a property storing the mouse position, and a function that uses that property. Inside another method i var datascape = { 'mouseX': 0, 'myInterval': 0, 'create': function(){ $('#datascape').bind('mousemove', function(e) { this.mouseX = e.pageX; }).bind(mouseover, function() { this.myInterval = setInterval(this.move, 200); }).bind(mouseout, function() { clearInterval(this.myInterval); }); }, 'move': function(){ $.log('datascape.move : mouseX = ' + this.mouseX); } } Yet the script does not work: firebug console points at the setInterval call, saying: useless setInterval call (missing quotes around argument?)http://localhost/prototype/_js/frontend/proto.03.js Line 172 can someone help me / explain what i'm doing wrong ? Thank you, Alexandre PS: to all jquerians: happy 2009 !!
[jQuery] Re: setInterval(obj.method,200) problem: scoping?
hi Dave, thanks a lot for the feedback. The reason i'm not using the dom but rather more conceptual objects is because the application is quite complex, and its easier for my small brain to keep track of all variables as object properties. On Fri, Jan 2, 2009 at 2:02 AM, Dave Methvin dave.meth...@gmail.com wrote: Whoops, I missed the original issue, which was that setInterval needs to be told its this object. So change this: this.interval = setInterval(function(){ $.log('datascape.move : mouseX = ' + this.mouseX); }, 1000); to this: var self = this; this.interval = setInterval(function(){ $.log('datascape.move : mouseX = ' + self.mouseX); }, 1000);
[jQuery] Re: HELP: Screening questions for JavaScript developer candidates:
Kean and especially Michael, Thank you for sharing this very useful knowledge bit ! This must be the most insightful thread in a while :) Alexandre On Wed, Dec 31, 2008 at 8:49 AM, Kean shenan...@gmail.com wrote: Alexandre, Another word of caution. Do choose your labels carefully. Avoid keywords. Adding quotes to keyword labels ensure compatibility with YUI compressor. var a = { // new without quotes produce error in ie new: function() { alert(new); }, // class without quotes produce error in ie class: function() { alert(class); }, // YUI compressor won't compress if you have no quotes on keywords float: function() { alert(float); }, int: function(){ alert(int); } } a.new(); // still fails in ie a.class(); // still fails in ie a.float(); a.int();
[jQuery] Re: Setting the request header contentType
did you try playing with the $.ajax scriptCharset option ? see: http://docs.jquery.com/Ajax/jQuery.ajax On Wed, Dec 31, 2008 at 1:27 PM, AdrianMG yens...@gmail.com wrote: I am not pretty sure but I think you can work with UTF8 only in AJAX, but I recommend you work with UTF8 always On Dec 30, 2:09 pm, Romain Viovi imp...@gmail.com wrote: Hello Everybody, I'm experiencing some problems with the $.ajax When sending simple post request, request Headers (logged with firebug) are always application/x-www-form-urlencoded; charset=UTF-8 tagged for content-type see : Request Headers User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 Accept */* Accept-Language fr Accept-Encoding gzip,deflate Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive 300 Connection keep-alive Content-Typeapplication/x-www-form-urlencoded; charset=UTF-8 X-Requested-WithXMLHttpRequest Content-Length 152 But, i'm always working with iso-8859-1 encoding, my page include headers with the good charset, php.ini is set to the good default charset. So, when i retrieve the $_POST, i've to utf8_decode() cause utf8 datas are retrieved and special chars as é, à are not recognised I think I shouldn't have to do that... Here's the test.html file : !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 titleTest encoding/title script type=text/javascript language=javascript src=jquery-1.2.6.js /script /head body form enctype=application/x-www-form-urlencoded; charset=ISO-8859-1 action=test.php name=search method=post input id=qry name=qry value= type=text /input type=button onclick=send(); value=ok / /form div id=answers /div script type=text/javascript language=javascript function send(){ $.ajax({ type: POST, url: ./test.php, contentType: application/x-www-form-urlencoded; charset=iso-8859-1, data: { qry: $('#qry')[0].value }, success: function(data){ $('#answers').empty().append(data); return; } }); } /script /body /html And the test.php : ?php header(Content-Type: text/html; charset=ISO-8859-1); var_dump($_POST); ? Thanx for the help ! -- Romain Viovi 42 rue Pigalle 75009 Paris +33 6 63 16 90 15 +33 9 54 40 84 40 romain.vi...@gmail.com
[jQuery] Re: HELP: Screening questions for JavaScript developer candidates:
friends, following what i learned in this post i'm busy rewriting my object. i have a specific question. in my old code i would have something like: var datascape = new Object(); datascape.ini = function(){ datascape.availableWidth = $(window).width(); } }; can i rewrite it like this: var datascape= { 'ini': function(){ this.availableWidth = $(window).width(); } So that, if i need it somewhere else, i can just get to its value datascape.availableWidth or do i have to explicitate it ? var datascape= { 'ini': function(){ datascape.availableWidth = $(window).width(); } Thanks !!! On Wed, Dec 31, 2008 at 5:16 PM, pete higgins phigg...@gmail.com wrote: and, yeah, I usually put in bare keys (sans quotes) unless necessary, too. Not sure why. I guess I just like the clean look. Yah, they just seem to be wasted bytes, huh? One thing to note, and the only reason I try to force myself to use the quotes is for portability. If the data is really JSON and expects to be consumed by languages not javascript, the quotes are [likely] necessary, eg PHP. js and php can share a common json fragment if they are quoted. $d = json_decode(file(someFile.json)); foreach($d as $item = $val){ .. } really its just a distinction between what js can do and JSON this isn't JSON: var foo = { bar:function(){ .. }, baz: new Date() }; (I know you know, too, btw) About anything can be a key in JS. (DomNodes can't, though btw, but functions objects etc) var bar = { a:b, c:d }; var bar2 = [1,2,3,4]; var foo = {}; foo[bar] = baz; foo[bar2] = baz2; if(bar in foo){ console.log(foo[bar]); } // baz if(bar2 in foo){ console.log(foo[bar2]); } // baz2 Fun. Thanks for the banter, Karl. Regards, Peter Higgins
[jQuery] Re: HELP: Screening questions for JavaScript developer candidates:
Klaus, you got me: frankly i have no real idea what is the purpose of enclosure. That's abstract art to me. i just read in several places that it's good to use it, so i trust my sources, do it and move on. Not that i'm proud of it, but, to use a metaphor, one does not need to know the internals of a car in order to be able to drive it, although it surely is a valuable knowledge if one wants to keep its car in a good state ! Yet, since the car changes every six months, it's just up to you, wheather you're driven by the pure developer's passion or by consumer pragmatism. On Tue, Dec 30, 2008 at 1:28 PM, Klaus Hartl klaus.ha...@googlemail.com wrote: On 30 Dez., 08:45, Alexandre Plennevaux aplennev...@gmail.com wrote: JavaScript enclosures? i think it has to do with encapsulating your code inside a function so that all vars are inside the function's scope, so not cluttering the global namespace. This, to avoid memory leak. Are you implying that global variables do leak memory? There are good reasons to not clutter the global namespace but I don't believe avoiding leaks is one of them. Actually you do increase the chance to create leaks in IE if you use closures under certain circumstances. --Klaus
[jQuery] selector question: how many ul above $(this) ?
hello mates, i have a multiple level dropdown menu, the markup is an unordered list of the likes: ul lia href=#me/a ullia href=#me/a/li lia href=#me/a ullia href=#me/a/li lia href=#me/a/li lia href=#me/a/li /ul /li lia href=#me/a/li /ul/li lia href=#me/a ullia href=#me/a/li lia href=#me/a ullia href=#me/a/li lia href=#me/a/li lia href=#me/a/li /ul /li lia href=#me/a/li /ul /li lia href=#me/a/li /ul Imagine i click in the link 3 levels down the list. Can someone tell me how i can find the value 3, meaning, the amount of parent ul? i tried var $thisA = $(this); var $thisLI = $thisA.parent(); var $thisMenu = $thisLI.parent(); var $thisSubmenu = $thisLI.children('ul'); var thisMenuLevelInt = $thisLI.parents().index($thisMenu[0]); but that always returns 0. Your help is as usual, *much* appreciated ! Alexandre
[jQuery] Re: HELP: Screening questions for JavaScript developer candidates:
wair, you're all scarrying me: i often do things like this: var datascape = new Object(); datascape.el = $('#datascape'); datascape.ini = function(){ datascape.el.click(function(){ dothis(); dothat(); }); } is this pattern causing a potential memory leak problem, because the js object is linked to a DOM element? On Tue, Dec 30, 2008 at 10:10 PM, Kean shenan...@gmail.com wrote: A good reason why closure is used http://yuiblog.com/blog/2006/06/01/global-domination/ On Dec 30, 1:04 pm, Kean shenan...@gmail.com wrote: Klaus is right, Here's an article about closure causing leakshttp://www.javascriptkit.com/javatutors/closuresleak/index.shtml On Dec 30, 4:38 am, Alexandre Plennevaux aplennev...@gmail.com wrote: Klaus, you got me: frankly i have no real idea what is the purpose of enclosure. That's abstract art to me. i just read in several places that it's good to use it, so i trust my sources, do it and move on. Not that i'm proud of it, but, to use a metaphor, one does not need to know the internals of a car in order to be able to drive it, although it surely is a valuable knowledge if one wants to keep its car in a good state ! Yet, since the car changes every six months, it's just up to you, wheather you're driven by the pure developer's passion or by consumer pragmatism. On Tue, Dec 30, 2008 at 1:28 PM, Klaus Hartl klaus.ha...@googlemail.com wrote: On 30 Dez., 08:45, Alexandre Plennevaux aplennev...@gmail.com wrote: JavaScript enclosures? i think it has to do with encapsulating your code inside a function so that all vars are inside the function's scope, so not cluttering the global namespace. This, to avoid memory leak. Are you implying that global variables do leak memory? There are good reasons to not clutter the global namespace but I don't believe avoiding leaks is one of them. Actually you do increase the chance to create leaks in IE if you use closures under certain circumstances. --Klaus
[jQuery] Re: HELP: Screening questions for JavaScript developer candidates:
why? It's just a shorthand, isn't it ? does it affect the computer resources in any manner ? On Wed, Dec 31, 2008 at 3:12 AM, Kean shenan...@gmail.com wrote: Just a nitpick. Don't do this var datascape = new Object(); var datascape2 = new Array(); Instead var datascape = {}; var datascape2 = []; On Dec 30, 1:27 pm, Alexandre Plennevaux aplennev...@gmail.com wrote: wair, you're all scarrying me: i often do things like this: var datascape = new Object(); datascape.el = $('#datascape'); datascape.ini = function(){ datascape.el.click(function(){ dothis(); dothat(); }); } is this pattern causing a potential memory leak problem, because the js object is linked to a DOM element? On Tue, Dec 30, 2008 at 10:10 PM, Kean shenan...@gmail.com wrote: A good reason why closure is used http://yuiblog.com/blog/2006/06/01/global-domination/ On Dec 30, 1:04 pm, Kean shenan...@gmail.com wrote: Klaus is right, Here's an article about closure causing leakshttp://www.javascriptkit.com/javatutors/closuresleak/index.shtml On Dec 30, 4:38 am, Alexandre Plennevaux aplennev...@gmail.com wrote: Klaus, you got me: frankly i have no real idea what is the purpose of enclosure. That's abstract art to me. i just read in several places that it's good to use it, so i trust my sources, do it and move on. Not that i'm proud of it, but, to use a metaphor, one does not need to know the internals of a car in order to be able to drive it, although it surely is a valuable knowledge if one wants to keep its car in a good state ! Yet, since the car changes every six months, it's just up to you, wheather you're driven by the pure developer's passion or by consumer pragmatism. On Tue, Dec 30, 2008 at 1:28 PM, Klaus Hartl klaus.ha...@googlemail.com wrote: On 30 Dez., 08:45, Alexandre Plennevaux aplennev...@gmail.com wrote: JavaScript enclosures? i think it has to do with encapsulating your code inside a function so that all vars are inside the function's scope, so not cluttering the global namespace. This, to avoid memory leak. Are you implying that global variables do leak memory? There are good reasons to not clutter the global namespace but I don't believe avoiding leaks is one of them. Actually you do increase the chance to create leaks in IE if you use closures under certain circumstances. --Klaus
[jQuery] Re: Hiding a div with content loaded via .load function
you have to make sure the DOM element (i.e. your close button) is available when you define your close() function. or use the livequery plugin. or use event delegation. On Mon, Dec 29, 2008 at 4:09 AM, amnesia440 spaceman...@gmail.com wrote: Hello. I am trying to load a login form into the #login_pop_box div via the .load function: $('#login_pop_box').hide(); $('a#login_pop_box_on').click(function() { $('#login_pop_box').load('ajax/login_global'); $('#login_pop_box').fadeIn('400'); }); $('a#login_pop_box_off').click(function() { $(this).parents('#login_pop_box').fadeOut('300'); }) This works, but when I try to cose the window with a link contained in the content I just loaded, nothing happens. Here is the link i the loaded content: a href=# id=login_pop_box_off[x]close/a
[jQuery] Re: Getting a menu item Li to do 2 things at once? onclick AND regular href trigger?
really? I thought one had to namespace an event for it not to overwrite previously set behaviours. $('a').bind('click.scroll',function(){ scrollTo(moon); }); $('a').bind('click.alert1',function(){ alert('Me works too'); }); }); On Mon, Dec 29, 2008 at 5:06 PM, Ricardo Tomasi ricardob...@gmail.com wrote: You can add as many listeners as you want: $('a').click(function(){ scrollTo(moon); }); $('a').click(function(){ alert('Me works too'); }); $('a').click(function(){ alert('damn, stop using alerts'); }); $('a').click(function(){ openFlash(); }); On Dec 29, 7:37 am, yvonney yvonn...@gmail.com wrote: Hi... just starting out to get this going. I'm guessing that the reason onclick code has the #, for example: a href=# onclick=someFunction.add etc code etc etc /a is because it can't do the onclick AND more typical things like this example: lia href=#myID/a/li Is because they conflict... SOo! I have my Li/ul menu code doing a bunch of scrollto stuff. Took weeks to figure out. NOW I need to have the SAME menu, when I click on the Li's bring up a different flv video for each menu item (li) sheeesh... do I use live query or what. I'm REALLY stumped... I do have a much greater 'sorta' understanding of the: neolao flv player, swfobject2, jquery.swfobject.js, jmedia plugin, luke's flash plugin, and malsup's medai plugin. whew! :--) Though the REAL problem is to get some kinda elegant way of having the flv videos play in a seperate div location (stop when new video starts as well) when I click on each and every menu item. And, there menu items already are doing their scrollto coda-scroller type thing already. Yes... this question is my biggest question ever... Could a guru please comment on how to get the menu items to do BOTH what they're doing now as standard lia href=#myID/a/li AND also do the calling of the (I guess?) onclick thing to call the videos individually at the same time. I guess it shouldn't take me more than all year to do... hehehe what's left of it thank fully! if that makes sense...hehehe thank you for reading.
[jQuery] loading a DOM fragment via ajax
Hello Friends, say i have a html file containing a #viewPort div, with a series of divs each containing an h4 tag. If the file was not external, i would simply select what i need like this: $('#dsViewport h3'); Now, it is an external file, so my question is: is it possible to load this file via $.load(myfile.php#dsViewport h3); or is the syntax different, or not possible at all ? Thank you for your insight, Alexandre
[jQuery] Re: HOW: jQuery AJAX to replace iFRAME
add to the script: return false; to prevent the default A behaviour $(document).ready(function(){ $('a.ajaxLink').click(function(){ var url = $(this).attr('href'); $('#ihateiframes').empty().load(url); }); return false; }); On Mon, Dec 29, 2008 at 3:32 PM, BlueStunt bluest...@gmail.com wrote: I'm trying to do the same thing, the code you suggested works, but the text on the page changes to what's in the html file I link to but then the browser also moves to the page, how do i stop this? On Dec 22, 1:51 pm, Alexandre Plennevaux aplennev...@gmail.com wrote: say the container that will display the loaded content, i.e, your iframe becomes div id=menu a href=page/to/load.html class=ajaxLinkclick me/a a href=page/to/load2.html class=ajaxLinkclick me 2/a div id=ihateiframes pthis will be replaced/p /div your javascript will be: $(document).ready(function(){ $('a.ajaxLink').click(function(){ var url = $(this).attr('href'); $('#ihateiframes').empty().load(url); }); }); On Mon, Dec 22, 2008 at 6:51 AM, Ayan ios...@gmail.com wrote: Hi Currently my page has a iFrame (loads an external web-page) in it. I have seen this tutorial that uses simple AJAX to replace this iFrame. http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm (see the small DEMO, I want exactly the same with just 2 Links) My question is - How can I do the same using jQuery's AJAX to do the same ? Thats is, when these 2 Button/Link hit, it will fetch corresponding remote html and paste it in a DIV. Thats it. Please do reply. Ayan Debnath INDIA.
[jQuery] Re: loading a DOM fragment via ajax
thank you Mike ! Now, i don't actually want to display the loaded content, just need to traverse it, and generate a submenu (one a element per h3 element found, using the h3 element attributes). Can i actually load it inside a variable? On Mon, Dec 29, 2008 at 10:47 PM, Mike Alsup mal...@gmail.com wrote: say i have a html file containing a #viewPort div, with a series of divs each containing an h4 tag. If the file was not external, i would simply select what i need like this: $('#dsViewport h3'); Now, it is an external file, so my question is: is it possible to load this file via $.load(myfile.php#dsViewport h3); or is the syntax different, or not possible at all ? Thank you for your insight, Alexandre I believe the syntax you need is this: $('#someElement').load(myfile.php #dsViewport h3); The first space delimits the url. Everything after that is a selector.
[jQuery] Re: loading a DOM fragment via ajax
thanks it works indeed. one thing though: apparently, the load() call does load the entire html spitted by the server side script or html page, the selector is actually just trimming the loaded content. So it's not a reduction of the amount of data loaded, just a welcome help to reduce further dom querying. On Mon, Dec 29, 2008 at 11:15 PM, Mike Alsup mal...@gmail.com wrote: thank you Mike ! Now, i don't actually want to display the loaded content, just need to traverse it, and generate a submenu (one a element per h3 element found, using the h3 element attributes). Can i actually load it inside a variable? Sure. I think this will work: $('div/').load(myfile.php #dsViewport h3);
[jQuery] load() callback only performs once every two click
Strange... i'm loading html inside a div, and have this callback: $('#datascape').show().load('index.php?splash=labau',{}, function(html, result) { $('#datascape').css({background: 'red'}); }); yet, the callback performs only once out of 2 triggering calls. Firebug does log each call correctly so it seems it's a rendering issue, yet it happens in FF3, IE7 and chrome. Does this weirdness sound familiar to you, or any idea what's going wrong? Thanks, Alexandre
[jQuery] Re: load() callback only performs once every two click
hey ricardo, thanks for the input. I found the error: i was actually hiding the load container somewhere else in the code. *sight*... On Tue, Dec 30, 2008 at 5:52 AM, Ricardo Tomasi ricardob...@gmail.com wrote: I don't see any click event handlers, and from what it looks you can't tell visually if the load() was successful because on the 2nd time the background is already red. On Dec 29, 9:07 pm, Alexandre Plennevaux aplennev...@gmail.com wrote: Strange... i'm loading html inside a div, and have this callback: $('#datascape').show().load('index.php?splash=labau',{}, function(html, result) { $('#datascape').css({background: 'red'}); }); yet, the callback performs only once out of 2 triggering calls. Firebug does log each call correctly so it seems it's a rendering issue, yet it happens in FF3, IE7 and chrome. Does this weirdness sound familiar to you, or any idea what's going wrong? Thanks, Alexandre
[jQuery] Re: HELP: Screening questions for JavaScript developer candidates:
JavaScript enclosures? i think it has to do with encapsulating your code inside a function so that all vars are inside the function's scope, so not cluttering the global namespace. This, to avoid memory leak. something the likes: (function(){ /// your code goes here })(jquery); I have absolutely no idea if this bits-and-pieces knowledge of mine is any good, or even if it makes sense :) On Tue, Dec 30, 2008 at 6:14 AM, Angel Marquez angel.marq...@gmail.com wrote: haha they are contemplating hiring me! I already sent it back and thought I'd post it here to see the response. Appreciate it. I think my answers were correct.. The first argument method is 'void', correct? On Mon, Dec 29, 2008 at 9:07 PM, Michael Geary m...@mg.to wrote: Huh? Are you writing these questions, or you've been given them to answer and you're looking for help answering them, or what? If you're looking for the answers, is the potential employer contemplating hiring you, or hiring the rest of us in this group? :-) The list seems to be first and foremost a test to weed out older candidates. You need mighty good eyes to read that tiny font! Anyway, let me skip right to the end: BONUS 7: (Super-impressive) Q: Can you summarize the definition of JavaScript enclosures? No, I can't. Can you? What the heck is a JavaScript enclosure? -Mike p.s. Is there anything to do with jQuery here? From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Angel Marquez Sent: Monday, December 29, 2008 7:48 PM To: jquery-en@googlegroups.com Subject: [jQuery] HELP: Screening questions for JavaScript developer candidates: (required) Q: Describe the difference in result of the JavaScript DOM methods getElementById and getElementsByClassName. 2. (required) Given this JavaScript statement: objXHR.open('GET',' HYPERLINK http://; http://myURL.com',true); a. Q: What, probably, is the type of the object named objXHR? b. Q: What is the purpose of each of the parameters being passed to the open method? Q: If an absolute URL is passed in the second argument, what kind of restriction usually applies? 3. (required) How would you (a) declare and then (b) instantiate a JavaScript class to describe a Square object, taking one argument in its constructor? The instance of a Square should have sides 4 units in length. ( c )What properties might a Square object have and how would they be coded? a. declare: function Square(numericSideArgument) { ... (some other stuff) } b. use: var mySquare = new Square(4); c. methods: perimeter, coded as this.perimeter = numericSideArgument * 4; area, coded as this.area = numericSideArgument ^ 2; (squared, i.e. width * height) So, the whole definition of Square would be: function Square(numericSideArgument) { this.perimeter = numericSideArgument * 4; this.area = numericSideArgument ^ 2; return this; } So, Q: mySquare.perimeter would equal? Q: mySquare.area would equal ? 4. (desired) An object called auto has an id attribute with value of taurus and a color attribute with value blue. Additionally, it has a child object radio, which contains an array knob which contains three items with names and shapes: name: power, shape: round name: tune, shape: oval name: scan, shape: square Q: What does the acronym JSON stand for? Q: What does this object look like in JSON? BONUS 5. (CSS-related) Describe the difference between a DIV element versus a SPAN. BONUS 6. (Advanced JavaScript and YUI) If I have a JavaScript collection object YAHOO.util.Dom with a member method setStyle that takes three arguments an array of element id's a css property name, and a single float value, ...Q: how would I write the single line of JavaScript that sets the transparency of DIV's layer1 and layer2 to 66%? Q: How would I write the single line of JavaScript that sets the background color of only DIV layer1 to hexadecimal black? Q: If there was another method which DID take a single-value, non-array, in that first argument, in object-oriented terminology, the method would be said to be what? Q: Does JavaScript support overloading? BONUS 7: (Super-impressive) Q: Can you summarize the definition of JavaScript enclosures?
[jQuery] Re: Code not working in IE but is working in FF
can u show your updated code ? On Sun, Dec 28, 2008 at 4:02 PM, Althalos ca...@ekdahlproduction.com wrote: Srry for my first reply to this message. It DOES work if one remove the anonymity. One has also to remove ( function ) () in favor of an initiating functionname() instead =) On 28 Dec, 10:32, Alexandre Plennevaux aplennev...@gmail.com wrote: Maybe try a named function instead of an anonymous one ? so avoiding arguments.callee by using your function name instead? On Sun, Dec 28, 2008 at 2:03 AM, Althalos ca...@ekdahlproduction.com wrote: Nope, I'm sorry but that doesn't seem to work. Note that setting opacity to zero works in both browsers. On 28 Dec, 01:25, Alexandre Plennevaux aplennev...@gmail.com wrote: really not sure, but maybe try A/ 1- (step/1) instead of 1-step/1 B/ $(#slogan).css('opacity',0); instead of $(#slogan).css('opacity','0'); On Sun, Dec 28, 2008 at 1:04 AM, Althalos ca...@ekdahlproduction.com wrote: I posted something similarly before but I posted wrong code. This time, everything is correct and I'll provide all the information needed. First of all, the URL to the site which is not working is http://uf.ekdahlproduction.com/itsvintage2/ The error: In FF everything works perfectly but in IE it gets stuck on 1% and nothing happens whatsoever. The code: $(document).ready(function(){ $(#slogan).css('opacity','0'); var step = 1; (function(){ step -= 100; $(#percentage).text(100-step/100 + '%'); if ( step 0 ) $(#logo).fadeTo(100,1-step/1, arguments.callee); else window.location = http://uf.ekdahlproduction.com/ itsvintage2/home.html; if ( step == 3500 ) $(#slogan).fadeTo(3500,1); })(); }); Comments: I have noticed that it changes the opacity correctly, and also sets the content of #percentage to 1%, therefore Jquery must be working. Maybe this can be some kind of general javascript error? Something that IE interprets differently than FF? Thank you
[jQuery] Re: Please help with navigation script
hi pranshu, it's hard to tell exactly, you could optimize a bit more your code, and use variable caching for example. In this regard, I find this post to be really helpful: http://www.tvidesign.co.uk/blog/improve-your-jquery-25-excellent-tips.aspx anyway, does the problem occur if you comment out each $('#refine_by').text() calls, such as $('#refine_by').text('Refine by category'); ? On Sun, Dec 28, 2008 at 11:27 PM, precar pranshua...@gmail.com wrote: Still stuck on this...would really appreciate someone's help. Thanks, Pranshu. On Dec 27, 11:56 am, precar pranshua...@gmail.com wrote: Hi, I cleaned up the code a bit and wanted to repost it. The site is athttp://pranshuarya.com/test/pthesis/. Once again, the specific problem is this: When you click Portfolio Refine by category and select a category, it loads and works fine. But then you cannot re-click on Refine by category to select another category. The link stops working after it's been used once. // display category list in pop-up $.get('categories.php',function(cats) { $('#refine_by').toggle(function() { $('#refine_by').text('Click to close'); $('#categories').append('div id=categories_lower_border/ div').append('div id=reset_sitesreset/div').show('slow').append ('ul'); $(cats).find('categories').each(function() { var $entry = $(this); var $cat = $entry.find('category').text(); var category = 'li' + $cat + '/li'; $('#categories ul').append($(category)); }); $('#category_close').click(function() { $('#categories').hide('slow'); $('#refine_by').text('Refine by category'); }); $('#reset_sites').click(function() { reset_sites(); }); // selection from category list $('#categories ul li').bind('click',function() { var index = $('#categories ul li').index(this); $.throbberShow({image:'images/ajax-loader.gif', parent:'#sites'}); $.get(index + .php,function(data) { var $category = $(cats).find('category').eq(index).text(); $('#sites').empty().append('div id=sites_border/div').append ('div id=refine_byClick to close/div') .append('ul'); $(data).find('site').each(function() { var $entry = $(this); var $site_title = $entry.find('site_title').text(); var html_site = 'li' + $site_title + '/li'; $('#sites ul').append($(html_site)); }); cat_box_close(); // site details for category-filtered sites $('#sites ul li').bind('click',function() { var index = $('#sites ul li').index(this); $('#site_details').empty().append('div id=site_details_lower_border/div'); $('li:not(this)').removeClass('selected'); $(this).addClass('selected'); $imageURL = $(data).find('imageURL').eq(index).text(); $skills = $(data).find('skills_used').eq(index).text(); $siteURL = $(data).find('siteURL').eq(index).text(); var html_image = 'diva href=' + $siteURL + 'img src=' + $imageURL + ' //a/div'; $('#site_details').append($(html_image)); $('#site_details div').addClass('screenshot'); if($(data).find('imageURL2').eq(index).text() != '') { $imageURL2 = $(data).find('imageURL2').eq(index).text(); var html_image2 = 'div'; if($(data).find('siteURL2').eq(index)) { $siteURL2 = $(data).find('siteURL2').eq(index).text(); html_image2 += 'a href=' + $siteURL2 +'img src=' + $imageURL2 + ' //a/div'; } else html_image2 += 'a href=' + $siteURL +'img src=' + $imageURL2 + ' //a/div'; $('#site_details').append($(html_image2)); $('#site_details div').addClass('screenshot'); } else $('#site_details div.screenshot').removeClass ('screenshot').addClass('screenshot_single'); $('a...@href^=http]').attr({'target': '_blank'}).attr({'title': 'Visit site'}); if($(data).find('description').eq(index)) { $desc = $(data).find('description').eq(index).text(); var html_desc = 'div id=description' + $desc + '/div'; $('#site_details').append($(html_desc)); } if($(data).find('site_details').eq(index) != '') { $details = $(data).find('site_details').eq(index).text(); var html_details = 'div id=detailsbr /' + $details + '/ div'; $('#site_details').append($(html_details)); } var html_skills = 'div id=skillsstrongSkills used:/ strongbr /' + $skills + '/div'; $('#site_details').append($(html_skills)); }); // end of site details for category-filtered sites });}); // End of category list pop-up }, // other part of toggle function on #refine_by function() { cat_box_close(); }); }); Thanks, Pranshu. On Dec 27, 7:29 am, donb falconwatc...@comcast.net wrote: I didn't look too deeply into the code, but I suspect you are expecting appended elements to respond to click events, but those new elements will have no
[jQuery] Re: Code not working in IE but is working in FF
really not sure, but maybe try A/ 1- (step/1) instead of 1-step/1 B/ $(#slogan).css('opacity',0); instead of $(#slogan).css('opacity','0'); On Sun, Dec 28, 2008 at 1:04 AM, Althalos ca...@ekdahlproduction.com wrote: I posted something similarly before but I posted wrong code. This time, everything is correct and I'll provide all the information needed. First of all, the URL to the site which is not working is http://uf.ekdahlproduction.com/itsvintage2/ The error: In FF everything works perfectly but in IE it gets stuck on 1% and nothing happens whatsoever. The code: $(document).ready(function(){ $(#slogan).css('opacity','0'); var step = 1; (function(){ step -= 100; $(#percentage).text(100-step/100 + '%'); if ( step 0 ) $(#logo).fadeTo(100,1-step/1, arguments.callee); else window.location = http://uf.ekdahlproduction.com/ itsvintage2/home.html; if ( step == 3500 ) $(#slogan).fadeTo(3500,1); })(); }); Comments: I have noticed that it changes the opacity correctly, and also sets the content of #percentage to 1%, therefore Jquery must be working. Maybe this can be some kind of general javascript error? Something that IE interprets differently than FF? Thank you
[jQuery] Re: question
did you try listing the arguments array within each detected function ? On Tue, Dec 23, 2008 at 1:18 PM, Dirceu Barquette dirceu.barque...@gmail.com wrote: Thanks. You are right! But, do you have any suggest? Thank you! Dirceu Barquette 2008/12/23 MorningZ morni...@gmail.com Advice: more specific subject lines than the ultra vague and useless question will get you better and faster help On Dec 23, 6:10 am, Dirceu Barquette dirceu.barque...@gmail.com wrote: Hi, Has anybody a solution? showing a few jQuery methods : var Typeof = {}; for (v in $) { Typeof = typeof $[v]; $('divspan'+Typeof+' /spanspan '+v+' /span/div').appendTo('body'); } Is it possible showing parameters list for each method above? thank you!!! Dirceu Barquette
[jQuery] Re: JQuery Spell Checker plugin
even simpler: right-click view source. http://brandonaaron.net/jquery/plugins/spellcheck/jquery.spellcheck.js On Tue, Dec 23, 2008 at 5:12 PM, MorningZ morni...@gmail.com wrote: Any idea how to get this plugin - Load up Firefox and Firebug (which you should have as a JavaScript developer) - Pull up the page you link to above - in the Net tab on Firebug, go to the jquery.spell.check.js line - Right click the Response tab and choose Copy Response Body The contents of the script is now sitting in your clipboard On Dec 23, 10:40 am, Raghu techhel...@gmail.com wrote: Hi, I am looking for JQuery spell checker plugin from brandon... I can below below link but there is no script and documentation available.. Any idea how to get this plugin. http://plugins.jquery.com/project/spellcheck Thanks Raghu
[jQuery] Re: I wrote a YUI Multi FIle Compression Utility
it sounds very interesting, but i'm quite puzzled on how to do it correctly. i'm interested in reducing the load time of my websites but i don't really master these compression logics. I would have assumed i'd have to point to the html file loading the js+css files but your app seems to look for folders. If i'm correct, what file structure is supposed to work for this? I for one store all my javascript in a _js folder , which contains a frontend for the files dealing with the frontend, and a backend for the javascript files used in the backend app. I have a 3rd folder jquery_plugins folder inside this _js, which contains a folder for each plugin that i use. given that folder structure, is it possible to use your app? Sorry if this is out of my league... On Tue, Dec 23, 2008 at 5:27 PM, K-BL axel...@aim.com wrote: Hey Guys, I just finished writing a YUI Multi-File Compression Utility. It's really simple, it just runs some CLI commands, but more importantly, it compiles entire directories and sub directories with a clean UI. For us IT guys, it makes quick site changes a breeze from source to compressed in just seconds. Anyway, find it here: http://jqueryplugins.weebly.com/yui-compressor-multi-file-utility.html If you like it, let me know. Also, source is available in C#. K-BL
[jQuery] Re: I wrote a YUI Multi FIle Compression Utility
ok , i tried it out and i can see it spits out my js files completely minified. Nice... really nice. how about going to the next automation process: what if i could point your app to my index.html, which contains a dozen LINK to css files and SCRIPT to js files. Could it compile all of the CSS in one css file, and all of the js in one js file (so as to decrease the http connections), both minified, outputting a index.prod.html with the link to the optimized css file and js file ? i would have so much use for such a tool i'd pay for it, allowing me to keep a dev version and a prod version synchronised automatically. thanks for listening. On Tue, Dec 23, 2008 at 6:46 PM, K-BL axel...@aim.com wrote: My utility is used for manual compression, this would ensure best results from your server. YUI Compressor (and some other compression engines) take unnecessary characters out of your code (line breaks, spaces, comments), optimizes private functions/variables, and returns a non-encoded, single line output. On Dec 23, 12:03 pm, Alexandre Plennevaux aplennev...@gmail.com wrote: it sounds very interesting, but i'm quite puzzled on how to do it correctly. i'm interested in reducing the load time of my websites but i don't really master these compression logics. I would have assumed i'd have to point to the html file loading the js+css files but your app seems to look for folders. If i'm correct, what file structure is supposed to work for this? I for one store all my javascript in a _js folder , which contains a frontend for the files dealing with the frontend, and a backend for the javascript files used in the backend app. I have a 3rd folder jquery_plugins folder inside this _js, which contains a folder for each plugin that i use. given that folder structure, is it possible to use your app? Sorry if this is out of my league... On Tue, Dec 23, 2008 at 5:27 PM, K-BL axel...@aim.com wrote: Hey Guys, I just finished writing a YUI Multi-File Compression Utility. It's really simple, it just runs some CLI commands, but more importantly, it compiles entire directories and sub directories with a clean UI. For us IT guys, it makes quick site changes a breeze from source to compressed in just seconds. Anyway, find it here:http://jqueryplugins.weebly.com/yui-compressor-multi-file-utility.html If you like it, let me know. Also, source is available in C#. K-BL
[jQuery] Re: jqModal ajax question
simplest way is to use it like this: html : a href=page/to/load/loadinfo.php?var=valfoo=bar class=jqModalLoad the page/a then initiate your jqmodal like this: javascript: $(document).ready(function(){ $(.jqm({trigger: 'a.jqModal',ajax:'@href'}); }); HTH alexandre On Mon, Dec 22, 2008 at 8:49 AM, strangevoi...@gmail.com wrote: Hi, I was wondering if someone could help me with the jqModal plugin (http://dev.iceburg.net/jquery/jqModal/). Basically, I want to pass some GET data when calling an AJAX link for the modal box but am not sure how to do it. My setup for the modal box is: $('#jInfo').jqm({ajax: 'loadinfo.php', trigger: 'false'}); And I'm calling it through a function: function(t) { $('#jInfo').jqmShow(); } And I would like to have it call something like: loadinfo.php?id=t (where 't' is the function variable) Any help much appreciated Cheers, Sean
[jQuery] Re: HOW: jQuery AJAX to replace iFRAME
say the container that will display the loaded content, i.e, your iframe becomes div id=menu a href=page/to/load.html class=ajaxLinkclick me/a a href=page/to/load2.html class=ajaxLinkclick me 2/a div id=ihateiframes pthis will be replaced/p /div your javascript will be: $(document).ready(function(){ $('a.ajaxLink').click(function(){ var url = $(this).attr('href'); $('#ihateiframes').empty().load(url); }); }); On Mon, Dec 22, 2008 at 6:51 AM, Ayan ios...@gmail.com wrote: Hi Currently my page has a iFrame (loads an external web-page) in it. I have seen this tutorial that uses simple AJAX to replace this iFrame. http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm (see the small DEMO, I want exactly the same with just 2 Links) My question is - How can I do the same using jQuery's AJAX to do the same ? Thats is, when these 2 Button/Link hit, it will fetch corresponding remote html and paste it in a DIV. Thats it. Please do reply. Ayan Debnath INDIA.
[jQuery] Re: Bizarre rendering issue (FF 3, IE 6)
jared, your website is supernice and promising, but i for one don't understand anything about your problem description. i think either you're lacking sleep or you wrote too fast :) Can you rephrase please, for people that don't yet know your website internals (or lack sleep themselves ) ?can you also enable logging (i have firebug) on the page online, because the console doesn't show anything here. Thanks alexandre On Mon, Dec 22, 2008 at 2:08 PM, userdude farri...@gmail.com wrote: I am having an issue with the following jQuery code: http://www.houseofoverlord.com/c/jeniffer/bhive/test2.html http://www.houseofoverlord.com/c/jeniffer/bhive/test2.html The rendering that is not occurring is when the page: * Loads * When clicking the main (horizontal) menu items What is supposed to happen is the default (first) navsecondary a tag is supposed to receive a current class designation. If I console.log, everything seems fine, but the screen display does not show the change, and the HTML view in Firefox does not demonstrate the update (class=current). If you click on about us and then click on what we do, that behavior is supposed to happen automatically when clicking the about us menu link. Anybody know what's going on? Thanks! Jared -- View this message in context: http://www.nabble.com/Bizarre-rendering-issue-%28FF-3%2C-IE-6%29-tp21127522s27240p21127522.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Masked Input Plugin 1.2.1 Released
Josh, these are very cool additions, love the New mask syntax option '?' and the improved usability. Thanks for your hard work! just noticed in the demo that if i don't fill the input completely and go to another input, it removes the entered value entirely as soon as the input loses focus. That's a bit harsh. Maybe that's where a validation should take over and paint the input red so that the user realizes he didn't completely filled in the content. On Mon, Dec 22, 2008 at 3:39 PM, Josh Bush josh.b...@gmail.com wrote: There is now a new version of my Masked Input Plugin ( http://digitalbush.com/projects/masked-input-plugin/ ) for jQuery. Version 1.2.1 moves one step closer to my bigger picture for the plugin. I had to make a few breaking changes to do so, but I feel that the end result is worth it. This release adds a lot more polish to the 1.2 release. Here's what we've got. * BREAKING CHANGE: Removed deprecated $.mask.addPlaceholder method. Use the $.mask.definitions['']=; syntax instead. I said I was going to do this on the last release and now seems just as good a time as any. * BREAKING CHANGE: Removed allowPartial option in favor of new mask syntax I'll describe below. A discussion and code exchange with Michael Bray inspired this change. I hate that it's a breaking change, but the new way makes a lot more sense. * New mask syntax option '?'. Anything listed after '?' within the mask is considered optional user input. The common example for this is phone number + optional extension. The new syntax will look like this: (999) 999-? x9 * I got rid of the awkward input behavior where users typed over top of existing input. The plugin acted like a word processor Insert mode. This has always agrivated me, so now the input shifts on input and backspace/delete. * Now calling .change() on blur if the value has changed since the plugin prevents the change event from being fired naturally. * Pasting incomplete test no longer wipes the input. Instead, the cursor is just placed where the input leaves off. * Fixed backspace detection for iPhone. Plugin is now iPhone compatible. * Fixed pasting bug when mask starts with a literal and caret position is on the literal character. I feel really good about this release. I made some changes that I feel are good for the direction of the plugin. Iif you don't like some of the changes please let me know and I'll look at adding them back in as options. I'm trying hard not to bloat things up, but I don't want to remove features that are needed. Merry Christmas! Josh digitalbush.com
[jQuery] Re: Bizarre rendering issue (FF 3, IE 6)
ok, i got it, well, at least the problem. now, i'm not sure about how to solve it. 1/ maybe it's a css issue. in your stylesheet, try changing this #aboutus .nav .navmain a.current, #aboutus .nav .navsecondary a.current { color: #a5ee26; } #aboutus .nav ul.navsecondary { left: 130px; top: 115px; } #aboutus .nav .navsecondary a { color: #c87eeb; } into #aboutus .nav ul.navsecondary { left: 130px; top: 115px; } #aboutus .nav .navsecondary a { color: #c87eeb; } #aboutus .nav .navmain a.current, #aboutus .nav .navsecondary a.current { color: #a5ee26; } 2./ i noticed you use the function doShowStorywrap(c) sometimes passing it a jquery object, sometimes just this. The case in which the rendering does not happen is when you don't use a jquery object, so i would try that, see if that changes anything. On Mon, Dec 22, 2008 at 4:10 PM, userdude farri...@gmail.com wrote: Hi Alexandre, Thank you for the reply. I'm not sure what you mean by enable debugging in Firebug. Basically, the first submenu item for specific menu item should always default to having the current class. Although I can tell that something is occurring using console.log to inspect the a-link addClass method, the actual html for the page rendering is not applying; I effectively cannot see the results of the addClass method that is run if I am doing an addClass method during only the main menu selections. The best way to see what I mean is to: * first, click the about us link. * then, click the what we do link The what we do link should be highlighted just like after the second click when clicking on the about us link. As far as I can tell, addClass is running, but the page is not actually rendering the change, and Firebug is not showing the class in the HTML inspector. Right-click on the what we do link, select Inspect Element, then click on the about us link. See the current goes away? It should stay, and I can't figure out why it's not working. Thanks! Jared Alexandre Plennevaux-2 wrote: jared, your website is supernice and promising, but i for one don't understand anything about your problem description. i think either you're lacking sleep or you wrote too fast :) Can you rephrase please, for people that don't yet know your website internals (or lack sleep themselves ) ?can you also enable logging (i have firebug) on the page online, because the console doesn't show anything here. Thanks alexandre On Mon, Dec 22, 2008 at 2:08 PM, userdude farri...@gmail.com wrote: I am having an issue with the following jQuery code: http://www.houseofoverlord.com/c/jeniffer/bhive/test2.html http://www.houseofoverlord.com/c/jeniffer/bhive/test2.html The rendering that is not occurring is when the page: * Loads * When clicking the main (horizontal) menu items What is supposed to happen is the default (first) navsecondary a tag is supposed to receive a current class designation. If I console.log, everything seems fine, but the screen display does not show the change, and the HTML view in Firefox does not demonstrate the update (class=current). If you click on about us and then click on what we do, that behavior is supposed to happen automatically when clicking the about us menu link. Anybody know what's going on? Thanks! Jared -- View this message in context: http://www.nabble.com/Bizarre-rendering-issue-%28FF-3%2C-IE-6%29-tp21127522s27240p21127522.html Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/Bizarre-rendering-issue-%28FF-3%2C-IE-6%29-tp21127522s27240p21129366.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Masked Input Plugin 1.2.1 Released
i think personally that indeed a callback onError, that is called when the input loses focus would be great. from thereon, the user can defines what to do. for instance, as a UI developer, i would add a error class to the wrapping div, and add Incomplete data message to the right of the input. But another would go as far as alert(missing data you moron !!) . At least my desk neighbour would, he's so uneducated :) On Mon, Dec 22, 2008 at 4:25 PM, Josh Bush josh.b...@gmail.com wrote: Thank you Jörn and Alexandre for your feedback. I'm thinking that maybe I should just provide a hook that gets called when the plugin detects invalid input. I could just provide a default function that blanks the input as it is today, but would let the user decide what to do there. Any ideas on how I can make my plugin more extensible are more than welcome. Josh On Dec 22, 9:08 am, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: I second that! An option to make the plugin more tolerant, especially in combination with other forms of validation, would be perfect. Other changes all sounds fine. The fix for users typed over existing input will be much appreciated. Thanks Jörn On Mon, Dec 22, 2008 at 3:59 PM, Alexandre Plennevaux aplennev...@gmail.com wrote: Josh, these are very cool additions, love the New mask syntax option '?' and the improved usability. Thanks for your hard work! just noticed in the demo that if i don't fill the input completely and go to another input, it removes the entered value entirely as soon as the input loses focus. That's a bit harsh. Maybe that's where a validation should take over and paint the input red so that the user realizes he didn't completely filled in the content. On Mon, Dec 22, 2008 at 3:39 PM, Josh Bush josh.b...@gmail.com wrote: There is now a new version of my Masked Input Plugin ( http://digitalbush.com/projects/masked-input-plugin/) for jQuery. Version 1.2.1 moves one step closer to my bigger picture for the plugin. I had to make a few breaking changes to do so, but I feel that the end result is worth it. This release adds a lot more polish to the 1.2 release. Here's what we've got. * BREAKING CHANGE: Removed deprecated $.mask.addPlaceholder method. Use the $.mask.definitions['']=; syntax instead. I said I was going to do this on the last release and now seems just as good a time as any. * BREAKING CHANGE: Removed allowPartial option in favor of new mask syntax I'll describe below. A discussion and code exchange with Michael Bray inspired this change. I hate that it's a breaking change, but the new way makes a lot more sense. * New mask syntax option '?'. Anything listed after '?' within the mask is considered optional user input. The common example for this is phone number + optional extension. The new syntax will look like this: (999) 999-? x9 * I got rid of the awkward input behavior where users typed over top of existing input. The plugin acted like a word processor Insert mode. This has always agrivated me, so now the input shifts on input and backspace/delete. * Now calling .change() on blur if the value has changed since the plugin prevents the change event from being fired naturally. * Pasting incomplete test no longer wipes the input. Instead, the cursor is just placed where the input leaves off. * Fixed backspace detection for iPhone. Plugin is now iPhone compatible. * Fixed pasting bug when mask starts with a literal and caret position is on the literal character. I feel really good about this release. I made some changes that I feel are good for the direction of the plugin. Iif you don't like some of the changes please let me know and I'll look at adding them back in as options. I'm trying hard not to bloat things up, but I don't want to remove features that are needed. Merry Christmas! Josh digitalbush.com
[jQuery] Re: Help Test jQuery 1.3 Beta 1
will sure do right now, as i'm about to release another experiment-in-webdesign, end of january, and will need the best javascript library to support it. Thanks a lot ! On Mon, Dec 22, 2008 at 6:49 PM, John Resig jere...@gmail.com wrote: Hi Everyone - The jQuery dev team just got jQuery 1.3 Beta 1 out the door. Help us test this release and make sure it goes nice and smoothly! http://blog.jquery.com/2008/12/22/help-test-jquery-13-beta-1/ Thanks in advance. --John
[jQuery] [SITE] tunerec.com
just read about and tried this amazing online music player. snappy interface. Subscribe to the beta to check it out. Gets better after a few days but it is really promising and the interface is slick! http://tunerec.com/ alexandre
[jQuery] Re: Creating an OS Web Interface in jQuery (Part I)
As a matter of fact, just had a good read exactly on this topic at the ever excellent Coding Horror blog: http://www.codinghorror.com/blog/archives/000869.html On Wed, Dec 17, 2008 at 4:30 PM, Rick Faircloth r...@whitestonemedia.com wrote: Yes, keep up the good work. I don't of anyone whose coding can't be improved! We're all continuously learning. An OS Interface such as you're creating might be just the type of interface that could bridge the gap between typical desktop OS users and the new Cloud crowd. A familiar face on something new. Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Alexandre Plennevaux Sent: Wednesday, December 17, 2008 10:18 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Creating an OS Web Interface in jQuery (Part I) ... and we will continue to read and comment on them, Adrian! Thanks a lot for sharing ! On Wed, Dec 17, 2008 at 4:09 PM, AdrianMG yens...@gmail.com wrote: One more thing! Thanks you for your opinions I will try to improve my english and tutorials to give more info and better explanations to the readers. Bye! On Dec 17, 4:01 pm, AdrianMG yens...@gmail.com wrote: Hi guys, I don't understand some replies... I just want to say that the mistakes in english are because I am not good enough in english as I would like to be, not for writting tutorials fast or similar. And as I said in the tutorial, it's only the first part of a serie focused on creating a os web interface, just that hehe. On Dec 16, 11:57 pm, Rick Faircloth r...@whitestonemedia.com wrote: D'oh! :o) -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Michael Geary Sent: Tuesday, December 16, 2008 5:39 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Creating an OS Web Interface in jQuery (Part I) Never mind, you beat me to it! From: Michael Geary Excellent point, Rick. But I think there may be a little typo that changed the meaning to something other than what you intended? :-) From: Rick Faircloth No faster way to kill someone's enthusiasm than to simply tear something down without any encouragement. It's like I tell my kids... you can't applaud the effort if not the performance. And, if asked, give encouraging criticism.
[jQuery] Re: Creating an OS Web Interface in jQuery (Part I)
... and we will continue to read and comment on them, Adrian! Thanks a lot for sharing ! On Wed, Dec 17, 2008 at 4:09 PM, AdrianMG yens...@gmail.com wrote: One more thing! Thanks you for your opinions I will try to improve my english and tutorials to give more info and better explanations to the readers. Bye! On Dec 17, 4:01 pm, AdrianMG yens...@gmail.com wrote: Hi guys, I don't understand some replies... I just want to say that the mistakes in english are because I am not good enough in english as I would like to be, not for writting tutorials fast or similar. And as I said in the tutorial, it's only the first part of a serie focused on creating a os web interface, just that hehe. On Dec 16, 11:57 pm, Rick Faircloth r...@whitestonemedia.com wrote: D'oh! :o) -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Michael Geary Sent: Tuesday, December 16, 2008 5:39 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Creating an OS Web Interface in jQuery (Part I) Never mind, you beat me to it! From: Michael Geary Excellent point, Rick. But I think there may be a little typo that changed the meaning to something other than what you intended? :-) From: Rick Faircloth No faster way to kill someone's enthusiasm than to simply tear something down without any encouragement. It's like I tell my kids... you can't applaud the effort if not the performance. And, if asked, give encouraging criticism.
[jQuery] Re: jQuery and PHP form problem
especially with available tools like jsbin ! http://jsbin.com/ if the google group app would allow it, i would include an invitation to use it in my signature but that 's not possible or is it? On Tue, Dec 16, 2008 at 12:29 PM, Mike Alsup mal...@gmail.com wrote: I GOT IT. How to explain what the problem was?!...I've done a bit of tweaking, but one thing is I was returning false from my form submit handler WHICH IS WHY I WASN'T HITTING MY PHP $_POST BRANCH. Whenever I would submit I was getting my default search page again. Made the search field sticky (so it would use the last entry, not the default value!) and there might have been another thing. Ugh, I've really tweaked a lot of stuff this evening. For future reference, that would have been immediately obvious if you had posted the code.
[jQuery] Re: Creating an OS Web Interface in jQuery (Part I)
yup i must say i am also doubtful on the actual tutorial. I'm trying to be constructive so please don't take offense of my personal remark: This is more of a demo, it's not really explaining how to do it. For instance, a tutorial should explain the rationale of a web OS interface. AFAIK that's not such a popular choice for web apps. Not that it shouldn't be, but some argumentation on its potential (usability?) for end users would be good. Then deconstruct this OS interface into, indeed, drag 'n drop, start menu, desktop icons, and present the list of forthcoming tutorials. All this should wipe away any of the doubts i had while reading it. thanks liam for the effort, keep on improving it, but don't be afraid to describe/analyse a problem before jumping on its solution. best, alexandre On Tue, Dec 16, 2008 at 8:22 PM, donb falconwatc...@comcast.net wrote: I may seem a bit dense, but what's the objective here? And is 'OS' Operating System, Open Source, something else? Maybe Part 2 clears all this up, but some intro/background would help a lot. On Dec 16, 7:57 am, AdrianMG yens...@gmail.com wrote: Finally here you have the First Part of this series of tutorials to recreate an OS Web Interface with our lovely jQuery javascript library. Here you have the link guys, I hope you can use it for your personal projects: http://yensdesign.com/2008/12/creating-an-os-web-interface-in-jquery-...
[jQuery] Re: Creating an OS Web Interface in jQuery (Part I)
i meant AdrianMG, not Liam ! On Tue, Dec 16, 2008 at 8:43 PM, Alexandre Plennevaux aplennev...@gmail.com wrote: yup i must say i am also doubtful on the actual tutorial. I'm trying to be constructive so please don't take offense of my personal remark: This is more of a demo, it's not really explaining how to do it. For instance, a tutorial should explain the rationale of a web OS interface. AFAIK that's not such a popular choice for web apps. Not that it shouldn't be, but some argumentation on its potential (usability?) for end users would be good. Then deconstruct this OS interface into, indeed, drag 'n drop, start menu, desktop icons, and present the list of forthcoming tutorials. All this should wipe away any of the doubts i had while reading it. thanks liam for the effort, keep on improving it, but don't be afraid to describe/analyse a problem before jumping on its solution. best, alexandre On Tue, Dec 16, 2008 at 8:22 PM, donb falconwatc...@comcast.net wrote: I may seem a bit dense, but what's the objective here? And is 'OS' Operating System, Open Source, something else? Maybe Part 2 clears all this up, but some intro/background would help a lot. On Dec 16, 7:57 am, AdrianMG yens...@gmail.com wrote: Finally here you have the First Part of this series of tutorials to recreate an OS Web Interface with our lovely jQuery javascript library. Here you have the link guys, I hope you can use it for your personal projects: http://yensdesign.com/2008/12/creating-an-os-web-interface-in-jquery-...