[jQuery] Using Jquery Form and Block UI together
I have this function that triggers an AJAX call to the server $('#advert_settings_form').ajaxForm(function() { $.blockUI('h1img src=busy.gif / Just a moment.../h1'); //alert(Thank you for your comment!); }); Where do I put the blockUI and unblockUI functions in ajaxForm callable? Thanks
[jQuery] Changing a background image with .css() function
Hello ! I am trying to change the background image of a div when clicking on an element. This is my code : [...] $('#accordion').css('background-image', '/public/images/icons/slideDown.jpg'); alert($('#accordion').css('background-image')); [...] But the alert box will never show me the right url, it will only give me the initial url when the page was loaded, so the image is not changing. Can anyone help me with this ? Thank you for any help ! :-) -- View this message in context: http://www.nabble.com/Changing-a-background-image-with-.css%28%29-function-tf4665937s27240.html#a13328642 Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: jQuery Logging (to firebug)
yep, use typeof: (function($){ // block scope $.fn.log = function(msg){ if ( typeof window.console !== 'undefined' typeof console.firebug !== 'undefined'){ msg = msg || ''; if(msg !== '') msg += ': '; console.log(%s%o, msg, this); } return this; }; })(jQuery);
[jQuery] how to select this ?
I'm just starting out with jQuery and am already staring at a wall. The goal: attach a mouse event to all links in a paragraph with id 'para' and display the text of the link. this is what I've come up with, which obviously doesn't work: $(#para a).click(function(){ var linkContent = $(this).text; alert (linkContent); }); the click event works, and an alert pops up, but the content of the alert is a javascript function, written out in all its glory. I can't imagine I'm too far off here. Can anyone assist?
[jQuery] Re: how to select this ?
var linkContent = $(this).text(); $(this) returns a jQuery object, not a DOM element. On 10/21/07, photoboy [EMAIL PROTECTED] wrote: I'm just starting out with jQuery and am already staring at a wall. The goal: attach a mouse event to all links in a paragraph with id 'para' and display the text of the link. this is what I've come up with, which obviously doesn't work: $(#para a).click(function(){ var linkContent = $(this).text; alert (linkContent); }); the click event works, and an alert pops up, but the content of the alert is a javascript function, written out in all its glory. I can't imagine I'm too far off here. Can anyone assist?
[jQuery] Re: Changing a background image with .css() function
Ok, I found out thanks to the jquery IRC channel. It had to be url('/public/images/icons/slideDown.jpg') Thank you. debussy007 wrote: Hello ! I am trying to change the background image of a div when clicking on an element. This is my code : [...] $('#accordion').css('background-image', '/public/images/icons/slideDown.jpg'); alert($('#accordion').css('background-image')); [...] But the alert box will never show me the right url, it will only give me the initial url when the page was loaded, so the image is not changing. Can anyone help me with this ? Thank you for any help ! :-) -- View this message in context: http://www.nabble.com/Changing-a-background-image-with-.css%28%29-function-tf4665937s27240.html#a13328945 Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: how to select this ?
Wow Mike, thanks. I'm not sure why that worked, but it definitely did the trick! Much appreciated. On Oct 21, 3:01 pm, Mike Alsup [EMAIL PROTECTED] wrote: var linkContent = $(this).text(); $(this) returns a jQuery object, not a DOM element. On 10/21/07, photoboy [EMAIL PROTECTED] wrote: I'm just starting out with jQuery and am already staring at a wall. The goal: attach a mouse event to all links in a paragraph with id 'para' and display the text of the link. this is what I've come up with, which obviously doesn't work: $(#para a).click(function(){ var linkContent = $(this).text; alert (linkContent); }); the click event works, and an alert pops up, but the content of the alert is a javascript function, written out in all its glory. I can't imagine I'm too far off here. Can anyone assist?
[jQuery] slideUp/slideDown - Bug in IE with images
Hi, slideUp() slideDown() is not working well when there are images in IE. I made a sample page about this issue : http://matthew16.free.fr/temp/test.html Click on Click Here to animate (slideUp / slideDown). In Mozilla FF it is very smooth, but you will notice the difference in IE. Thank you for any workaround, any code ! -- View this message in context: http://www.nabble.com/slideUp-slideDown---Bug-in-IE-with-images-tf4666127s27240.html#a13329189 Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: jqModal ajax question
Dan Richman wrote: Is the onShow callback in place of the ajax parameter passed to .jqm ? Or something like this? onShow: function() { myUrl = document.foo.bar.value; }, ajax: 'myscript.cgi?q=' + myUrl , I really appreciate the help. I'm a perl guy trying to muddle my way thru. Dan, You bring up an interesting point. It would be convenient in this case to have onShow execute before the ajax load, however the current version of jqModal does not do this. onShow is executed just before the modal window becomes visible. It is intended as a way to add a fancy display effects (e.g. a fade-ins, animation, etc.) to the modal -- but also provides a general means to inject customized behavior (like a special ajax call). So in this case we'll include the ajax call in the callback and display the window. E.g. $(e).jqm({ onShow: function(hash) { myUrl = document.foo.bar.value; hash.w.load(myscript.cgi?q=' + myUrl); h.w.show(); }, ajax: false }); // notice we get rid of the ajax param, as a custom ajax routine is used in the onCallback. While the above works.. in your case it may not be the most convenient/ intuitive at first. I think I *may* add another callback to jqModal whenever I get around to writing new documentation and examples :) This callback would be named beforeLoad, and would be executed before the ajax call, allowing to override the ajax URL in the way you mentioned above (changing the value of a global just before the call). Another idea is to allow you to pass a function as the ajax param which returns the URL. e.g. $(e).jqm({ajax: function() { return document.foo.bar.value; }); In any case... better documentation must be written! :) Thanks, ~ Brice
[jQuery] Can the cycle plugin return an index?
Hey, gang - I've got the cycle plugin working, just great, it's a beautiful thing. However, I have a after callback that needs to get the index of the currently displayed slide. Basically, it's displaying %% of %%% (for those who've got an RPG-II background...). I need to show what number of the current total we're on. Any ideas or suggestions, or do I go back to the drawing board? Thanks! - Toby AIM: tobyParent [EMAIL PROTECTED]
[jQuery] Re: Can the cycle plugin return an index?
Never mind, I answered my own question. For those who may need to know, you can use the index() call, so long as you provide a context. For example: var myPlayerWindow = $(#my-player-window); myPlayerWindow.cycle({after: afterSwitch}); function afterSwitch(incoming, outgoing, options) { $.debug(myPlayerWindow.children().index(incoming) ); // or, in my case... $(#slide-position).html(myPlayerWindow.children().index(incoming)+1); } Hope this helps someone else down the line! -Toby AIM: tobyParent [EMAIL PROTECTED] ---BeginMessage--- Hey, gang - I've got the cycle plugin working, just great, it's a beautiful thing. However, I have a after callback that needs to get the index of the currently displayed slide. Basically, it's displaying %% of %%% (for those who've got an RPG-II background...). I need to show what number of the current total we're on. Any ideas or suggestions, or do I go back to the drawing board? Thanks! - Toby AIM: tobyParent [EMAIL PROTECTED] ---End Message---
[jQuery] Re: Getting window portal size in 1.2.1
Karl, Thanks much, rebuilding jquery from the latest SVN solved the window dimensions. The document.body height is still off, however. If you could take a look at this page again: http://www.scorpiontechnology.com/Cobalt/windowtest.htm The body width is correct - it matches the inside dimensions of the body (not including the scrollbar). However the body height still stays static at the full document height. Is this an easy fix? JK _ From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Karl Swedberg Sent: Friday, October 19, 2007 6:50 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Getting window portal size in 1.2.1 Hi Jeffrey, This was a known issue. Something to do with the migration of that piece of Dimensions into core. It's fixed in SVN now. --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com
[jQuery] Re: how to select this ?
On 21 Okt., 15:25, photoboy [EMAIL PROTECTED] wrote: Wow Mike, thanks. I'm not sure why that worked, but it definitely did the trick! Much appreciated. Because in your code you're assigning the text method of the jQuery object: $(this).text; That's why the content of the alert is a function. Note that you missed the parenthesis to actually call that function: $(this).text(); --Klaus
[jQuery] Re: how to select this ?
I see via other replies that the .text() instead of .text issue has been resolved, but maybe worth pointing out, too (though affecting your issue), is that you say you're looking for multiple p's with the same id. Each id should only be present once on a page. Instead, use a class and select by the class: p class=specialyadda/p p class=specialya/p $('.special a').click(functionetc) - Jack photoboy wrote: I'm just starting out with jQuery and am already staring at a wall. The goal: attach a mouse event to all links in a paragraph with id 'para' and display the text of the link. this is what I've come up with, which obviously doesn't work: $(#para a).click(function(){ var linkContent = $(this).text; alert (linkContent); }); the click event works, and an alert pops up, but the content of the alert is a javascript function, written out in all its glory. I can't imagine I'm too far off here. Can anyone assist?
[jQuery] Re: jQuery Logging (to firebug)
Why check for console.firebug if you really care about console.log though? $.fn.log = function(msg){ window.console window.console.log window.console.log(%s%s%o, msg||, msg?: :, this); return this; };
[jQuery] Re: slideUp/slideDown - Bug in IE with images
just a thought, probably better ways - but could you use the same css() to set 'background:none' at the same time you trigger the slideup? -- -- Michael Evangelista, Evangelista Design Web : www.mredesign.com Newsgroups: news://forums.mredesign.com Blog : www.miuaiga.com debussy007 [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, slideUp() slideDown() is not working well when there are images in IE. I made a sample page about this issue : http://matthew16.free.fr/temp/test.html Click on Click Here to animate (slideUp / slideDown). In Mozilla FF it is very smooth, but you will notice the difference in IE. Thank you for any workaround, any code ! -- View this message in context: http://www.nabble.com/slideUp-slideDown---Bug-in-IE-with-images-tf4666127s27240.html#a13329189 Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: jqModal ajax question
I brought this up back in May at this post: http://groups.google.com/group/jquery-en/browse_thread/thread/40137ddd2b5cfdcc/ Of which I end it with my workaround to the problem. However, I would love it if jqModal were updated to handle this without my workaround. On Oct 21, 7:26 am, Brice Burgess [EMAIL PROTECTED] wrote: Dan Richman wrote: Is the onShow callback in place of the ajax parameter passed to .jqm ? Or something like this? onShow: function() { myUrl = document.foo.bar.value; }, ajax: 'myscript.cgi?q=' + myUrl , I really appreciate the help. I'm a perl guy trying to muddle my way thru. Dan, You bring up an interesting point. It would be convenient in this case to have onShow execute before the ajax load, however the current version of jqModal does not do this. onShow is executed just before the modal window becomes visible. It is intended as a way to add a fancy display effects (e.g. a fade-ins, animation, etc.) to the modal -- but also provides a general means to inject customized behavior (like a special ajax call). So in this case we'll include the ajax call in the callback and display the window. E.g. $(e).jqm({ onShow: function(hash) { myUrl = document.foo.bar.value; hash.w.load(myscript.cgi?q=' + myUrl); h.w.show(); }, ajax: false}); // notice we get rid of the ajax param, as a custom ajax routine is used in the onCallback. While the above works.. in your case it may not be the most convenient/ intuitive at first. I think I *may* add another callback to jqModal whenever I get around to writing new documentation and examples :) This callback would be named beforeLoad, and would be executed before the ajax call, allowing to override the ajax URL in the way you mentioned above (changing the value of a global just before the call). Another idea is to allow you to pass a function as the ajax param which returns the URL. e.g. $(e).jqm({ajax: function() { return document.foo.bar.value; }); In any case... better documentation must be written! :) Thanks, ~ Brice
[jQuery] Re: g has no properties?
The hover method requires two arguments; an error will be thrown on blur if the second argument is omitted. The first argument is a function to be executed on mouseover, the second, a function to be executed on mouseout. By the looks of things, you do not require an action on mouseout, and if that's the case, I recommend you use the mouseover method - http://docs.jquery.com/Events/mouseover
[jQuery] Build plugins throws an error
All, is it just me or is the current plugin build file somewhat broken? Whenever I try to minify and pack a file I get the following error: js: uncaught JavaScript runtime exception: TypeError: Cannot read property 0.0 from null Java Result: 3 Does anybody know what is going on? --Klaus
[jQuery] $.get content refresh
Hi, i'm working on a song-ticker for a non-commercial radio station. Now the following code is supposed to call a script which reads the current song out of a database and displays it: script language=javascript function get_tracklist(){ $.get( http://www.toxic.fm/fileadmin/scripts/tracklist_player.php,function(data){ jQuery('#tracklist').html(data); }); } $(document).ready(function(){ setInterval(get_tracklist(),5000); }); /script (…) div id=tracklist/div Now in Firefox everything works fine. The current track is shown correctly and refreshes every 5 seconds. In IE7 though, the content displays a first time and then stays the same. Even when I refresh the window, the content stays the same. I know that the function gets called, but the content does not change. Have you any idea what's happening here? Help is very much appreciated. Best wishes Nicolas
[jQuery] Re: search through ajax object
... success : function(html){ $(html).find('#mydiv').appendTo('#content'); } ... On Oct 20, 11:43 pm, brobro [EMAIL PROTECTED] wrote: Hi, if I use $.ajax() to fetch a file. Would it be possible to search throught that file for a certain element and use that? like $.ajax({ url: getthis.html, success: function(html){ var mynewdiv = lookformydiv(#mydiv) in html //this is what i want to do $(#content).append(#mynewdiv); } it would a great help -- View this message in context:http://www.nabble.com/search-through-ajax-object-tf4664208s27240.html... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: how to select this ?
Jack, he actually says all links in a paragraph with id 'para', so using $('#para a') is perfectly correct. On Oct 21, 8:43 pm, Jack Killpatrick [EMAIL PROTECTED] wrote: I see via other replies that the .text() instead of .text issue has been resolved, but maybe worth pointing out, too (though affecting your issue), is that you say you're looking for multiple p's with the same id. Each id should only be present once on a page. Instead, use a class and select by the class: p class=specialyadda/p p class=specialya/p $('.special a').click(functionetc) - Jack photoboy wrote: I'm just starting out with jQuery and am already staring at a wall. The goal: attach a mouse event to all links in a paragraph with id 'para' and display the text of the link. this is what I've come up with, which obviously doesn't work: $(#para a).click(function(){ var linkContent = $(this).text; alert (linkContent); }); the click event works, and an alert pops up, but the content of the alert is a javascript function, written out in all its glory. I can't imagine I'm too far off here. Can anyone assist?
[jQuery] Re: slideUp/slideDown - Bug in IE with images
Remove 'position:relative;' from your #headerphoto css. On Oct 21, 10:05 pm, MichaelEvangelista [EMAIL PROTECTED] wrote: just a thought, probably better ways - but could you use the same css() to set 'background:none' at the same time you trigger the slideup? -- -- Michael Evangelista, Evangelista Design Web :www.mredesign.com Newsgroups: news://forums.mredesign.com Blog :www.miuaiga.com debussy007 [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, slideUp() slideDown() is not working well when there are images in IE. I made a sample page about this issue : http://matthew16.free.fr/temp/test.html Click on Click Here to animate (slideUp / slideDown). In Mozilla FF it is very smooth, but you will notice the difference in IE. Thank you for any workaround, any code ! -- View this message in context: http://www.nabble.com/slideUp-slideDown---Bug-in-IE-with-images-tf466... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: how to select this ?
Hi. I meant to recommend against using the same id for more than one DOM node. I know the selector will work and that dup id's usually don't cause any new headaches, but I've also debugged pages where someone has used the same id more than once for different things, leading to unexpected behavior/errors in js scripts trying to manipulate those nodes. Just some feedback - Jack Wizzud wrote: Jack, he actually says all links in a paragraph with id 'para', so using $('#para a') is perfectly correct. On Oct 21, 8:43 pm, Jack Killpatrick [EMAIL PROTECTED] wrote: I see via other replies that the .text() instead of .text issue has been resolved, but maybe worth pointing out, too (though affecting your issue), is that you say you're looking for multiple p's with the same id. Each id should only be present once on a page. Instead, use a class and select by the class: p class=specialyadda/p p class=specialya/p $('.special a').click(functionetc) - Jack photoboy wrote: I'm just starting out with jQuery and am already staring at a wall. The goal: attach a mouse event to all links in a paragraph with id 'para' and display the text of the link. this is what I've come up with, which obviously doesn't work: $(#para a).click(function(){ var linkContent = $(this).text; alert (linkContent); }); the click event works, and an alert pops up, but the content of the alert is a javascript function, written out in all its glory. I can't imagine I'm too far off here. Can anyone assist?
[jQuery] Re: Sorting links alphabetically with jQuery
Sorry to bump (and for the double post), but I was really hoping to get this working. I'm trying to sort links alphabetically by their text content. I'd really like to be able to hold on to the jQuery object element reference after sorting the links. Can anyone give me a hand? Cheers. On Oct 19, 2:28 am, Yansky [EMAIL PROTECTED] wrote: Hi, I'm having some problems figuring out how to sort links alphabetically based on their text content and store the reference to the link. I can do it sans jQuery, but I'd really like to be able to use jQuery to do it. This is what I want to do: div id=test a href=http://yahoo.com;Yahoo/a a href=http://google.com;Google/a a href=http://aol.com;Aol/a /div function sortText(a, b) { if ( a.text b.text ) return -1; else if ( a.text b.text ) return 1; return 0;} var meh=[]; var getT = document.getElementById('test'); var getas = getT.getElementsByTagName( 'a' ); for(var i=0;i getas.length; i++){ meh[i]={ text: getas[ i ].textContent, el: getas[ i ] }; } var sortedLinks = meh.sort( sortText ); getT.innerHTML = ''; for(var l=0;l sortedLinks.length; l++){ getT.appendChild(sortedLinks[l].el); } I've tried: function sortText(a, b) { if ( a.text b.text ) return -1; else if ( a.text b.text ) return 1; return 0;} var meh=[]; $('#test a').each(function(){ meh[i] = { text: $(this).text(), el: $(this) }; }); var sortedLinks = meh.sort( sortText ); $(sortedLinks).each(function(l){ $('#test).append([l].el); }); ...but that doesn't seem to work. I've also tried using $.map, but I couldn't figure it out.
[jQuery] Re: how to select this ?
ahhhI see that I left a word out here...ooof: (though affecting your issue) I meant to say though *not* affecting your issue. Nine lashes with a wet noodle. - Jack Jack Killpatrick wrote: Hi. I meant to recommend against using the same id for more than one DOM node. I know the selector will work and that dup id's usually don't cause any new headaches, but I've also debugged pages where someone has used the same id more than once for different things, leading to unexpected behavior/errors in js scripts trying to manipulate those nodes. Just some feedback - Jack Wizzud wrote: Jack, he actually says all links in a paragraph with id 'para', so using $('#para a') is perfectly correct. On Oct 21, 8:43 pm, Jack Killpatrick [EMAIL PROTECTED] wrote: I see via other replies that the .text() instead of .text issue has been resolved, but maybe worth pointing out, too (though affecting your issue), is that you say you're looking for multiple p's with the same id. Each id should only be present once on a page. Instead, use a class and select by the class: p class=specialyadda/p p class=specialya/p $('.special a').click(functionetc) - Jack photoboy wrote: I'm just starting out with jQuery and am already staring at a wall. The goal: attach a mouse event to all links in a paragraph with id 'para' and display the text of the link. this is what I've come up with, which obviously doesn't work: $(#para a).click(function(){ var linkContent = $(this).text; alert (linkContent); }); the click event works, and an alert pops up, but the content of the alert is a javascript function, written out in all its glory. I can't imagine I'm too far off here. Can anyone assist?
[jQuery] Re: Getting window portal size in 1.2.1
Hi Jeffrey, I took a look at your page, and the only thing that is off for me (in FF 2.0.x Mac) is the $(document).width() and $('body').width() -- and that's because of a bug in FF that had a hack in Dimensions to work around it, which didn't go into core because it was too hackish. Shouldn't the $('body').width() and $('body').height() values be the same as the $(document).width() and $(document).height() values? I guess I assumed that $('body') and $(document) height and width should be equivalent, measuring the entire document's dimensions (the part that is within the body tags) including any part that is out of view -- as opposed to $(window) dimensions, which should only return values for the viewable area. But maybe I'm misunderstanding something? --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Oct 21, 2007, at 1:02 PM, Jeffrey Kretz wrote: Karl, Thanks much, rebuilding jquery from the latest SVN solved the window dimensions. The document.body height is still off, however. If you could take a look at this page again: http://www.scorpiontechnology.com/Cobalt/windowtest.htm The body width is correct – it matches the inside dimensions of the body (not including the scrollbar). However the body height still stays static at the full document height. Is this an easy fix? JK From: jquery-en@googlegroups.com [mailto:jquery- [EMAIL PROTECTED] On Behalf Of Karl Swedberg Sent: Friday, October 19, 2007 6:50 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Getting window portal size in 1.2.1 Hi Jeffrey, This was a known issue. Something to do with the migration of that piece of Dimensions into core. It's fixed in SVN now. --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com
[jQuery] Gotcha in the ajax call
When making a GET call via jQuery.ajax, jQuery 1.2.1 adds a URL parameter named '_' (the single underscore character) whose value is the current time stamp. I'm not sure I understand why, and in any case, this caused me some grief when I tried to use it in a Facebook app. The reason is that the Facebook API requires a signature parameter as part of each request, and this parameter is basically the MD5 hash of the rest of the parameters. So the extraneous jQuery parameter was not being accounted for in my code, causing Facebook to complain about an incorrect signature. Perhaps someone can explain the need for this parameter. And perhaps it can be made optional in a future release? Just my $0.02. Regards.
[jQuery] Re: Gotcha in the ajax call
That parameter is added when you set the 'cache' property to false. Are you doing that? --Erik On 10/21/07, M. A. Sridhar [EMAIL PROTECTED] wrote: When making a GET call via jQuery.ajax, jQuery 1.2.1 adds a URL parameter named '_' (the single underscore character) whose value is the current time stamp. I'm not sure I understand why, and in any case, this caused me some grief when I tried to use it in a Facebook app. The reason is that the Facebook API requires a signature parameter as part of each request, and this parameter is basically the MD5 hash of the rest of the parameters. So the extraneous jQuery parameter was not being accounted for in my code, causing Facebook to complain about an incorrect signature. Perhaps someone can explain the need for this parameter. And perhaps it can be made optional in a future release? Just my $0.02. Regards.