[jQuery] Re: jquery and math functions
On Feb 22, 7:03 am, Shawn [EMAIL PROTECTED] wrote: var startmin = parseInt( $(timestartmin).text() ); var stopmin = parseInt( $(timestopmin).text() ); //check to make sure you didn't get a NaN if (!startmin) startmin = 0; if (!stopmin) stopmin = 0; The second part where the sanity check is being applied may not be applicable in your case. A bit shorter: var startmin = parseInt( $(timestartmin).text() ) || 0; var stopmin = parseInt( $(timestopmin).text() ) || 0; --Klaus
[jQuery] Re: Div Changer Using Hide And Show
On 21 Feb, 23:03, Sientz [EMAIL PROTECTED] wrote: $('a#blackbook').click(function() { //HIDE DIVS hide_divs(); //SHOW LISTED DIV $('.blackbook').show('fast'); return false; }); you see you got all these functions that basically do the same thing. if an anchor has an id, they show the corresponding div I think you could do it like this $('a[id]').click(function(){ hide_divs(); var x = $(this).attr('id'); $('div[class= + x + ]').show('fast'); return false; }); and should do the same thing. but you could go further, and use classes in a different way. let's say that instead of calling them divs with 'human' names, we can use more 'efficient' names, like: hs_a hs_b hs_c hs_d ... where hs stands for hide/show (just an example). in this way the function hide_divs becomes something like var hide_divs = function(){ $('div[class^=hs]').hide('fast'); /* this selector looks for the div(s) that have a classname that starts with the string 'hs' */ }; then you give corresponding id's to the anchors, so the other on I wrote before: $('a[id^=hs]').click(function(){ hide_divs(); var x = $(this).attr('id'); $('div[class= + x + ]').show('fast'); return false; });
[jQuery] Re: Break out of a for loop.
I think you're having trouble with a closure. It's a common problem and I recently got help on it myself. JavaScript looks like C, but it's not C (or Java). You'll probably keep running into this kind of thing until you understand closures, so go ahead and search for javascript closure on google. You're setting up handlers that get clicked in the future. By the time they are clicked, the loop is done and i is where it left off. Once you understand closures and anonymous functions, you'll be able to fix that. I'm hesitant to rewrite your code, because I don't want to give you something I haven't tested, but here's a similar problem and solution. Might help you out. Try them both and see what they do. 1. var i; for (i= for (i=0;i5;i++) { setTimeout(function() {alert('first '+i);},5000); } 2. for (i=0;i5;i++) { (function(num) { setTimeout(function() {alert('second '+num);}, 5000); })(i); } On Feb 21, 4:04 pm, Alex [EMAIL PROTECTED] wrote: Hi, I am this script: for (var i=0; i 6; i++) { $('a#chan'+i).click(function(){ for (var j=0; j6; j++) { $('a#chan'+j).removeClass(chSel); } $(this).addClass (chSel); channel = i; }); } and I'm trying to get the value of i when the link is clicked and store it in the variable channel. But when I do it, it stores 6 (the max number) in it. I tried using continue; I tried using i = 7 (to break the loop, it works in Java, I guess not in Javascript). I really have no ideas. Anyone can help me real quick with that? Thanks.
[jQuery] Menu animations problem
Hi all ! I am trying to create a menu like this on the front of mootools.net (although in vertical way). My old code is based on something I've seen around interface together with a limitQueue hack - http://svest.org/temp/test/old/home.html (it uses jQuery 1.1.x). However that doesn't work with jQuery 1.2.x Now I am trying to replace the limitQueue with the new Jquery 1.2 additions - queue() and stop(), but I think I don't fully understand the way they work: http://svest.org/temp/test/new/home.html (latest jQuery) On initial load everything looks almost fine. If I go through the menus slowly everything works fine. However when I go fast through the menus the bottom part of the menu disapears. I looked the whole thing with Firebug and it seems that when I go over a menu, it gets a overflow: hidden style. When I go slowly over it the style appears only for a second, but when I go fast the style stays. Why doesn't the style be removed ? :) P.S. The 1.1.x version of jquery doesn't seem to have that kind of problem, or maybe I am doing something wrong. I am a little confused with the animations. I really like to achieve the smoothness of the mootools implementation. Anyone can help ? -- Best regards, Stoyan mailto:[EMAIL PROTECTED]
[jQuery] Re: JQuery site is blank for one user
On Feb 22, 6:49 am, Andrew Ayres [EMAIL PROTECTED] wrote: Hi all, I've built a JQuery website,www.constitreaty.com, and tested it successfuly on Win XP Pro and Vista with IE6, IE7, Firefox 2 and Opera 9.25, as well as Mac OSX 10.4.8 with Firefox 2. Try it in Safari, it looks dreadful. For hints on HTML or CSS authoring, try an appropriate group: comp.infosystems.www.authoring.html URL: http://groups.google.com/group/comp.infosystems.www.authoring.html?hl=enlnk=li omp.infosystems.www.authoring.stylesheets URL: http://groups.google.com/group/comp.infosystems.www.authoring.stylesheets?hl=enlnk=li -- Rob
[jQuery] Re: Selecting the ancestor of an element
I'm not sure I understand what you're trying to get at. If you have an element (childObj), it has only one parent, $(childObj).parent(). Perhaps you want to provide some more context if I'm not getting it? - Richard On Thu, Feb 21, 2008 at 3:48 PM, AsymF [EMAIL PROTECTED] wrote: How would I select the parent that ONLY has that child? For instance, the following selects too many parents: $($(childObj).parent().get(0).tagName + ':has(#' + childObj.id + ')') On Feb 21, 2:25 pm, Richard D. Worth [EMAIL PROTECTED] wrote: See http://docs.jquery.com/Traversing/parent#expr http://docs.jquery.com/Traversing/parents#expr - Richard On Thu, Feb 21, 2008 at 12:33 PM, AsymF [EMAIL PROTECTED] wrote: How would I select the ancestor or parent of an element?
[jQuery] jqmodal nested ajax
Hi, Is it possible?? the plugin page doesn't have an example of this...Or is it at least possible to replace the current modal content with another ajax content in the opened modal (only one modal...not nested)...How? Thanks! BR
[jQuery] Re: Menu animations problem
You could try the accordion plugin. Ariel Flesler On 22 feb, 07:07, Stoyan [EMAIL PROTECTED] wrote: Hi all ! I am trying to create a menu like this on the front of mootools.net (although in vertical way). My old code is based on something I've seen around interface together with a limitQueue hack - http://svest.org/temp/test/old/home.html (it uses jQuery 1.1.x). However that doesn't work with jQuery 1.2.x Now I am trying to replace the limitQueue with the new Jquery 1.2 additions - queue() and stop(), but I think I don't fully understand the way they work: http://svest.org/temp/test/new/home.html (latest jQuery) On initial load everything looks almost fine. If I go through the menus slowly everything works fine. However when I go fast through the menus the bottom part of the menu disapears. I looked the whole thing with Firebug and it seems that when I go over a menu, it gets a overflow: hidden style. When I go slowly over it the style appears only for a second, but when I go fast the style stays. Why doesn't the style be removed ? :) P.S. The 1.1.x version of jquery doesn't seem to have that kind of problem, or maybe I am doing something wrong. I am a little confused with the animations. I really like to achieve the smoothness of the mootools implementation. Anyone can help ? -- Best regards, Stoyan mailto:[EMAIL PROTECTED]
[jQuery] Re: Menu animations problem
Hello Ariel, I am pretty sure, you cannot achieve the desired functionality with the accordeon plugin. Just take a look at the demos and at the source code that runs them. Friday, February 22, 2008, 2:56:40 PM, you wrote: You could try the accordion plugin. Ariel Flesler | On 22 feb, 07:07, Stoyan [EMAIL PROTECTED] wrote: Hi all ! I am trying to create a menu like this on the front of mootools.net (although in vertical way). My old code is based on something I've seen around interface together with a limitQueue hack - http://svest.org/temp/test/old/home.html (it uses jQuery 1.1.x). However that doesn't work with jQuery 1.2.x Now I am trying to replace the limitQueue with the new Jquery 1.2 additions - queue() and stop(), but I think I don't fully understand the way they work: http://svest.org/temp/test/new/home.html (latest jQuery) On initial load everything looks almost fine. If I go through the menus slowly everything works fine. However when I go fast through the menus the bottom part of the menu disapears. I looked the whole thing with Firebug and it seems that when I go over a menu, it gets a overflow: hidden style. When I go slowly over it the style appears only for a second, but when I go fast the style stays. Why doesn't the style be removed ? :) P.S. The 1.1.x version of jquery doesn't seem to have that kind of problem, or maybe I am doing something wrong. I am a little confused with the animations. I really like to achieve the smoothness of the mootools implementation. Anyone can help ? -- Best regards, Stoyan mailto:[EMAIL PROTECTED]
[jQuery] Re: Menu animations problem
I checked in IE6, and the bottom label always gets covered like 80%, it doesn't depend on the speed of hovering. Maybe it's just an math error ? like, in your height calculations. With jQuery 1.2.3 you can change those .queue('fx',[]) for .queue([]). It will fail with jQuery 1.2.1 though. Ariel Flesler On 22 feb, 10:09, Stoyan [EMAIL PROTECTED] wrote: Hello Ariel, I am pretty sure, you cannot achieve the desired functionality with the accordeon plugin. Just take a look at the demos and at the source code that runs them. Friday, February 22, 2008, 2:56:40 PM, you wrote: You could try the accordion plugin. Ariel Flesler | On 22 feb, 07:07, Stoyan [EMAIL PROTECTED] wrote: Hi all ! I am trying to create a menu like this on the front of mootools.net (although in vertical way). My old code is based on something I've seen around interface together with a limitQueue hack - http://svest.org/temp/test/old/home.html (it uses jQuery 1.1.x). However that doesn't work with jQuery 1.2.x Now I am trying to replace the limitQueue with the new Jquery 1.2 additions - queue() and stop(), but I think I don't fully understand the way they work: http://svest.org/temp/test/new/home.html (latest jQuery) On initial load everything looks almost fine. If I go through the menus slowly everything works fine. However when I go fast through the menus the bottom part of the menu disapears. I looked the whole thing with Firebug and it seems that when I go over a menu, it gets a overflow: hidden style. When I go slowly over it the style appears only for a second, but when I go fast the style stays. Why doesn't the style be removed ? :) P.S. The 1.1.x version of jquery doesn't seem to have that kind of problem, or maybe I am doing something wrong. I am a little confused with the animations. I really like to achieve the smoothness of the mootools implementation. Anyone can help ? -- Best regards, Stoyan mailto:[EMAIL PROTECTED]
[jQuery] Re: random tab and simple content switching
I worked a little longer and in case anyone has been watching trying to work out what I was on about... Here's my final code. I don't thinks it's very clean, and I'm sure there are easier ways of doing this, ways that don't require me to name the ids, etc., but I'm not familiar with the intricate workings of math functions. Heck I'm proud I got this far. $(document).ready(function() { var ids = [ 'latestArticle', 'inTheMag' ]; var index = Math.round( Math.random()*10 ) % 2; var id = ids[ index ]; $('#mainArticle #' + id + ' .teaser').hide(); $('#mainArticle #' + id + ' h1 span').addClass(hidden); $('#mainArticle div h1').click(function(){ var place = $(this).parent().attr(id); $('#mainArticle h1 span').addClass(hidden); $('#' + place + ' h1 span').removeClass(hidden); $('#mainArticle .teaser').hide(); $('#' + place + ' .teaser').slideDown('slow'); }); }); On Feb 21, 6:32 pm, sperks [EMAIL PROTECTED] wrote: update: I'm still looking for the random side of things, but I've got a solution for the switching. However, I'm a little concerned that I'm targeting h1 rather than the span (how do I go back two parents?) $(document).ready(function() { $('#mainArticle #latestArticle .teaser').hide(); $('#mainArticle #latestArticle h1 span').addClass(hidden); $('#mainArticle div h1').click(function(){ var place = $(this).parent().attr(id); $('#mainArticle h1 span').addClass(hidden); $('#' + place + ' h1 span').removeClass(hidden); $('#mainArticle .teaser').hide(); $('#' + place + ' .teaser').slideDown('slow'); }); });
[jQuery] Re: Menu animations problem
Hello Ariel, The calculations are ok. It works on the old example, but only with jquery 1.1.x and ugly limit hack, found somewhere in the forums. I am not very much into the animation stuff to fix it myself, so with ".queue([]) .stop() .animate(... " I am acting a little blindly. My problem is only with the animation and this limit/stop stuff (I think). I'll try to be more descriptive for the test case: 1. openhttp://svest.org/temp/test/new/home.htmlwithout "mouseovering" the menu. 2. without touching any other menu, mouse slowly over the "AUTO, MOTO" label. Pay attention to the bottom part of the menu - the "wrinkled paper" effect 3. Now mouse over quickly over many menu labels and open the "AUTO, MOTO" or any other menu - the "effective" bottom part has dissapeared ! Why ? - Because when "mouseovering" quickly the menu gets overflow: hidden permanently. Why ? - I don't know. Friday, February 22, 2008, 3:21:41 PM, Ariel Flesher wrote: I checked in IE6, and the bottom label always gets covered like 80%, it doesn't depend on the speed of hovering. Maybe it's just an math error ? like, in your height calculations. With jQuery 1.2.3 you can change those .queue('fx',[]) for .queue([]). It will fail with jQuery 1.2.1 though. Ariel Flesler On 22 feb, 10:09, Stoyan [EMAIL PROTECTED] wrote: Hello Ariel, I am pretty sure, you cannot achieve the desired functionality with the accordeon plugin. Just take a look at the demos and at the source code that runs them. Friday, February 22, 2008, 2:56:40 PM, Ariel Flesler wrote: You could try the accordion plugin. Ariel Flesler | On 22 feb, 07:07, Stoyan [EMAIL PROTECTED] wrote: Hi all ! I am trying to create a menu like this on the front of mootools.net (although in vertical way). My old code is based on something I've seen around interface together with a limitQueue hack - http://svest.org/temp/test/old/home.html (it uses jQuery 1.1.x). However that doesn't work with jQuery 1.2.x Now I am trying to replace the limitQueue with the new Jquery 1.2 additions - queue() and stop(), but I think I don't fully understand the way they work: http://svest.org/temp/test/new/home.html (latest jQuery) On initial load everything looks almost fine. If I go through the menus slowly everything works fine. However when I go fast through the menus the bottom part of the menu disapears. I looked the whole thing with Firebug and it seems that when I go over a menu, it gets a overflow: hidden style. When I go slowly over it the style appears only for a second, but when I go fast the style stays. Why doesn't the style be removed ? :) P.S. The 1.1.x version of jquery doesn't seem to have that kind of problem, or maybe I am doing something wrong. I am a little confused with the animations. I really like to achieve the smoothness of the mootools implementation. Anyone can help ? -- Best regards, Stoyan mailto:[EMAIL PROTECTED]
[jQuery] Re: Menu animations problem
Hello Ariel, The calculations are ok. It works on the old example, but only with jquery 1.1.x and ugly limit hack, found somewhere in the forums. I am not very much into the animation stuff to fix it myself, so with ".queue([]) .stop() .animate(... " I am acting a little blindly. My problem is only with the animation and this limit/stop stuff (I think). I'll try to be more descriptive for the test case: 1. openhttp://svest.org/temp/test/new/home.htmlwithout "mouseovering" the menu. 2. without touching any other menu, mouse slowly over the "AUTO, MOTO" label. Pay attention to the bottom part of the menu - the "wrinkled paper" effect 3. Now mouse over quickly over many menu labels and open the "AUTO, MOTO" or any other menu - the "effective" bottom part has dissapeared ! Why ? - Because when "mouseovering" quickly the menu gets overflow: hidden permanently. Why ? - I don't know. Friday, February 22, 2008, 3:21:41 PM, Ariel Flesher wrote: I checked in IE6, and the bottom label always gets covered like 80%, it doesn't depend on the speed of hovering. Maybe it's just an math error ? like, in your height calculations. With jQuery 1.2.3 you can change those .queue('fx',[]) for .queue([]). It will fail with jQuery 1.2.1 though. Ariel Flesler On 22 feb, 10:09, Stoyan [EMAIL PROTECTED] wrote: Hello Ariel, I am pretty sure, you cannot achieve the desired functionality with the accordeon plugin. Just take a look at the demos and at the source code that runs them. Friday, February 22, 2008, 2:56:40 PM, Ariel Flesler wrote: You could try the accordion plugin. Ariel Flesler | On 22 feb, 07:07, Stoyan [EMAIL PROTECTED] wrote: Hi all ! I am trying to create a menu like this on the front of mootools.net (although in vertical way). My old code is based on something I've seen around interface together with a limitQueue hack - http://svest.org/temp/test/old/home.html (it uses jQuery 1.1.x). However that doesn't work with jQuery 1.2.x Now I am trying to replace the limitQueue with the new Jquery 1.2 additions - queue() and stop(), but I think I don't fully understand the way they work: http://svest.org/temp/test/new/home.html (latest jQuery) On initial load everything looks almost fine. If I go through the menus slowly everything works fine. However when I go fast through the menus the bottom part of the menu disapears. I looked the whole thing with Firebug and it seems that when I go over a menu, it gets a overflow: hidden style. When I go slowly over it the style appears only for a second, but when I go fast the style stays. Why doesn't the style be removed ? :) P.S. The 1.1.x version of jquery doesn't seem to have that kind of problem, or maybe I am doing something wrong. I am a little confused with the animations. I really like to achieve the smoothness of the mootools implementation. Anyone can help ? -- Best regards, Stoyan mailto:[EMAIL PROTECTED]
[jQuery] jqModal using jqmShow instead of trigger gives problems
Hi I use the following function to open modal windows by passing the correspondingly ID html url . function jqmWindow(div_id , page){ $('div_id).jqm({ //trigger: '#edit', ajax: page, target: false, modal: true, /* FORCE FOCUS */ onHide: function(h) { h.o.remove(); // remove overlay h.w.fadeOut(444); // hide window }, overlay: 10 }).jqmShow(); } I use .jqmShow to open the window instead of the trigger which I have commented out. The modal window opens and then I close it again by clicking a button with class='jqmClose' associated to it. If I try to open the same modal window a second time it fails to work and I get this error from firebug. H[this._jqm] has no properties jquery.jqModal.js (line 34) $.fn.jqmShow=function(t){return this.each(function(){if(! H[this._jqm].a)$.jqm.open(this._jqm,t)});}; What am I doing wrong? I am using version * $Version: 2007.08.17 +r11 Cheers Tom
[jQuery] Media Plugin Issue
I'm trying to use the Media Plugin as it appears to be a gift from god in the way it handles multiple media types with the same code. Unfortunately, I've got two problems: 1) I can't get it to acknowledge my custom flash video player. When I do something like: $(.mediabox).mediabox({ flvPlayer : http://www.foobar.com/fooplayer.swf }); and then click on a link, say: a class=mediabox href=http://www.foobar.com/media/bar.flv;Watch Now!/a Firebug tells me I've requested the following URL: mediaplayer.swf?file=http://www.foobar.com/media/bar.flv 2) I can't get it to acknowledge my custom flashvars, which are unique for each video. I've tried using both the metadata plugin: a class=mediabox {flashvars:{playlist_url:'http://www.foobar.com/playlist?id=1234'}} href=http://www.foobar.com/media/1234.flv;Watch Now!/a and the pre-render callback: $(.mediabox).mediabox({...}, function(e,o){ o.flashvars = { playback_url: http://www.foobar.com/playlist?id=1234; }; }); Using Firebug and looking at the HTML that was generated, I see the following: embed ... flashvars=file=http://www.foobar.com/media/1234.flv; ... / So, what am I doing wrong? - jake
[jQuery] Re: Tool tip advice
Are you asking for a plugin recommendation? If so, I know the tooltip plugin (http://plugins.jquery.com/project/tooltip) detects the browser border and avoids it. On Feb 21, 3:08 pm, Mark [EMAIL PROTECTED] wrote: Hey all, the design team here has a grid/table layout, with each image in a cell causing a tooltip style popup. Ok so, no worried so far, BUT, for the last column, the tool tip flips it's orientation so it doesn't display over the page border. So image a 2x4 table, which images in each cell. Each image will have the mouse over event to trigger the tooltip. The tool tip itself has graphical borders with live text, just to make things easier. I'm going to make the assumption that the tooltip doesn't float, or folow the mouse, but rather it's in a fixed position, which is relevent to the cell that has the image. Any recommendations?
[jQuery] Re: jqmodal nested ajax
Check out section 3 [ AJAX RELATED ] of the documentation at http://dev.iceburg.net/jquery/jqModal/README A Nested Modal demo can be found here http://dev.iceburg.net/jquery/jqModal/ I have never used it myself but I assume that you can just add ajax as a parameter to the second nested jqm call? Or have I taken you up wrong? Tom On Feb 22, 1:07 pm, rayfidelity [EMAIL PROTECTED] wrote: Hi, Is it possible?? the plugin page doesn't have an example of this...Or is it at least possible to replace the current modal content with another ajax content in the opened modal (only one modal...not nested)...How? Thanks! BR
[jQuery] Re: jqModal using jqmShow instead of trigger gives problems
Well I seem to have been able to fix this. Still now 100% sure what the problem was though! I originally had some header footer info in the html page to be ajaxed into the modal window. I had it set up this way as I ahd hope dto allow uses with JS disabled to redirect to the page when the Modal version failed. I removed this as I was doing some code clean up and now my problem is fixed. I assume that some of that code was causing interference on the second display. Has anyone any nuggets of knowledge they can share about this behaviour? Cheers Tom On Feb 22, 3:37 pm, Tom [EMAIL PROTECTED] wrote: Hi I use the following function to open modal windows by passing the correspondingly ID html url . function jqmWindow(div_id , page){ $('div_id).jqm({ //trigger: '#edit', ajax: page, target: false, modal: true, /* FORCE FOCUS */ onHide: function(h) { h.o.remove(); // remove overlay h.w.fadeOut(444); // hide window }, overlay: 10 }).jqmShow(); } I use .jqmShow to open the window instead of the trigger which I have commented out. The modal window opens and then I close it again by clicking a button with class='jqmClose' associated to it. If I try to open the same modal window a second time it fails to work and I get this error from firebug. H[this._jqm] has no properties jquery.jqModal.js (line 34) $.fn.jqmShow=function(t){return this.each(function(){if(! H[this._jqm].a)$.jqm.open(this._jqm,t)});}; What am I doing wrong? I am using version * $Version: 2007.08.17 +r11 Cheers Tom
[jQuery] Re: Menu animations problem
Yes I see, I dunno what happens :( Ariel Flesler On 22 feb, 11:57, Stoyan [EMAIL PROTECTED] wrote: Hello Ariel, The calculations are ok. It works on the old example, but only with jquery 1.1.x and ugly limit hack, found somewhere in the forums. I am not very much into the animation stuff to fix it myself, so with .queue([]) .stop() .animate(... I am acting a little blindly. My problem is only with the animation and this limit/stop stuff (I think). I'll try to be more descriptive for the test case: 1. open http://svest.org/temp/test/new/home.html without mouseovering the menu. 2. without touching any other menu, mouse slowly over the AUTO, MOTO label. Pay attention to the bottom part of the menu - the wrinkled paper effect 3. Now mouse over quickly over many menu labels and open the AUTO, MOTO or any other menu - the effective bottom part has dissapeared ! Why ? - Because when mouseovering quickly the menu gets overflow: hidden permanently. Why ? - I don't know. Friday, February 22, 2008, 3:21:41 PM, Ariel Flesher wrote: I checked in IE6, and the bottom label always gets covered like 80%, it doesn't depend on the speed of hovering. Maybe it's just an math error ? like, in your height calculations. With jQuery 1.2.3 you can change those .queue('fx',[]) for .queue([]). It will fail with jQuery 1.2.1 though. Ariel Flesler On 22 feb, 10:09, Stoyan [EMAIL PROTECTED] wrote: Hello Ariel, I am pretty sure, you cannot achieve the desired functionality with the accordeon plugin. Just take a look at the demos and at the source code that runs them. Friday, February 22, 2008, 2:56:40 PM, Ariel Flesler wrote: You could try the accordion plugin. Ariel Flesler | On 22 feb, 07:07, Stoyan [EMAIL PROTECTED] wrote: Hi all ! I am trying to create a menu like this on the front of mootools.net (although in vertical way). My old code is based on something I've seen around interface together with a limitQueue hack - http://svest.org/temp/test/old/home.html (it uses jQuery 1.1.x). However that doesn't work with jQuery 1.2.x Now I am trying to replace the limitQueue with the new Jquery 1.2 additions - queue() and stop(), but I think I don't fully understand the way they work: http://svest.org/temp/test/new/home.html (latest jQuery) On initial load everything looks almost fine. If I go through the menus slowly everything works fine. However when I go fast through the menus the bottom part of the menu disapears. I looked the whole thing with Firebug and it seems that when I go over a menu, it gets a overflow: hidden style. When I go slowly over it the style appears only for a second, but when I go fast the style stays. Why doesn't the style be removed ? :) P.S. The 1.1.x version of jquery doesn't seem to have that kind of problem, or maybe I am doing something wrong. I am a little confused with the animations. I really like to achieve the smoothness of the mootools implementation. Anyone can help ? -- Best regards, Stoyan mailto:[EMAIL PROTECTED]
[jQuery] Re: jquery and math functions
Vlad, Is there something special that needs to be done to values selected with jQuery so math functions can work on them? parseInt or something? I am not sure, but all my calculations are getting NaN. For example, I have the following function that always produces NaN: var startmin = $(#timestartmin); var stopmin = $(#timestopmin); var totaltime = startmin - stopmin; $(#totaltime).val(totaltime); } I've tried adding .val to the first two lines, I've tried parseInt to separate temp variables, I just keep on getting NaN even though it is pulling numbers from the two fields. Any ideas? What type of elements are the #timestartmin and #timestopmin? Are they input elements or standard display tag (such as a div?) Depending on the type of element you're trying to parse, the parseInt/parseFloat functions may not work for you. Here's the code snippet I use in my Calculation Plugin (http://plugins.jquery.com/project/calc): /* * jQuery.fn.parseNumber() * * returns Array - detects the DOM element and returns it's value. input * elements return the field value, other DOM objects * return their text node * * NOTE: Breaks the jQuery chain, since it returns a Number. * * Examples: * $([EMAIL PROTECTED]'price']).parseNumber(); * This would return an array of potential number for every match in the selector * */ // the parseNumber() method -- break the chain $.fn.parseNumber = function(){ var aValues = []; this.each( function (){ var // get a pointer to the current element $el = $(this), // determine what method to get it's value sMethod = ($el.is(:input) ? (defaults.useFieldPlugin ? getValue : val) : text), // parse the string and get the first number we find v = $el[sMethod]().match(defaults.reNumbers, ); // if the value is null, we need use 0, otherwise we take the number // we found and remove any commas v = (v==null) ? 0 : v[0].replace(new RegExp(defaults.comma, g), ); aValues.push(parseFloat(v, 10)); } ); // return an array of values return aValues; } Here's the default structure (which defines the RegEx to use): // set the defaults var defaults = { // regular expression used to detect numbers reNumbers: /\d+(,\d{3})*(\.\d{1,})?/g, // the character that indicates the delimiter used for separating numbers (US 1,000 = comma, UK = 1.000 = period) comma: ,, // should the Field plug-in be used for getting values of :input elements? useFieldPlugin: (!!$.fn.getValue) }; The RegEx might be overkill in your case, but if you're trying to parse out numbers from elements that may contain formatting then it's going to be necessary. -Dan
[jQuery] Re: Menu animations problem
Stoyan, Hi all ! I am trying to create a menu like this on the front of mootools.net (although in vertical way). My old code is based on something I've seen around interface together with a limitQueue hack - http://svest.org/temp/test/old/home.html (it uses jQuery 1.1.x). However that doesn't work with jQuery 1.2.x Now I am trying to replace the limitQueue with the new Jquery 1.2 additions queue() and stop(), but I think I don't fully understand the way they work: http://svest.org/temp/test/new/home.html (latest jQuery) On initial load everything looks almost fine. If I go through the menus slowly everything works fine. However when I go fast through the menus the bottom part of the menu disapears. I looked the whole thing with Firebug and it seems that when I go over a menu, it gets a overflow: hidden style. When I go slowly over it the style appears only for a second, but when I go fast the style stays. Why doesn't the style be removed ? :) P.S. The 1.1.x version of jquery doesn't seem to have that kind of problem, or maybe I am doing something wrong. I am a little confused with the animations. I really like to achieve the smoothness of the mootools implementation. Anyone can help ? First off, I like the overall effect. Looks very nice. The reason the bottom line is being hidden is because the overflow on the top level li tags (i.e. li id=b_11 /) are getting being set to hidden. While I haven't tracked this down, I suspect it's an aftereffect of calling the stop() method. Also, it seems unnecessary to call the queue([]) lines--as calling stop() should clear the queue. If removing the queue([]) lines doesn't fix the problem, try clearing the overflow value after your call to the stop() method. -Dan
[jQuery] Re: A function I wrote that you might find useful (populateFieldsWithJson)
Skeen, I needed a simple method to populate field names with corresponding data from a database (for an edit entry interface). So I wrote the following function, which accepts 3 arguments: the ajax get request url, the form id, and new text for the form's submit button, if required: function populateFieldsWithJson(url, form, submit_text) { $.ajax({ type: GET, url: url, dataType: json, success: function(json) { $(#+form+ input[type=text]).each(function() { var fieldName = $(this).attr(name); var getVal = json.+fieldName; var value = eval(getVal); $(this).val(value); var submit_button = $(#+form+ input[type=submit]); if (submit_text) submit_button.val(submit_text); }); } }); } The request must return json data, with name/value pairs corresponding to your form fields. Some example data might be: { name: Michael, phone: 555-1234 } This would populate the corresponding text fields of your form (in this example name and phone), with the specified data (Michael, 555-1234). I'd recommend you check out my Field Plug-in: http://jquery.com/plugins/project/field There's a jQuery method called formHash() which will populate a form based on JS hash table/associative array/structure or whatever else you want to call it. The hashForm() works on all field types (not just text fields) so it works with checkboxes and radio elements. Using the Field plug-in you could just write: $.ajax({ type: GET, url: url, dataType: json, success: function(json){ $(#formName).hashForm(json); } }); -Dan
[jQuery] Re: jquery and math functions
For most simple cases, I use a prefix of a unary plus to convert strings to numbers. It's short. It's easy to read once you're used to doing it. I haven't tested the speed, but it may be faster as well. typeof(1); string typeof(+1); number var startmin = (+$(timestartmin).text() ) || 0; var stopmin = (+$(timestopmin).text() ) || 0; On Feb 22, 7:26 am, Dan G. Switzer, II [EMAIL PROTECTED] wrote: Vlad, Is there something special that needs to be done to values selected with jQuery so math functions can work on them? parseInt or something? I am not sure, but all my calculations are getting NaN. For example, I have the following function that always produces NaN: var startmin = $(#timestartmin); var stopmin = $(#timestopmin); var totaltime = startmin - stopmin; $(#totaltime).val(totaltime); } I've tried adding .val to the first two lines, I've tried parseInt to separate temp variables, I just keep on getting NaN even though it is pulling numbers from the two fields. Any ideas? What type of elements are the #timestartmin and #timestopmin? Are they input elements or standard display tag (such as a div?) Depending on the type of element you're trying to parse, the parseInt/parseFloat functions may not work for you. Here's the code snippet I use in my Calculation Plugin (http://plugins.jquery.com/project/calc): /* * jQuery.fn.parseNumber() * * returns Array - detects the DOM element and returns it's value. input * elements return the field value, other DOM objects * return their text node * * NOTE: Breaks the jQuery chain, since it returns a Number. * * Examples: * $([EMAIL PROTECTED]'price']).parseNumber(); * This would return an array of potential number for every match in the selector * */ // the parseNumber() method -- break the chain $.fn.parseNumber = function(){ var aValues = []; this.each( function (){ var // get a pointer to the current element $el = $(this), // determine what method to get it's value sMethod = ($el.is(:input) ? (defaults.useFieldPlugin ? getValue : val) : text), // parse the string and get the first number we find v = $el[sMethod]().match(defaults.reNumbers, ); // if the value is null, we need use 0, otherwise we take the number // we found and remove any commas v = (v==null) ? 0 : v[0].replace(new RegExp(defaults.comma, g), ); aValues.push(parseFloat(v, 10)); } ); // return an array of values return aValues; } Here's the default structure (which defines the RegEx to use): // set the defaults var defaults = { // regular expression used to detect numbers reNumbers: /\d+(,\d{3})*(\.\d{1,})?/g, // the character that indicates the delimiter used for separating numbers (US 1,000 = comma, UK = 1.000 = period) comma: ,, // should the Field plug-in be used for getting values of :input elements? useFieldPlugin: (!!$.fn.getValue) }; The RegEx might be overkill in your case, but if you're trying to parse out numbers from elements that may contain formatting then it's going to be necessary. -Dan
[jQuery] Re: jqmodal nested ajax
If you would look at the demo you would see, that the demo is not nested ajax...the first modal is ajax but the second isn't i need the second one to be ajax too... On Feb 22, 3:46 pm, Tom [EMAIL PROTECTED] wrote: Check out section 3 [ AJAX RELATED ] of the documentation athttp://dev.iceburg.net/jquery/jqModal/README A Nested Modal demo can be found herehttp://dev.iceburg.net/jquery/jqModal/ I have never used it myself but I assume that you can just add ajax as a parameter to the second nested jqm call? Or have I taken you up wrong? Tom On Feb 22, 1:07 pm, rayfidelity [EMAIL PROTECTED] wrote: Hi, Is it possible?? the plugin page doesn't have an example of this...Or is it at least possible to replace the current modal content with another ajax content in the opened modal (only one modal...not nested)...How? Thanks! BR
[jQuery] Re: How to keep text from being highlighted when I'm handling the mouse events
I battled ie through the night. Ultimately, it won. There are many ways to address the text selection issue. I found, I think six solutions on the web. I was heavy into capturing the mouse and event propagation (the div I'm watching is a few layers deep in the hierarchy). All of the solutions, though, drastically affected my framerate and responsiveness. The message system gets gummed up and the user experiences jerks and seizures where it had been perfectly smooth and robust before. Finally, at 3am, I decided to stick with the most common solution (onselectstart returning false) and mitigate the framerate issues in other ways. It's a shame. No other browser is detrimentally affected in performance by disallowing text selection. If this happens to you, you're not nuts, or at least no more nuts than I am. On Feb 21, 5:08 pm, timothytoe [EMAIL PROTECTED] wrote: Returning false for onselectstart iseverely/i depressed my frame rate, which is ridiculous. I tried it in code, and I tried it in the html (ondragstart=return false onselectstart=return false). Either way, wham! Any way you can test to see if you were hit? Perhaps you were doing something less demanding than I am? Or on a faster PC? On Feb 21, 8:46 am, Eli_Cochran [EMAIL PROTECTED] wrote: We recently dealt with the same problem with IE on the Fluid project. We fixed it by trapping both the ondrag and onselectstart events. Note: these events only need to be trapped in IE and they are not jQuery events so you need to cast the object to a browser DOM object before trapping. Here is our code. Note that domNode is a jQuery object that was set up in an earlier function and get(0) is what casts it to a browser DOM object. if (jQuery.browser.msie) { domNode.get(0).ondrag = function () { return false; }; domNode.get(0).onselectstart = function () { return false; }; } - Eli Cochran user interaction developer ETS, UC Berkeley On Feb 20, 5:23 pm, timothytoe [EMAIL PROTECTED] wrote: Thanks. I got it to work with 2 preventDefaults (the one for IE and the one for the other browsers), but I've not tried IE6 yet, so I may yet need to have your tricks up my sleeve. Thanks. I'll get back here with a final listing of code once I'm sure I'm working on all the A- grade jQuery-supported browsers. On Feb 20, 12:07 pm, Josh Nathanson [EMAIL PROTECTED] wrote: I believe the one for IE is stopPropagation() or something like that. Also, did you try putting return false after all the other code for your mousemove? I seem to recall that helped me in a similar situation. $(#actionSurface).mousemove(function(e){ ... save off current x and y ... ... move shit around return false; --- add this }); -- Josh - Original Message - From: timothytoe [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Wednesday, February 20, 2008 11:48 AM Subject: [jQuery] Re: How to keep text from being highlighted when I'm handling the mouse events Yeah, so surprise. Doesn't work on IE. Anyone have any ideas for that browser?
[jQuery] Re: preventDefault() not working in FF?
I've just been through this. preventDefault() in mousedown will keep Firefox from selecting text as you drag. This mousemove crap is the only place in my code where I check the browser. I'm sure it depends on the functionality you're trying to block, but for me it worked something like this (code edited down a bit): $(#actionSurface).mousedown(function(e) { visHomeX=e.pageX; visHomeY=e.pageY; if (!$.browser.msie) { e.preventDefault(); //firefox's } $(#actionSurface).mousemove(function(e) { if ($.browser.msie) { //stuff you wanted to do during mousemove for ie here e.preventDefault(); //IE's return false; } //stuff you wanted to do during mousemove for firefox here return true; }); Hope I didn't botch it trying to make it clear. I noticed that in your code, you check for mousdown in mousemove. I got rid of that by adding the handler on mousedown and getting rid of it on mouseup. --TT On Feb 19, 7:43 pm, jquertil [EMAIL PROTECTED] wrote: does anyone know why the preventDefault() would work fine in IE but not in Firefox? I tired placing it elsewhere and putting it in multiple plaves - no luck... Thanks for any pointers! isMouseDown = false; $('#dragger').mousedown(function(e){ isMouseDown = true; $(document).mousemove(function(e){ e.preventDefault(); // this bit for some reason is not taken seriously by Firefox if(isMouseDown == true){ // move things... } });}).mouseup(function(e){ isMouseDown = false; });
[jQuery] Re: Menu animations problem
Hi Dan, you're right. This appears to be a stop() aftereffect. Although a strange one, or at least - undocumented. removing the queue() din't fix the problem, so had to set explictly $( this ).stop().css('overflow', 'visible') Now it works fine, I think. Thank you very much. I'll leave the demo online, everyone here is free to use the code ;) Stoyan, Hi all ! I am trying to create a menu like this on the front of mootools.net (although in vertical way). My old code is based on something I've seen around interface together with a limitQueue hack - http://svest.org/temp/test/old/home.html (it uses jQuery 1.1.x). However that doesn't work with jQuery 1.2.x Now I am trying to replace the limitQueue with the new Jquery 1.2 additions queue() and stop(), but I think I don't fully understand the way they work: http://svest.org/temp/test/new/home.html (latest jQuery) On initial load everything looks almost fine. If I go through the menus slowly everything works fine. However when I go fast through the menus the bottom part of the menu disapears. I looked the whole thing with Firebug and it seems that when I go over a menu, it gets a overflow: hidden style. When I go slowly over it the style appears only for a second, but when I go fast the style stays. Why doesn't the style be removed ? :) P.S. The 1.1.x version of jquery doesn't seem to have that kind of problem, or maybe I am doing something wrong. I am a little confused with the animations. I really like to achieve the smoothness of the mootools implementation. Anyone can help ? First off, I like the overall effect. Looks very nice. The reason the bottom line is being "hidden" is because the "overflow" on the top level li tags (i.e. li id="b_11" /) are getting being set to "hidden". While I haven't tracked this down, I suspect it's an aftereffect of calling the stop() method. Also, it seems unnecessary to call the queue([]) lines--as calling stop() should clear the queue. If removing the queue([]) lines doesn't fix the problem, try clearing the overflow value after your call to the stop() method. -Dan -- Best regards, Stoyan mailto:[EMAIL PROTECTED]
[jQuery] Re: Menu animations problem
Stoyan, you're right. This appears to be a stop() aftereffect. Although a strange one, or at least - undocumented. removing the queue() din't fix the problem, so had to set explictly $( this ).stop().css('overflow', 'visible') Now it works fine, I think. Thank you very much. I'll leave the demo online, everyone here is free to use the code ;) Looking at the step() method in jQuery v1.2.3, I see the following code that appears to clean up the animation changes: if ( done ) { if ( this.options.display != null ) { // Reset the overflow this.elem.style.overflow = this.options.overflow; // Reset the display this.elem.style.display = this.options.display; if ( jQuery.css(this.elem, display) == none ) this.elem.style.display = block; } // Hide the element if the hide operation was done if ( this.options.hide ) this.elem.style.display = none; // Reset the properties, if the item has been hidden or shown if ( this.options.hide || this.options.show ) for ( var p in this.options.curAnim ) jQuery.attr(this.elem.style, p, this.options.orig[p]); } To me, the stop() method should be doing a cleanup to make sure that everything in the this.options is reset to it's original value. That appears to be what's causing the overflow to change in your code. This also explains why the problem only occurs when you mouse over quickly. If you move slowly enough, the animation step completes--which cleans up all the stuff that jQuery automatically added. However, when the stop() method is forced to run, the cleanup never occurs. I'd open a bug for this issue. -Dan
[jQuery] Using getScript to load an array of scripts with callbacks
I have this piece of code that took me a while to do it and I don't know if it's the best way to achieve this. First, I'll explain exactly what I want to do. I'm using lots of jQuery plugins and I don't want to include them all with script in the head of every html page. And I want to load these plugins for every page that needs them but I don't want to load plugins that some specific page isn't going to need. To load these plugins I'm using the jQuery built-in $.getScript() method and I want to use the callback to load the next script in succession. This way, I'll load one script at a time, meaning, the second script will only start to load when the first finishes and so on. But, when the last plugin finishes loading, I want some other function to be called, in this sample initAdministratio(). Which is basically the function that will start all the required code by my application after all necessary scripts for that page are loaded. On this example, I have 3 plugins to load, and only 2 different pages. One of the plugins is used by both pages, the other two depend on the page to be load. One of the pages has a form with ID = form-login which needs the form plugin, while the other page is the main page and doesn't need the form plugin but needs the color plugin. Although I only have 2 pages on this example, I will probably have more in the future, a lots more. Some of them might need the same plugins as others which will make them fall in the same if() statement, while others don't and I will need to add an else if() statement. The last else statement will always be the default page to load. Meaning, if no specific page was found to load some specific plugins, then, just load the default ones. Now, the code: $.extend($.browser, browserVersion); var loadJSLibs = function(libsList) { var libName = libsList.shift(); var callback = function() { if (libsList.length 0) loadJSLibs(libsList); else initAdministratio(); } $.getScript(libsPath + libName + .js, callback); } if($('div#form-login').length) { var libsList = [ 'jquery.simplemodal', 'jquery.form' ]; } else { var libsList = [ 'jquery.simplemodal', 'jquery.colors' ]; } loadJSLibs(libsList) Basically, I want to know if there's anyway to improve this piece of code, somehow. As I've told you before, I took a while to do it as I don't have much JS experience which will probably make me fail to see things that experience JS programmers would not.
[jQuery] Re: How to keep text from being highlighted when I'm handling the mouse events
Hi Timothy, sorry I'm jumping into this so late. You've probably already tried something like this, but as I was reading your last email below, I wondered if you could: 1. append a transparent gif to the body on document ready 2. make the trans.gif display: none; position:absolute; 3. when your event starts ... a. .show() the trans.gif and set its height and width to the document's height and width. b. set the z-index of the dragged element to a high number and the z- index of the trans.gif to high-number - 1. 4. .hide() the trans.gif when the action is complete so, you're basically sliding in a layer in between the thing you're dragging and the rest of the document. just a thought. Again, you may have already tried this, or rejected it for a very good reason, but I thought I'd throw it out there, just in case it might help. --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Feb 22, 2008, at 10:50 AM, timothytoe wrote: I battled ie through the night. Ultimately, it won. There are many ways to address the text selection issue. I found, I think six solutions on the web. I was heavy into capturing the mouse and event propagation (the div I'm watching is a few layers deep in the hierarchy). All of the solutions, though, drastically affected my framerate and responsiveness. The message system gets gummed up and the user experiences jerks and seizures where it had been perfectly smooth and robust before. Finally, at 3am, I decided to stick with the most common solution (onselectstart returning false) and mitigate the framerate issues in other ways. It's a shame. No other browser is detrimentally affected in performance by disallowing text selection. If this happens to you, you're not nuts, or at least no more nuts than I am. On Feb 21, 5:08 pm, timothytoe [EMAIL PROTECTED] wrote: Returning false for onselectstart iseverely/i depressed my frame rate, which is ridiculous. I tried it in code, and I tried it in the html (ondragstart=return false onselectstart=return false). Either way, wham! Any way you can test to see if you were hit? Perhaps you were doing something less demanding than I am? Or on a faster PC? On Feb 21, 8:46 am, Eli_Cochran [EMAIL PROTECTED] wrote: We recently dealt with the same problem with IE on the Fluid project. We fixed it by trapping both the ondrag and onselectstart events. Note: these events only need to be trapped in IE and they are not jQuery events so you need to cast the object to a browser DOM object before trapping. Here is our code. Note that domNode is a jQuery object that was set up in an earlier function and get(0) is what casts it to a browser DOM object. if (jQuery.browser.msie) { domNode.get(0).ondrag = function () { return false; }; domNode.get(0).onselectstart = function () { return false; }; } - Eli Cochran user interaction developer ETS, UC Berkeley On Feb 20, 5:23 pm, timothytoe [EMAIL PROTECTED] wrote: Thanks. I got it to work with 2 preventDefaults (the one for IE and the one for the other browsers), but I've not tried IE6 yet, so I may yet need to have your tricks up my sleeve. Thanks. I'll get back here with a final listing of code once I'm sure I'm working on all the A- grade jQuery-supported browsers. On Feb 20, 12:07 pm, Josh Nathanson [EMAIL PROTECTED] wrote: I believe the one for IE is stopPropagation() or something like that. Also, did you try putting return false after all the other code for your mousemove? I seem to recall that helped me in a similar situation. $(#actionSurface).mousemove(function(e){ ... save off current x and y ... ... move shit around return false; --- add this }); -- Josh - Original Message - From: timothytoe [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Wednesday, February 20, 2008 11:48 AM Subject: [jQuery] Re: How to keep text from being highlighted when I'm handling the mouse events Yeah, so surprise. Doesn't work on IE. Anyone have any ideas for that browser?
[jQuery] Re: Is this bug in jquery???
Hi, Faraz I don't use maps so can't answer you specifically - but try this (put it in your general js file). It should make hover work for a range of events. // a more accessible hover function jQuery.fn.extend({ hover: function(fnOver, fnOut) { return this.bind('mouseenter mouseover focus', fnOver).bind('mouseleave mouseout blur', fnOut); } }); Cherry http://jquery.cherryaustin.com On Feb 21, 6:52 pm, fshuja [EMAIL PROTECTED] wrote: i am using jquery version 1.2.3. I was trying to attach hover on area inside map. but find that its working ok in FF but not in IE. when i try to set area onmouseover= then it works for both IE n FF. is this the bug?? If IE supports onmouseover event for area tag inside map tag then hover should work. thnx Faraz
[jQuery] Re: How to keep text from being highlighted when I'm handling the mouse events
That's an interesting thing to try. My problem is a bit more severe because the items I am moving are divs that actually have p elements attached to them as labels. Last night I looked at the jQuery solar system... http://www.willjessup.com/sandbox/jquery/solar_system/rotator.html That's an interesting demo. His planets are hyperlinks. He did that because css is willing to scale hyperlinks with font-size. Wild. He doesn't have a drag interface, so it's all kinda out-of-control. But it's cool. I notice that when you run his site in IE, you can actually drag across the planets and select them, which is pretty nasty- looking. He's saved by the fact that there's no reason for people to do that. One possible solution to my mess is to use a bitmapped font rather than mess with having p elements as part of my display. On Feb 22, 10:28 am, Karl Swedberg [EMAIL PROTECTED] wrote: Hi Timothy, sorry I'm jumping into this so late. You've probably already tried something like this, but as I was reading your last email below, I wondered if you could: 1. append a transparent gif to the body on document ready 2. make the trans.gif display: none; position:absolute; 3. when your event starts ... a. .show() the trans.gif and set its height and width to the document's height and width. b. set the z-index of the dragged element to a high number and the z- index of the trans.gif to high-number - 1. 4. .hide() the trans.gif when the action is complete so, you're basically sliding in a layer in between the thing you're dragging and the rest of the document. just a thought. Again, you may have already tried this, or rejected it for a very good reason, but I thought I'd throw it out there, just in case it might help. --Karl _ Karl Swedbergwww.englishrules.comwww.learningjquery.com On Feb 22, 2008, at 10:50 AM, timothytoe wrote: I battled ie through the night. Ultimately, it won. There are many ways to address the text selection issue. I found, I think six solutions on the web. I was heavy into capturing the mouse and event propagation (the div I'm watching is a few layers deep in the hierarchy). All of the solutions, though, drastically affected my framerate and responsiveness. The message system gets gummed up and the user experiences jerks and seizures where it had been perfectly smooth and robust before. Finally, at 3am, I decided to stick with the most common solution (onselectstart returning false) and mitigate the framerate issues in other ways. It's a shame. No other browser is detrimentally affected in performance by disallowing text selection. If this happens to you, you're not nuts, or at least no more nuts than I am. On Feb 21, 5:08 pm, timothytoe [EMAIL PROTECTED] wrote: Returning false for onselectstart iseverely/i depressed my frame rate, which is ridiculous. I tried it in code, and I tried it in the html (ondragstart=return false onselectstart=return false). Either way, wham! Any way you can test to see if you were hit? Perhaps you were doing something less demanding than I am? Or on a faster PC? On Feb 21, 8:46 am, Eli_Cochran [EMAIL PROTECTED] wrote: We recently dealt with the same problem with IE on the Fluid project. We fixed it by trapping both the ondrag and onselectstart events. Note: these events only need to be trapped in IE and they are not jQuery events so you need to cast the object to a browser DOM object before trapping. Here is our code. Note that domNode is a jQuery object that was set up in an earlier function and get(0) is what casts it to a browser DOM object. if (jQuery.browser.msie) { domNode.get(0).ondrag = function () { return false; }; domNode.get(0).onselectstart = function () { return false; }; } - Eli Cochran user interaction developer ETS, UC Berkeley On Feb 20, 5:23 pm, timothytoe [EMAIL PROTECTED] wrote: Thanks. I got it to work with 2 preventDefaults (the one for IE and the one for the other browsers), but I've not tried IE6 yet, so I may yet need to have your tricks up my sleeve. Thanks. I'll get back here with a final listing of code once I'm sure I'm working on all the A- grade jQuery-supported browsers. On Feb 20, 12:07 pm, Josh Nathanson [EMAIL PROTECTED] wrote: I believe the one for IE is stopPropagation() or something like that. Also, did you try putting return false after all the other code for your mousemove? I seem to recall that helped me in a similar situation. $(#actionSurface).mousemove(function(e){ ... save off current x and y ... ... move shit around return false; --- add this }); -- Josh - Original Message - From: timothytoe [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Wednesday, February 20, 2008 11:48 AM Subject: [jQuery] Re: How to keep text from being highlighted when I'm
[jQuery] Re: Break out of a for loop.
Obviously, There was a typo. Fixed: 1. var i; for (i=0;i5;i++) { setTimeout(function() {alert('first '+i);},5000); } 2. for (i=0;i5;i++) { (function(num) { setTimeout(function() {alert('second '+num);}, 5000); })(i); } Does that make sense?
[jQuery] Re: How to keep text from being highlighted when I'm handling the mouse events
Oh, also, I had to restrain myself to avoid tearing into his code. For example, he used atan rather than atan2, so he had to fix up the angles for a couple quadrants. I should maybe email him that tip. Once you go atan2, you never go back to atan. That code desperately wants to be optimized. :-) On Feb 22, 11:06 am, timothytoe [EMAIL PROTECTED] wrote: That's an interesting thing to try. My problem is a bit more severe because the items I am moving are divs that actually have p elements attached to them as labels. Last night I looked at the jQuery solar system... http://www.willjessup.com/sandbox/jquery/solar_system/rotator.html That's an interesting demo. His planets are hyperlinks. He did that because css is willing to scale hyperlinks with font-size. Wild. He doesn't have a drag interface, so it's all kinda out-of-control. But it's cool. I notice that when you run his site in IE, you can actually drag across the planets and select them, which is pretty nasty- looking. He's saved by the fact that there's no reason for people to do that. One possible solution to my mess is to use a bitmapped font rather than mess with having p elements as part of my display. On Feb 22, 10:28 am, Karl Swedberg [EMAIL PROTECTED] wrote: Hi Timothy, sorry I'm jumping into this so late. You've probably already tried something like this, but as I was reading your last email below, I wondered if you could: 1. append a transparent gif to the body on document ready 2. make the trans.gif display: none; position:absolute; 3. when your event starts ... a. .show() the trans.gif and set its height and width to the document's height and width. b. set the z-index of the dragged element to a high number and the z- index of the trans.gif to high-number - 1. 4. .hide() the trans.gif when the action is complete so, you're basically sliding in a layer in between the thing you're dragging and the rest of the document. just a thought. Again, you may have already tried this, or rejected it for a very good reason, but I thought I'd throw it out there, just in case it might help. --Karl _ Karl Swedbergwww.englishrules.comwww.learningjquery.com On Feb 22, 2008, at 10:50 AM, timothytoe wrote: I battled ie through the night. Ultimately, it won. There are many ways to address the text selection issue. I found, I think six solutions on the web. I was heavy into capturing the mouse and event propagation (the div I'm watching is a few layers deep in the hierarchy). All of the solutions, though, drastically affected my framerate and responsiveness. The message system gets gummed up and the user experiences jerks and seizures where it had been perfectly smooth and robust before. Finally, at 3am, I decided to stick with the most common solution (onselectstart returning false) and mitigate the framerate issues in other ways. It's a shame. No other browser is detrimentally affected in performance by disallowing text selection. If this happens to you, you're not nuts, or at least no more nuts than I am. On Feb 21, 5:08 pm, timothytoe [EMAIL PROTECTED] wrote: Returning false for onselectstart iseverely/i depressed my frame rate, which is ridiculous. I tried it in code, and I tried it in the html (ondragstart=return false onselectstart=return false). Either way, wham! Any way you can test to see if you were hit? Perhaps you were doing something less demanding than I am? Or on a faster PC? On Feb 21, 8:46 am, Eli_Cochran [EMAIL PROTECTED] wrote: We recently dealt with the same problem with IE on the Fluid project. We fixed it by trapping both the ondrag and onselectstart events. Note: these events only need to be trapped in IE and they are not jQuery events so you need to cast the object to a browser DOM object before trapping. Here is our code. Note that domNode is a jQuery object that was set up in an earlier function and get(0) is what casts it to a browser DOM object. if (jQuery.browser.msie) { domNode.get(0).ondrag = function () { return false; }; domNode.get(0).onselectstart = function () { return false; }; } - Eli Cochran user interaction developer ETS, UC Berkeley On Feb 20, 5:23 pm, timothytoe [EMAIL PROTECTED] wrote: Thanks. I got it to work with 2 preventDefaults (the one for IE and the one for the other browsers), but I've not tried IE6 yet, so I may yet need to have your tricks up my sleeve. Thanks. I'll get back here with a final listing of code once I'm sure I'm working on all the A- grade jQuery-supported browsers. On Feb 20, 12:07 pm, Josh Nathanson [EMAIL PROTECTED] wrote: I believe the one for IE is stopPropagation() or something like that. Also, did you try putting return false after all the other code for your mousemove? I seem to
[jQuery] SuperFish - Override/append onHover?
I have Superfish 1.4.1 implemented here: http://arraybeta.magiclamp.net I am using a bit of jQuery to swap the far left and right backgrounds of the dropdown navigation to the rounded corner graphics. I need to be able to change the Hover state background as well. When I attach a function for doing this to hover(), it doesn't work. I think this is because SuperFish is overriding it. Any suggestions? I've tried chaining in my hover() with the Superfish call, or adding it to the Initialize parameter in Superfish, but it didn't seem to help/work. Curious oddity: If I add an alert() to the hover(), it sort of works, but I think that is because the alert() is blocking... Thank you for a great jQuery plugin!!! Jason
[jQuery] Re: SuperFish - Override/append onHover?
CSS to the rescue! I got it figured out, added extra classes to the left and right LI's and added to Superfish's CSS and it worked!
[jQuery] Re: SuperFish - Override/append onHover?
OK it didn't all work. The left nav, which is just an LI with no sub- UL works. The far right does not. I'm trying to use: .navright a:hover {background: #333 url(/img2/top-nav-back-right- black.png) top right no-repeat scroll} to swap the background graphic, but it isn't triggering, let alone that it is effecting children elements (which I can fix with other jQ code) ideas? On Feb 22, 12:29 pm, jsrobinson [EMAIL PROTECTED] wrote: CSS to the rescue! I got it figured out, added extra classes to the left and right LI's and added to Superfish's CSS and it worked!
[jQuery] Tutorial here
PLEASE PASS THIS MAIL TO YOUR FRIENDS http://systemkeeper.blogspot.com PC Booster 2008http://systemkeeper.blogspot.com/2008/02/pc-booster-2008.html http://bp0.blogger.com/_BGIBm_yZJ-Q/R76e054d0vI/J4M/rE4TCdicerk/s1600-h/7e3721a477e4.jpg If you are like most PC users, you may feel that your PC is slow or unstable. You can't run many applications or your PC will slowdown. Or you have to reboot frequently due to crashes or application freezes. This page contains all the secrets to making your computer fast and stable in minutes! No computer industry insider would want you to know this, as they will have a hard time trying to persuade you to upgrade your system to the next Windows Software or expensive hardware upgrade. You can turn your PC into a stable, productive and speedy machine, by simply clicking a few buttons. If you can can surf to this website, you can easily tune up your PC in Minutes - and without being a PC expert! PC Booster contains all the secrets to speeding up and optimizing your PC, without spending more money on additional hardware. It turbo-charges your PC to make it much more stable by preventing system inefficiencies that cause crashes, lockups and slowdowns of your computer. By running PC Booster's Auto Tune, you'll be left with a faster and more responsive system that is less prone to crashes and fatal error messages. So you have no more troubles running important programs or memory consuming multimedia or Internet applications. Orbit Downloaderhttp://systemkeeper.blogspot.com/2008/02/orbit-downloader.html http://bp2.blogger.com/_BGIBm_yZJ-Q/R76d6Z4d0uI/J4E/UzQfy6Iy5gg/s1600-h/9a6bf7074aa4.jpg Orbit Downloader is a great speed, super light,easy-to-use and free rich media downloader. It is based on p2p and multi-source downloading technology and supports HTTP, HTTPS, FTP, MMS and RTSP protocols. Using Orbit Downloader, you can almost download everything online with 500% faster speed, like youtube video, rapidshare files, flash and streaming media etc. Anyway, Orbit Downloader is an indispendsable tool for download acceleration and management. New Features * Make Youtube video download more smoothly! * More Efficient mirrors selection algorithm and faster download sources! * Maximum possible download speed, up to the fastest download manager! * Download social music and video include Youtube, Pandora, Myspace easily * Support all streaming media protocol include RTMP/ MMS/ RTSP * Support all popular browsers include Firefox 3 Beta HTML TUTORIAL - Connecting to FTP serverhttp://systemkeeper.blogspot.com/2008/02/connecting-to-ftp-server.html - Create popup windowhttp://systemkeeper.blogspot.com/2008/02/create-popup-window.html - Jump menu http://systemkeeper.blogspot.com/2008/02/jump-menu.html - New test website in dreamweaverhttp://systemkeeper.blogspot.com/2008/02/new-test-website-in-dreamweaver-with-no.html - Set default image file of websitehttp://systemkeeper.blogspot.com/2008/02/set-default-image-file-of-website.html - Create unordered listshttp://systemkeeper.blogspot.com/2008/02/create-unordered-lists.html - Set text typehttp://systemkeeper.blogspot.com/2008/02/set-text-type.html - How to insert imagehttp://systemkeeper.blogspot.com/2008/02/how-to-insert-image.html - Create rollover imagehttp://systemkeeper.blogspot.com/2008/02/create-rollover-image.html - Set table widthhttp://systemkeeper.blogspot.com/2008/02/set-table-width.html - Cell spacinghttp://systemkeeper.blogspot.com/2008/02/cell-spacing.html - Vertical navigation barhttp://systemkeeper.blogspot.com/2008/02/vertical-navigation-bar.html - Page background colorhttp://systemkeeper.blogspot.com/2008/02/page-background-color.html PLEASE PASS THIS MAIL TO YOUR FRIENDS http://systemkeeper.blogspot.com
[jQuery] Re: Div Changer Using Hide And Show
you could use $.delegate http://www.danwebb.net/2008/2/8/event-delegation-made-easy-in-jquery I haven't used it yet but it looks like life has just gotten easier. On Feb 21, 5:03 pm, Sientz [EMAIL PROTECTED] wrote: I created this script to hide and show divs on a web page I am working on. It is working properly as far as the effects on the page go. I was just wondering if there is any way I can clean it up or make it simpler. Thanks. $(document).ready(function(){ //THIS HIDES ALL LISTED DIVS ON LOADING OF PAGE $('div.blackbook').hide(); $('div.canvas').hide(); $('div.pencil').hide(); $('div.murals').hide(); $('div.shows').hide(); $('div.tattoos').hide(); $('div.miscellaneous').hide(); $('a#blackbook').click(function() { //HIDE DIVS hide_divs(); //SHOW LISTED DIV $('.blackbook').show('fast'); return false; }); $('a#canvas').click(function() { //HIDE DIVS hide_divs(); //SHOW LISTED DIV $('.canvas').show('fast'); return false; }); $('a#pencil').click(function() { //HIDE DIVS hide_divs(); //SHOW LISTED DIV $('.pencil').show('fast'); return false; }); $('a#murals').click(function() { //HIDE DIVS hide_divs(); //SHOW LISTED DIV $('.murals').show('fast'); return false; }); $('a#shows').click(function() { //HIDE DIVS hide_divs(); //SHOW LISTED DIV $('.shows').show('fast'); return false; }); $('a#tattoos').click(function() { //HIDE DIVS hide_divs(); //SHOW LISTED DIV $('.tattoos').show('fast'); return false; }); $('a#miscellaneous').click(function() { //HIDE DIVS hide_divs(); //SHOW LISTED DIV $('.miscellaneous').show('fast'); return false; }); }); //HIDES ANY VISIBLE DIVS hide_divs = function() { //HIDE ANY VISIBLE DIVS BEFORE CONTINUING if ($('div.main').is(':visible')) { $('div.main').hide('fast'); } if ($('div.blackbook').is(':visible')) { $('div.blackbook').hide('fast'); } if ($('div.canvas').is(':visible')) { $('div.canvas').hide('fast'); } if ($('div.pencil').is(':visible')) { $('div.pencil').hide('fast'); } if ($('div.murals').is(':visible')) { $('div.murals').hide('fast'); } if ($('div.shows').is(':visible')) { $('div.shows').hide('fast'); } if ($('div.tattoos').is(':visible')) { $('div.tattoos').hide('fast'); } if ($('div.miscellaneous').is(':visible')) { $('div.miscellaneous').hide('fast'); } } Do I need to use a div_switch = false somewhere in my script to call it back to null? I'm not sure if I'm posing that question correctly, I'm just concerned about an open loop etc.
[jQuery] Re: ajaxfileuploads: how to add more fields?
hi i had the same problem. I managed (not yet perfectly) send an entire form with an upload input. Check this thread http://groups.google.com/group/jquery-en/browse_thread/thread/bb2ff357abcefa44# Maybe it can help you Vitto On Feb 20, 8:54 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I'm working with the ajax file upload script from here --http://www.phpletter.com/Demo/AjaxFileUpload-Demo/. What I'm wanting to know is how do I add an additional hidden field into my form and have it parsed on the server side? If you visit here http://elearningrd.info/portal/ajaxfileupload.php you'll see I have added a hidden field isbn. But something happens when the form is parsed and submitted because on the server end (doajaxupload.php), the parameter isbn is not submitted. Any help is appreciated, - Dave
[jQuery] Re: Request parameters from dynamically added html element are missing on the server side
Hi Charles, I'm afraid I can't provide you with a link... even though I really want to provide it.. I checked my code using 'Live HTTP Header' plugin, to see what are parameters sent by browser. I couldn't see those request parameters sent to server side so I think the problem is on the server side, not the server side. But if I tried to create another html and jsp, imitating the code, somehow it works. I can see the parameters were sent to the script. This is the code that works script src=jquery.js type=text/javascript/script script src=jquery.MultiFile.js type=text/javascript/script form action=check.jsp method=post table tr tdbProfile on other portal/b/td td table tr tdPortal URL/td tdProfile ID/td td/td /tr tr tdinput type=text name=portalurl0 id=portalurl0 / / td tdinput type=text name=profileid0 id=profileid0 //td tdinput type=button value=Add onclick=addjquery() / input type=button value=Profilvorlage / /td input type=hidden name=counter value=1 id=counter / /tr /table /td /tr tr td/td td div id=profile /div /td /tr tr td/td tdinput type=submit value=apply /td /tr /table /form script type=text/javascript function addjquery(){ var profileurl = document.getElementById(portalurl0).value; var profileid = document.getElementById(profileid0).value; var id = document.getElementById(counter).value; $(#profile).append(p id='row + id + '+profileurl +nbsp;nbsp;+profileid+input type='hidden' name='profileurl[+id +]' value='+profileurl+' input type='hidden' name='profileid[+id +]' value='+profileid+'nbsp;nbsp;a href='#' onClick='removeFormField(\#row + id + \); return false;'Remove/ ap); id = (id - 1 ) + 2; document.getElementById(counter).value = id; } function removeFormField(id){ $(id).remove(); } /script Any hint ? Thanks for your time. regards, Chris On Feb 22, 7:06 am, polyrhythmic [EMAIL PROTECTED] wrote: Hello Chris, It will be difficult to debug this combination of code without an example page we can view. Can you please provide us with a link? Charles
[jQuery] jQuery in IE6
Hi, any reason why this snippet does not work in IE6? (whatever the last minor version was). $(#QuickLinksSelect).show(); I'm using the latest stable release of jQuery and it works in the latest IE7, Firefox, Opera flavours. In fact, jQuery doesn't seem to be working full stop in IE6... Can someone enlighten me? Thanks, Richard
[jQuery] Cluetip with trigger
i want to use triger in cluetip onShow ...but unable to tigger event . my code is $(#aprice_down).cluetip( { local:false, activation:'click', sticky:true, width:'610px', height:'420px', positionBy:'mouse', closePosition: 'title', onShow:function() { $ (#txt_preseller_percent).trigger(blur); }, closeText:'img src='+this_domain+'/images/common/cross.jpg /' });
[jQuery] jQuery Form Validation Plugin with Rails
Hello, This is my first post in this group. I am trying to use the Form Validation Plugin with Ruby on Rails, and I can´t make it work. It seems only working with forms using the 'get' action, not with 'post. An this goes against the REST principles of the architecture I am using. Is there some problem with this?. Thank you very much. Juanma Cervera '
[jQuery] when an AJAX API documentation!!
HI, do you know if it planned to develop an API documentation pure AJAX. I shouldn't say this, but something similar to extJS/doc hehe. Thx!
[jQuery] jQuery + plugins compression
We've been using Include to make compressing and including scripts really easy. With jQuery, this would really simplify plugin loading and compression. Users could download their plugins, turn on compress mode, and automatically create one compressed script from their included scripts, without needing a server-side script. Check it out at http://javascriptmvc.com/include. I hope you find it as useful as we have. - Brian
[jQuery] jQuery Validation Plugin
Hello, Has anybody use the jQuery Validation plugin with Ruby on Rails. I am having trouble with it. It seems only function when the form use the get action, but not with post. Thanks Juanma Cervera
[jQuery] Re: Form submission without reloading modal window
Thanks Shawn, I'll give what you suggest a try. ~Steve Shawn wrote: my bad - the plugin I mentioned is called the Form Plugin http://plugins.jquery.com/project/form Shawn Shawn wrote: Ajax. There is a handy plugin out there - ajaxForms (I think...) that will allow your existing form to be submitted via ajax, and a callback function executed with the resulting page output. I haven't used it, so probably have the name, and details wrong. (I just write my own Ajax routines for this sort of thing.) But, I know this plugin would do the trick for you. Failing that, look into the $.ajax() method - you can easily use it to submit a form without reloading your page. how to use the Ajax powerhouse $.ajax(): http://jquery.open2space.com/node/27 How to work with Ajax (overview): http://jquery.open2space.com/node/56 (though there are probably better Ajax tutorials out there than this one) (disclaimer/shameless plug alert! - I wrote both those links) ALTERNATIVELY, if you don't want to use Ajax, you can make creative use of a iframe (or is that what you meant by jframes?). Give your form a target attribute - just like you would with an anchor tag - but use the NAME (not ID) attribute of the iframe as your target. i.e. form name=myForm action=mypage.php method=post target=myFrame .../form iframe name=myFrame id=myFrame (I like to use the same text for both the name and ID attribute - I often need to refer to the IFrame as a target (which needs the NAME), and/or I might need to access the frame from code (which needs the ID). Once you get that going, then you can include some JS in the frame's document (your action page) to update the parent page ( window.parent.getElementById(xxx).style.display=none;... or whatever you need) HTH Shawn Steve Good wrote: Hello, I am looking for a solution to submit a form and instead of refreshing the whole page just refresh the contents of a div tag. Can anyone point me in the right direction? I tried jframes, but I can't figure out how to get the form to not open a new window. Thanks in advance! Let me know if more information is needed.
[jQuery] jQuery Firefox bug.
Hi! I have several links using jQuery that have only the purpose of showing help information. They are virtual links because they don't link anywhere (i.e. onclick = return false). When using jquery with these kinds of links, Firefox seems to ignore the return false sentence. Here's an example (works in IE 7, but not in Firefox 2): http://extranetdev.outsystems.net/jQueryTooltip/Sample.aspx Can you please help me on this? Cheers, Mário
[jQuery] Re: $.ajaxFileUpload into an ajax form
hi Yılmaz thanks for the reply.. I followed your (good) advice with some change. This is what i did: 1- deleted the url:' option from ajaxFileUpload function, so my php file is called rightly once; 2- when i call the jquery $.ajax function i clone the input created from the $.ajaxFileUpload into my form 3- all my data are sent to the php script and that's perfect but..using jquery apparently i cannot specify that i have a $_FILES['myInputFile'] into the data option (If i get as $_POST it's ok). I specified processData as false between the $.ajax optoin but with no use. any idea why? Vitto deleted On Feb 21, 10:39 am, Yılmaz Uğurlu [EMAIL PROTECTED] wrote: I am using this plugin just like that. form ... ... my other form elements p label for=fileToUploadChoose File :/label input id=fileToUpload type=file name=fileToUpload / input type=button id=upload_btn value=Upload! onclick=ajaxFileUpload(); / /p ... other elements, my form is huge :) /form ajaxFileUpload() does not need to be posting your form. It's already creating iframe and posting file over this element. So, you can use like this, i am using with no problem. 2008/2/20, hcvitto [EMAIL PROTECTED]: hi i'm using the ajaxfileupload plugin from this site http://www.phpletter.com/Our-Projects/AjaxFileUpload/(which works great) in a form with different kind of input file. The form is ajaxed through the $.ajax jquery function. Following the form submitting is a mail with the data from the form. Problem: i use the '$.ajax' and the '$.ajaxFileUpload' on the same form which calls for the same php file, which is now called twice, once per function. So everytime i submit the form two mails are sent, one with the data the other with the file attached. How can i integrate the ajaxfileupload in my form? anyone does know this plugin? Thanks Vitto this is my form submit ajax function: $.ajax({ type: POST, url: curriculumInvio.php, data: myData, success: function(){ myFunction } }); this is the plugin ajax function: $.ajaxFileUpload({ url:'curriculumInvio.php', secureuri:false, fileElementId:'fileToUpload', dataType: 'json', success: function (data, status){ plugin stuff, } }); -- Yılmaz Uğurlu ~ jabber : [EMAIL PROTECTED] ~http://www.2nci.com~ İzmir
[jQuery] Re: Is this bug in jquery???
IE6 and older only supports hover on anchor (a). IE7 does support hover on all elements, but only if you are not in quirks mode. On Feb 21, 12:52 pm, fshuja [EMAIL PROTECTED] wrote: i am using jquery version 1.2.3. I was trying to attach hover on area inside map. but find that its working ok in FF but not in IE. when i try to set area onmouseover= then it works for both IE n FF. is this the bug?? If IE supports onmouseover event for area tag inside map tag then hover should work. thnx Faraz
[jQuery] Finding a matching class to a variable
Hi there, Here is my conundrum, im trying select a div whos class matches that of a variable ($i) so that I can then apply an effect to it. The div actually has two classes attached to it but only 1 matches the variable (if that makes sense). I've tried such things as $ (div[class*=$i]) amongst other things but haven't had any luck. I'm still pretty new to jQuery but managing to get my head around the basics at least. Any help/pointers would be greatly appreciated. Philip
[jQuery] jquery hover in ie
Hi, I have a small problem when using the hover effect in ie (6 and 7) When hover is applied to the area tag (hotspots in an image map) it doesn't seem to fire the events, but mouseover and mouseout do (which I ultimately used to solve the problem). so area.hover( function() {alert(on)},function() {alert(off)}); didn't work but area.mouseover( function() {alert(on)}); area.mouseout( function() {alert(off)}); did work. Any ideas? Thanks, Jarrod
[jQuery] Re: Tool tip advice
You can try Simple Tooltip, for create simple and unobtrusive tooltips : http://www.pierrebertet.net/projects/jquery_simpletooltip/ It detects window borders, and has no limitations for design and structure, because any element can be a tooltip. The documentation is only in french for the moment, sorry :/ On 22 fév, 15:44, tlphipps [EMAIL PROTECTED] wrote: Are you asking for a plugin recommendation? If so, I know the tooltip plugin (http://plugins.jquery.com/project/tooltip) detects the browser border and avoids it. On Feb 21, 3:08 pm, Mark [EMAIL PROTECTED] wrote: Hey all, the design team here has a grid/table layout, with each image in a cell causing a tooltip style popup. Ok so, no worried so far, BUT, for the last column, the tool tip flips it's orientation so it doesn't display over the page border. So image a 2x4 table, which images in each cell. Each image will have the mouse over event to trigger the tooltip. The tool tip itself has graphical borders with live text, just to make things easier. I'm going to make the assumption that the tooltip doesn't float, or folow the mouse, but rather it's in a fixed position, which is relevent to the cell that has the image. Any recommendations?
[jQuery] Re: blockUI: moving the message that blocks an element to the top
Thanks again Mike. I needed to change DOCTYPE tags in order to make it work appropriately. -Alan On Feb 20, 6:06 pm, Mike Alsup [EMAIL PROTECTED] wrote: Thanks Mike. You definitely provided a solution that should work. But the following code works if I modify your test page, but not in my page. It moves to the left, but not up. Anyone have ideas how to debug why IE7 is ignoring the top margin? -Alan $.blockUI.defaults.elementMessageCSS = $.extend({}, $.blockUI.defaults.elementMessageCSS); $.extend($.blockUI.defaults.elementMessageCSS, { margin: '-125px 0 0 -125px' }); $('#test').block(Loading, please wait...); Can you post a link?
[jQuery] What's the meaning of underlying elements in focus()
Hello all! I read Note that this does not execute the focus method of the underlying elements. of focus() in jq' doc ,but I couldn't catch the meaning of underlying elements . Anyone may tell me which elements is underlying elements, Thanks
[jQuery] $_FILES and $.ajax function
hi i'm trying to send a file uploaded thourgh a form to a php file with $.ajax function. In my php file i can grab the value of the file type input only if i use tha $_POST method; if i use $_FILES nothing happens. Does anyone know whether jquery $.ajax function supports this type of data in the data otpion? How do i do this? I tried with processData: false with no use.. Thanks Vitto
[jQuery] Re: Div Changer Using Hide And Show
good tips so far. I just wanted to add that using classes and ids works well. a href=# id=blackbook class=showshow blackbook/a a href=# id=redbook class=showshow redbook/a div class=book hidden id=blackbook-contentblackbook stuff.../ div div class=book hidden id=redbook-contentredbook stuff.../div This makes your click function simpler. $('a.show').click(function(){ hide_divs(); var x = $(this).attr('id'); $('#'+ x + '-content').show('fast'); return false; }); The hide_divs method is also a bit simpler. var hide_divs = function(){ $('div.book').hide('fast'); }; You might notice that the div has a hidden class. This just makes initialization simpler, since the items are hidden on page load. The css would be something like: div.hidden { display: none; } -j On Feb 22, 4:02 am, andrea varnier [EMAIL PROTECTED] wrote: On 21 Feb, 23:03, Sientz [EMAIL PROTECTED] wrote: $('a#blackbook').click(function() { //HIDE DIVS hide_divs(); //SHOW LISTED DIV $('.blackbook').show('fast'); return false; }); you see you got all these functions that basically do the same thing. if an anchor has an id, they show the corresponding div I think you could do it like this $('a[id]').click(function(){ hide_divs(); var x = $(this).attr('id'); $('div[class= + x + ]').show('fast'); return false; }); and should do the same thing. but you could go further, and use classes in a different way. let's say that instead of calling them divs with 'human' names, we can use more 'efficient' names, like: hs_a hs_b hs_c hs_d ... where hs stands for hide/show (just an example). in this way the function hide_divs becomes something like var hide_divs = function(){ $('div[class^=hs]').hide('fast'); /* this selector looks for the div(s) that have a classname that starts with the string 'hs' */ }; then you give corresponding id's to the anchors, so the other on I wrote before: $('a[id^=hs]').click(function(){ hide_divs(); var x = $(this).attr('id'); $('div[class= + x + ]').show('fast'); return false;});
[jQuery] Loading html does not add it to the DOM
I have a simple ajax load which brings in an external form - at the moment it's just a simple input box with 2 buttons, a save and cancel, however whenever I press any input button within the called form JQuery just doesn't seem to recognise it. Loading my external HTML form, and pressing on its input buttons should produce an alert message, but instead just goes to the page. How do I make jQuery recognise the form, add it to the DOM and work with it? [code] !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en head titleBasic test/title meta http-equiv=Content-type content=text/html; charset=utf-8 / script type=text/javascript /* ![CDATA[ */ $(document).ready(function() { // default the div to be hidden and empty. $(#detail).hide().empty(); // this loads an external file, and fades it into view. $(.box a).click(function(event){ event.preventDefault; var href = $(this).attr('href'); $(#detail).fadeIn(500).addClass(editbox); $(#detail).load(href); return false; }); // this will produce an alert message whenever you press // on any input button. $(input).click(function(event){ event.preventDefault; alert(cancel); return false; }); }); /* ]] */ /script body p class=box a href=editor.htmShow External Form in Detail Div/a /p div id=detail/div form action=# method=post input type=submit value=Save / input type=button id=cancel value=Cancel / /form /body /html [/code] Okay, and now my external form, [code] form name=editorForm id=editorForm method=post action=# p label for=itemItem: br / input type=text id=item name=item value= / /label /p p input type=submit value=Save / input type=button id=cancel value=Cancel / /p /form [/code] All I want is this; 1. Press on link to grab an external HTML file and load into a div 2. Jquery recognises the external forms input buttons. How do I best accomplish this?
[jQuery] Div Changer Script Using Show and Hide
I was just wondering if someone could give this a quick look and see if there is anything wrong with it. It seems to be working on the web site but perhaps there is something I could do to make it more efficient. $(document).ready(function(){ //THIS HIDES ALL LISTED DIVS ON LOADING OF PAGE $('div.blackbook').hide(); $('div.canvas').hide(); $('div.pencil').hide(); $('div.murals').hide(); $('div.shows').hide(); $('div.tattoos').hide(); $('div.miscellaneous').hide(); $('a#blackbook').click(function() { //HIDE DIVS hide_divs(); //SHOW LISTED DIV $('.blackbook').show('fast'); return false; }); $('a#canvas').click(function() { //HIDE DIVS hide_divs(); //SHOW LISTED DIV $('.canvas').show('fast'); return false; }); $('a#pencil').click(function() { //HIDE DIVS hide_divs(); //SHOW LISTED DIV $('.pencil').show('fast'); return false; }); $('a#murals').click(function() { //HIDE DIVS hide_divs(); //SHOW LISTED DIV $('.murals').show('fast'); return false; }); $('a#shows').click(function() { //HIDE DIVS hide_divs(); //SHOW LISTED DIV $('.shows').show('fast'); return false; }); $('a#tattoos').click(function() { //HIDE DIVS hide_divs(); //SHOW LISTED DIV $('.tattoos').show('fast'); return false; }); $('a#miscellaneous').click(function() { //HIDE DIVS hide_divs(); //SHOW LISTED DIV $('.miscellaneous').show('fast'); return false; }); }); //HIDES ANY VISIBLE DIVS hide_divs = function() { //HIDE ANY VISIBLE DIVS BEFORE CONTINUING if ($('div.main').is(':visible')) { $('div.main').hide('fast'); } if ($('div.blackbook').is(':visible')) { $('div.blackbook').hide('fast'); } if ($('div.canvas').is(':visible')) { $('div.canvas').hide('fast'); } if ($('div.pencil').is(':visible')) { $('div.pencil').hide('fast'); } if ($('div.murals').is(':visible')) { $('div.murals').hide('fast'); } if ($('div.shows').is(':visible')) { $('div.shows').hide('fast'); } if ($('div.tattoos').is(':visible')) { $('div.tattoos').hide('fast'); } if ($('div.miscellaneous').is(':visible')) { $('div.miscellaneous').hide('fast'); } } Any comments would be appreciated.
[jQuery] Re: How could I pass an object into an eval statement
Yeah, I have been using them. Just had no idea setTimeout could take them. :) Thanks! On Feb 22, 2:01 am, Karl Rudd [EMAIL PROTECTED] wrote: Welcome to the wonderful world of closures (which double as functions in JavaScript), you've been using them already (perhaps without know it) :). The setTimeout function will actually take a function rather than a string (which it then 'eval's): function someFunction( obj ) { var message = obj.find('#message'); setTimeout( function() { message.fadeOut( 'slow', function() { $(this).remove(); } ); } , 5000 ); }; Some further reading on the subject of closures (the first few links from a Google search for javascript closures): http://www.jibbering.com/faq/faq_notes/closures.html http://blog.morrisjohns.com/javascript_closures_for_dummies Karl Rudd On Fri, Feb 22, 2008 at 6:20 AM, AsymF [EMAIL PROTECTED] wrote: For instance, say a function is passed an object and that function is supposed to set an event to fire on a timeout, how would I do it? Even more complicated, how would I do it if I needed to perform the action on a sub-selection of the object passed? If I wanted to do this and I have just id's, then I could do the following: setTimeout($(#' + obj.id + #message').fadeOut('slow', function () {$(this).remove();});, 5000); But what if the object passed doesn't have an id?
[jQuery] How to use Jquery with other Frameworks?
How can i reach the functions that are inside the main Jquery function for example: function dothis(){ doSomething(); } $(document).ready(function(){ function doSomething(){ $(# + spiel0).css({zIndex :5 } }); the reason i do this is because the dothis() function wont run insisde $(document).ready(function() any Ideas?
[jQuery] submit
I would like to have a
[jQuery] Re: xml webservice callback document.domain
on further investigation it actually is calling the error handler and giving a parsererror. For now I just check the browser and if FF do text datatype, xml for all others. a crummy workaround but i guess it will do. On Feb 21, 12:48 pm, Scott Vickers [EMAIL PROTECTED] wrote: I am trying to call a .net webservice with a get and no parameters. It is returning a simple xml doc with a single string element like this: ?xml version=1.0 encoding=utf-8? string xmlns=http://www.mysite.com/; blahblah /string /xml here is the jquery code I am using: $.ajax({ type:GET, dataType: xml, url:$link.attr('href'), contentType: application/x-www-form-urlencoded, data: {useSsl:useSsl}, success: function(data){ var res = $('string',data).text(); $('#' + dest).html(res); }, error: function(data){ ShowErrorMessage(dest); } }); This works great in all browsers EXCEPT on pages where document.domain=mysite.com; is set. It seems if the datatype is set to xml on the pages in question the success callback is never fired in firefox, no js errors show up in firebug either and IE works as expected. If I change the datatype to text and then in the callback make it: var res=$(data).text(); it works wonderful in firefox, but only comes up with a blank string in IE doh! any suggestion on how to make it work? we currently require the document.domain setting because of iframing some 3rd party content. any help is appreciated, this is driving me crazy.
[jQuery] Re: Tool tip advice
I looked at that, but it's not the browser border i need, it's the page with border (currently page width is set to 950px). I'll look at it again though, cheers. M On Feb 22, 9:44 am, tlphipps [EMAIL PROTECTED] wrote: Are you asking for a plugin recommendation? If so, I know the tooltip plugin (http://plugins.jquery.com/project/tooltip) detects the browser border and avoids it. On Feb 21, 3:08 pm, Mark [EMAIL PROTECTED] wrote: Hey all, the design team here has a grid/table layout, with each image in a cell causing a tooltip style popup. Ok so, no worried so far, BUT, for the last column, the tool tip flips it's orientation so it doesn't display over the page border. So image a 2x4 table, which images in each cell. Each image will have the mouse over event to trigger the tooltip. The tool tip itself has graphical borders with live text, just to make things easier. I'm going to make the assumption that the tooltip doesn't float, or folow the mouse, but rather it's in a fixed position, which is relevent to the cell that has the image. Any recommendations?
[jQuery] [validate] maxLength for elements that are not required
Hey Jörn, It seems that whenever I define an element as not required:false and set a maxLength the validation plugin wouldn't bother limiting the field to the maxLength, When I switch to required:true - everything works perfectly. Is there a solution to that? Thanks, Yuval Karmi
[jQuery] autocomplete help - make another ajax call when results picked?
I'm using Jorn's Autocomplete plugin and am successfully using it to return a list of users along with a user_ID. What I'd like to do now is when the user selects a person from the autocomplete list - via Ajax take that user_ID, populate a table in my database and return another value . Right now I have: $(#personIDdisplay).result(function(event, data, formatted) { if (data) $('#personID').val(data[1]); }); This populates a hidden field (personID) with the value returned via autocomplete. What I'd like to do is instead that that value (data[1]) and use it to make another Ajax call to run a query and then return another value - but now sure exactly how to do that? :) Is it just a matter of sticking in a ajax call and doing something like this?? (psuedo code) $(#personIDdisplay).result(function(event, data, formatted) { if (data) $.ajax({ url: dosomething.cfm, data: id = .val(data[1]) , success: function (data) { $('#personID').val(data); } }); I'm off to tinker but any feedback would be appreciated! Thanks, Jim
[jQuery] Dynamic Script Tag n code!!!
how can i insert dynamic script tag inside the head tag like script language=javascript function test(){ alert('hello'); } /script i want to add the above code in Head dynamically and also want test method working i tried to add script tag inside the head but it does not do so rather i can add any other tag like div, span etc thnx
[jQuery] What's the meaning of underlying elements in focus()
Hey all ! I read This causes all of the functions that have been bound to the focus event to be executed. Note that this does not execute the focus method of the underlying elements. in focus() of jQuery's document. But I couldn't catch the meaning of underlying elements. Anyone may tell me which element is underlying elements? Thanks.
[jQuery] Why does it take so long for a new topic to be posted?
Why does it take so long for a new topic to be posted? It really is frustrating esp, if you want answers to questions.
[jQuery] How can I Use Jquery without $(document).ready
Hello everyone, Can someone please tell me how can i use Jquery outside the function $ (document).ready(function(){ ... }); Because I have some functions that build my HTML page that wont run if i put them inside this function. thank you in advanced Rodolfo
[jQuery] jQuery Form Plugin help
hi i'm trying to use the jQuery Form Plugin from http://www.malsup.com/jquery/form/ it's apparently easy to use but at my first try i can't make anything out of it!! this is the page i'm working on http://www.eco-way.it/projects-and-communication/extra/curriculum.php In my comuni.js i use $('#formCurriculum').submit(function() { $(this).ajaxSubmit(); return false; }); pretty simple but when i submit nothing shows in firebug and less with my php file. Any help out there? thanks vitto
[jQuery] Re: jqModal using jqmShow instead of trigger gives problems
I have found that if you want JS to be applied to or run from the loaded page, it is better to account for that outside the page... i.e. I include functions on my normal JS library the dialog may make use of. It seems that loading Dialogs that include JS (includes or source) is somewhat hit and miss. I've been able to get it sometimes, but not others. So I just avoid the issue now outright and have my main page load the JS libraries, and then trigger from an appropriate event, or before/after I call the dialog. Kinda nebulous I know, but hope it helped. Shawn Tom wrote: Well I seem to have been able to fix this. Still now 100% sure what the problem was though! I originally had some header footer info in the html page to be ajaxed into the modal window. I had it set up this way as I ahd hope dto allow uses with JS disabled to redirect to the page when the Modal version failed. I removed this as I was doing some code clean up and now my problem is fixed. I assume that some of that code was causing interference on the second display. Has anyone any nuggets of knowledge they can share about this behaviour? Cheers Tom On Feb 22, 3:37 pm, Tom [EMAIL PROTECTED] wrote: Hi I use the following function to open modal windows by passing the correspondingly ID html url . function jqmWindow(div_id , page){ $('div_id).jqm({ //trigger: '#edit', ajax: page, target: false, modal: true, /* FORCE FOCUS */ onHide: function(h) { h.o.remove(); // remove overlay h.w.fadeOut(444); // hide window }, overlay: 10 }).jqmShow(); } I use .jqmShow to open the window instead of the trigger which I have commented out. The modal window opens and then I close it again by clicking a button with class='jqmClose' associated to it. If I try to open the same modal window a second time it fails to work and I get this error from firebug. H[this._jqm] has no properties jquery.jqModal.js (line 34) $.fn.jqmShow=function(t){return this.each(function(){if(! H[this._jqm].a)$.jqm.open(this._jqm,t)});}; What am I doing wrong? I am using version * $Version: 2007.08.17 +r11 Cheers Tom
[jQuery] Re: I am looking for the datagrid which supports row/column merging and JSON
Cool! Thank jquertil! On Feb 21, 9:50 pm, jquertil [EMAIL PROTECTED] wrote: tablesorter.com comes to mind. On Feb 21, 6:10 am, Channa L. [EMAIL PROTECTED] wrote: Hi All, I am looking for the good jsdatagridwhich supports AJAX column sorting, row/column merging (rowspan/colspan), and JSON. Does anyone know where I can find suchdatagrid? Thanks, Channa- Hide quoted text - - Show quoted text -
[jQuery] Re: Selecting the ancestor of an element
If I do the following I end up with every single DIV all the way up the document chain being prepended with the content instead of its immediate parent: var msg_selector = $($(childObj).parent().get(0).tagName + ':has(#' + childObj.id + ')') $(msg_selector).prepend('div id=result_messageResult Processed/ div'); What this is used for is that when a link is clicked it sends AJAX data. If the data was processed remotely it is supposed to show a simple success message at the top of the parent DIV it is located in. Any idea what I am doing wrong? On Feb 22, 6:32 am, Richard D. Worth [EMAIL PROTECTED] wrote: I'm not sure I understand what you're trying to get at. If you have an element (childObj), it has only one parent, $(childObj).parent(). Perhaps you want to provide some more context if I'm not getting it? - Richard On Thu, Feb 21, 2008 at 3:48 PM, AsymF [EMAIL PROTECTED] wrote: How would I select the parent that ONLY has that child? For instance, the following selects too many parents: $($(childObj).parent().get(0).tagName + ':has(#' + childObj.id + ')') On Feb 21, 2:25 pm, Richard D. Worth [EMAIL PROTECTED] wrote: See http://docs.jquery.com/Traversing/parent#expr http://docs.jquery.com/Traversing/parents#expr - Richard On Thu, Feb 21, 2008 at 12:33 PM, AsymF [EMAIL PROTECTED] wrote: How would I select the ancestor or parent of an element?
[jQuery] Refresh div
Hoping to get a little help since I know very little jquery and ajax. I am developing a site in drupal where I have an ad on just about every page and it currently refreshes on every page load with a different ad. I need the ad to reload every 5 seconds. I am sure this is possible with jquery. I have been trying to find a tut to do this but have been unsuccessful, hopefully someone can help me out with this. The currently exported code on the pages is this: div class='view view-global-header-ad'div class='view-content view- content-global-header-ad' div class=advertisement id=group-nids-118119120121122123script type=text/javascript src=http://localhost/modules/ad/serve.php? q=amp;n=118,119,120,121,122,123/script/div /div/div Is there a way I can just refresh this code? Thanks X3
[jQuery] Call a function just before the window close
Hello folks, Probably this is a dumb question, but I'm not a javascript developer (yet), so be patience with me! :P How can I call a function just before the window close? When the user click the close button of the window I want to execute some tasks. Can I do that?
[jQuery] Re: Can't Add a checked=checked Attribute to Input tag
Yes I did. Strangely enough, what I initially wrote worked in a simply HTML page without much else going on. I may have to parse thru the page that I'm working on to find if there is some sort of conflict. Thanks! On Feb 22, 1:37 am, Karl Rudd [EMAIL PROTECTED] wrote: Have you tried $(...).attr( 'checked', true ) ? Karl Rudd On Fri, Feb 22, 2008 at 9:56 AM, Joe [EMAIL PROTECTED] wrote: Very simply, I want this function to attach the attribute checked=checked to the input with the id=ext[agree]Y. The following code does not do this and I'm not sure why... $(ext\\[agree\\]Y).attr(checked, checked); Any help or ideas is greatly appreciated. Other ways of doing this would be great as well. I just want to add this upon form submission. Thanks.
[jQuery] [treeview] Ajax loaded nodes
I'm using jQuery 1.2.2, and treeview 1.4, and I've read as much as I could find on treeview. I can't seem to find, however, a demo on loading specific nodes with dynamic data when they are expanded. The async demo doesn't necessarily show how to do that, either, unless it's a full tree load. Am I missing something?
[jQuery] Re: before() and after() does not work on unclosed tags?
John, I had simplified my example, sorry. From what I gather, wrap() won't work for this kind of table: tabletr class=headtdgeneric header stuff/td/tr tr class=main/td...now wrap this.../td/tr/table John Resig wrote: I think you want .wrap():
[jQuery] Re: Selecting the ancestor of an element
Then it looks like you want $(childObj).parent().prepend('div id=result_messageResult Processed/div'); That will get you the 1 immediate parent of that element. - Richard On Fri, Feb 22, 2008 at 11:49 AM, AsymF [EMAIL PROTECTED] wrote: If I do the following I end up with every single DIV all the way up the document chain being prepended with the content instead of its immediate parent: var msg_selector = $($(childObj).parent().get(0).tagName + ':has(#' + childObj.id + ')') $(msg_selector).prepend('div id=result_messageResult Processed/ div'); What this is used for is that when a link is clicked it sends AJAX data. If the data was processed remotely it is supposed to show a simple success message at the top of the parent DIV it is located in. Any idea what I am doing wrong? On Feb 22, 6:32 am, Richard D. Worth [EMAIL PROTECTED] wrote: I'm not sure I understand what you're trying to get at. If you have an element (childObj), it has only one parent, $(childObj).parent(). Perhaps you want to provide some more context if I'm not getting it? - Richard On Thu, Feb 21, 2008 at 3:48 PM, AsymF [EMAIL PROTECTED] wrote: How would I select the parent that ONLY has that child? For instance, the following selects too many parents: $($(childObj).parent().get(0).tagName + ':has(#' + childObj.id + ')') On Feb 21, 2:25 pm, Richard D. Worth [EMAIL PROTECTED] wrote: See http://docs.jquery.com/Traversing/parent#expr http://docs.jquery.com/Traversing/parents#expr - Richard On Thu, Feb 21, 2008 at 12:33 PM, AsymF [EMAIL PROTECTED] wrote: How would I select the ancestor or parent of an element?
[jQuery] Re: preventDefault() not working in FF?
TT thanks a lot! for this - it works. Interesting comparison: the jQuery version of my dragger is 23 lines of code inluding all callbacks. The plain javascript version is 22 lines (but, alas, doesnt require the jQuery library of course). I also notice that while dragging, especially in firefox, the motion is a bit choppy compared to the plain javascript version. It looks like the jquery in this particualr case doesn't really offer an advantage. Next, I will try to figure out how to use the plain javascript version and make it into a plugin. I'm having problems with the document.mousemove event (what else is new).
[jQuery] Treeview Ajax Loaded Nodes?
I'm using jQuery 1.2.2, and treeview 1.4, and I've read as much as I could find on treeview. I can't seem to find, however, a demo on loading specific nodes with dynamic data when they are expanded. The async demo doesn't necessarily show how to do that, either, unless it's a full tree load. Am I missing something?
[jQuery] trying to parse XML
hey folks, could you look at this site: http://craniumdesigns.com/new/ and tell me why my xml isnt parsing on the portfolio area? i'm just trying to have SOME sort of output. once it works i want to generate all the portfolio images/info as li tags. the code is in the top of index.html for easy viewing. i'm very new to jquery and not really sure what i'm doing wrong.
[jQuery] Re: autocomplete help - make another ajax call when results picked?
Looks like you're on the right track to me. That's how I would do it. On Feb 22, 11:59 am, Priest, James (NIH/NIEHS) [C] [EMAIL PROTECTED] wrote: I'm using Jorn's Autocomplete plugin and am successfully using it to return a list of users along with a user_ID. What I'd like to do now is when the user selects a person from the autocomplete list - via Ajax take that user_ID, populate a table in my database and return another value . Right now I have: $(#personIDdisplay).result(function(event, data, formatted) { if (data) $('#personID').val(data[1]); }); This populates a hidden field (personID) with the value returned via autocomplete. What I'd like to do is instead that that value (data[1]) and use it to make another Ajax call to run a query and then return another value - but now sure exactly how to do that? :) Is it just a matter of sticking in a ajax call and doing something like this?? (psuedo code) $(#personIDdisplay).result(function(event, data, formatted) { if (data) $.ajax({ url: dosomething.cfm, data: id = .val(data[1]) , success: function (data) { $('#personID').val(data); } }); I'm off to tinker but any feedback would be appreciated! Thanks, Jim
[jQuery] Re: preventDefault() not working in FF?
Did you see my recent thread here? My experience has been nightmarish. On Feb 22, 12:47 pm, jquertil [EMAIL PROTECTED] wrote: TT thanks a lot! for this - it works. Interesting comparison: the jQuery version of my dragger is 23 lines of code inluding all callbacks. The plain javascript version is 22 lines (but, alas, doesnt require the jQuery library of course). I also notice that while dragging, especially in firefox, the motion is a bit choppy compared to the plain javascript version. It looks like the jquery in this particualr case doesn't really offer an advantage. Next, I will try to figure out how to use the plain javascript version and make it into a plugin. I'm having problems with the document.mousemove event (what else is new).
[jQuery] Re: Call a function just before the window close
there is an onbeforeunload event you can use http://www.google.com/search?q=javascript+onbeforeunloadie=utf-8oe=utf-8aq=trls=org.mozilla:en-US:officialclient=firefox-a
[jQuery] Re: Div Changer Using Hide And Show
This is quite generalized and is bookmarkable... - http://enure.net/dev/hide-all-except-one/ On Fri, Feb 22, 2008 at 6:50 AM, J Moore [EMAIL PROTECTED] wrote: good tips so far. I just wanted to add that using classes and ids works well. a href=# id=blackbook class=showshow blackbook/a a href=# id=redbook class=showshow redbook/a div class=book hidden id=blackbook-contentblackbook stuff.../ div div class=book hidden id=redbook-contentredbook stuff.../div This makes your click function simpler. $('a.show').click(function(){ hide_divs(); var x = $(this).attr('id'); $('#'+ x + '-content').show('fast'); return false; }); The hide_divs method is also a bit simpler. var hide_divs = function(){ $('div.book').hide('fast'); }; You might notice that the div has a hidden class. This just makes initialization simpler, since the items are hidden on page load. The css would be something like: div.hidden { display: none; } -j On Feb 22, 4:02 am, andrea varnier [EMAIL PROTECTED] wrote: On 21 Feb, 23:03, Sientz [EMAIL PROTECTED] wrote: $('a#blackbook').click(function() { //HIDE DIVS hide_divs(); //SHOW LISTED DIV $('.blackbook').show('fast'); return false; }); you see you got all these functions that basically do the same thing. if an anchor has an id, they show the corresponding div I think you could do it like this $('a[id]').click(function(){ hide_divs(); var x = $(this).attr('id'); $('div[class= + x + ]').show('fast'); return false; }); and should do the same thing. but you could go further, and use classes in a different way. let's say that instead of calling them divs with 'human' names, we can use more 'efficient' names, like: hs_a hs_b hs_c hs_d ... where hs stands for hide/show (just an example). in this way the function hide_divs becomes something like var hide_divs = function(){ $('div[class^=hs]').hide('fast'); /* this selector looks for the div(s) that have a classname that starts with the string 'hs' */ }; then you give corresponding id's to the anchors, so the other on I wrote before: $('a[id^=hs]').click(function(){ hide_divs(); var x = $(this).attr('id'); $('div[class= + x + ]').show('fast'); return false;});
[jQuery] Re: Why does it take so long for a new topic to be posted?
I think Google had some gas. There was a giant burp of messages a short while ago. On Feb 22, 8:41 am, gh0st [EMAIL PROTECTED] wrote: Why does it take so long for a new topic to be posted? It really is frustrating esp, if you want answers to questions.
[jQuery] How do I use my functions with jQuery syntax alike?
Hi, Let's say I have 2 different javascript files. I like to organize my code that's why I use 2 different files so each file will only have functions that fall into that file's category. Anyway, here's the files layout... file1.js: function Fn1() { ... } function Fn2(a, b) { ...} file2.js function FnX(a, b, c) { ... } function FnY(a, b) { ... } function FnZ(a) { ... } How can I call those functions in a syntax like this: $.groupName.Fn1(); $.groupName.Fn2('text', 123); or jQuery.groupName.FnZ(true); How do I do this? P.S: I've read the plugins authoring documentation page but I'm still confused and I don't know how to achieve this, please advise...
[jQuery] Re: How do I use my functions with jQuery syntax alike?
On Feb 23, 12:14 am, Nazgulled [EMAIL PROTECTED] wrote: Hi, Let's say I have 2 different javascript files. I like to organize my code that's why I use 2 different files so each file will only have functions that fall into that file's category. Anyway, here's the files layout... file1.js: function Fn1() { ... } function Fn2(a, b) { ...} file2.js function FnX(a, b, c) { ... } function FnY(a, b) { ... } function FnZ(a) { ... } How can I call those functions in a syntax like this: $.groupName.Fn1(); $.groupName.Fn2('text', 123); or jQuery.groupName.FnZ(true); How do I do this? P.S: I've read the plugins authoring documentation page but I'm still confused and I don't know how to achieve this, please advise... Something like: $.groupName = $.groupName || {}; $.extend($.groupName, { Fn1: function() { ... }, Fn2: function(a, b) { ... } }); --Klaus
[jQuery] $.( 'a:link' )
This has to be obvious - but I can't find it! I'm trying to have a script restyle the a:links. Using the CSS name (which is, precisely, #nav a:link) doesn't get a result. It does if I take the :link part off, but that overrides the child styles. Seeing as link isn't a DOM element, I've tried all sorts of combinations without success can somebody please tell me the one I haven't tried, that works? Thanks, Cherry.
[jQuery] Re: How do I use my functions with jQuery syntax alike?
Thanks... And what's up with the: (function($) { // CODE })(jQuery); This was the thing that got me most confused when reading the documentation. Can someone explain me this, what it does, what is for and the best scenarios where would I need to use something like this? If possible, explain me like I was really dumb :P Klaus Hartl wrote: On Feb 23, 12:14�am, Nazgulled [EMAIL PROTECTED] wrote: Hi, Let's say I have 2 different javascript files. I like to organize my code that's why I use 2 different files so each file will only have functions that fall into that file's category. Anyway, here's the files layout... file1.js: function Fn1() { ... } function Fn2(a, b) { ...} file2.js function FnX(a, b, c) { ... } function FnY(a, b) { ... } function FnZ(a) { ... } How can I call those functions in a syntax like this: $.groupName.Fn1(); $.groupName.Fn2('text', 123); or jQuery.groupName.FnZ(true); How do I do this? P.S: I've read the plugins authoring documentation page but I'm still confused and I don't know how to achieve this, please advise... Something like: $.groupName = $.groupName || {}; $.extend($.groupName, { Fn1: function() { ... }, Fn2: function(a, b) { ... } }); --Klaus
[jQuery] Re: Using getScript to load an array of scripts with callbacks
Anyone? On Feb 22, 6:01 pm, Nazgulled [EMAIL PROTECTED] wrote: I have this piece of code that took me a while to do it and I don't know if it's the best way to achieve this. First, I'll explain exactly what I want to do. I'm using lots of jQuery plugins and I don't want to include them all with script in the head of every html page. And I want to load these plugins for every page that needs them but I don't want to load plugins that some specific page isn't going to need. To load these plugins I'm using the jQuery built-in $.getScript() method and I want to use the callback to load the next script in succession. This way, I'll load one script at a time, meaning, the second script will only start to load when the first finishes and so on. But, when the last plugin finishes loading, I want some other function to be called, in this sample initAdministratio(). Which is basically the function that will start all the required code by my application after all necessary scripts for that page are loaded. On this example, I have 3 plugins to load, and only 2 different pages. One of the plugins is used by both pages, the other two depend on the page to be load. One of the pages has a form with ID = form-login which needs the form plugin, while the other page is the main page and doesn't need the form plugin but needs the color plugin. Although I only have 2 pages on this example, I will probably have more in the future, a lots more. Some of them might need the same plugins as others which will make them fall in the same if() statement, while others don't and I will need to add an else if() statement. The last else statement will always be the default page to load. Meaning, if no specific page was found to load some specific plugins, then, just load the default ones. Now, the code: $.extend($.browser, browserVersion); var loadJSLibs = function(libsList) { var libName = libsList.shift(); var callback = function() { if (libsList.length 0) loadJSLibs(libsList); else initAdministratio(); } $.getScript(libsPath + libName + .js, callback); } if($('div#form-login').length) { var libsList = [ 'jquery.simplemodal', 'jquery.form' ];} else { var libsList = [ 'jquery.simplemodal', 'jquery.colors' ]; } loadJSLibs(libsList) Basically, I want to know if there's anyway to improve this piece of code, somehow. As I've told you before, I took a while to do it as I don't have much JS experience which will probably make me fail to see things that experience JS programmers would not.
[jQuery] Re: Problems in the overlay created by SimpleModal in IE6/7
Anyone? On Feb 21, 1:55 pm, Nazgulled [EMAIL PROTECTED] wrote: I don't know then, what I know is that on my Vista machine, IE7 is being recognized as IE6 and the code above fixed it. Anyway, I think I fixed the problem on IE6 and you were right after all, the code in your first reply fixed, I must have done something wrong before. But now, I'm having a problem with Opera :S If I open the demo page on your site and test it with Opera, it works well, but if I download the basic sample and test it on Opera, it doesn't quite work. The problem is, when you click to show the modal dialog, it shows fine. But after closing it, you will see something odd... Look at the screenshot, it shows what's happening after closing the dialog:http://img408.imageshack.us/my.php?image=operavu1.jpg On Feb 21, 5:30 am, Eric Martin [EMAIL PROTECTED] wrote: Strange...I have IE7 on Vista and it reports 7.0 for $.browser.version... On Feb 20, 7:56 pm, Nazgulled [EMAIL PROTECTED] wrote: After lots and lots of digging and testing I found something that fixed the problem in IE7. The thing was, jQuery has a bug on $.browser.version() and so, IE7 on Vista was being detected as IE6. Because of that the following was being executed: // fix issues with IE and create an iframe if ($.browser.msie ($.browser.version 7)) { this.fixIE(); } Of course, that fix is only for IE6 and if used on IE7, it doesn't fix anything, it breaks it. My workaround for this problem and for now, was to add the following code: var userAgent = navigator.userAgent.toLowerCase(); var browserVersion = { version: (userAgent.match( /.+?(?:rv|it|ra|ie) [\/: ]([\d.]+)/ ) || [])[1] }; $.extend($.browser, browserVersion); This will make the browser detection for IE7 under Vista working. Anyway, I still have the same issue but on IE6 and I don't know how to fix it yet... On Feb 20, 4:40 pm, Eric Martin [EMAIL PROTECTED] wrote: The problem can be solved with some body styles (and I think it only happens in IE6):http://www.ericmmartin.com/projects/simplemodal/#comment-265 body { margin: 0; padding: 0; width: 100%; height: 100%; } -Eric On Feb 20, 4:50 am, Nazgulled [EMAIL PROTECTED] wrote: Hi, I don't know how many of you have used or useSimpleModalto create modal dialogs but I'm having a little issue that's happening in IE6/7. It works fine in Firefox and I don't see any reason to not work on IE. Maye you guys can help me find a workaround. I've created a sample here:http://nazgulled.clok.info/simplemodal/ The problem is in the overlay div create bySimpleModal(I think), you can easily see the problem in IE6/7 if you compare it to Firefox. I've downloaded all the samples onSimpleModalwebsite and tested them locally, the same problem happens. However, if I open the demo page onSimpleModalwebsite with IE6/7, all the examples work fine. And I don't get it because I have the same exact code! Hope someone can help me as this is getting me frustrated and I can't continue the development on my site without this fixed.
[jQuery] Re: How do I use my functions with jQuery syntax alike?
JavaScript has really expressive ways to call functions. The first parentheses hide the function (make it anonymous) and the second executes the code immediately with the parameter listed. I'm a newbie myself, but I think that means right now, pass the variable jQuery in as $ to the function and execute the code. On Feb 22, 4:06 pm, Nazgulled [EMAIL PROTECTED] wrote: Thanks... And what's up with the: (function($) { // CODE })(jQuery); This was the thing that got me most confused when reading the documentation. Can someone explain me this, what it does, what is for and the best scenarios where would I need to use something like this? If possible, explain me like I was really dumb :P Klaus Hartl wrote: On Feb 23, 12:14�am, Nazgulled [EMAIL PROTECTED] wrote: Hi, Let's say I have 2 different javascript files. I like to organize my code that's why I use 2 different files so each file will only have functions that fall into that file's category. Anyway, here's the files layout... file1.js: function Fn1() { ... } function Fn2(a, b) { ...} file2.js function FnX(a, b, c) { ... } function FnY(a, b) { ... } function FnZ(a) { ... } How can I call those functions in a syntax like this: $.groupName.Fn1(); $.groupName.Fn2('text', 123); or jQuery.groupName.FnZ(true); How do I do this? P.S: I've read the plugins authoring documentation page but I'm still confused and I don't know how to achieve this, please advise... Something like: $.groupName = $.groupName || {}; $.extend($.groupName, { Fn1: function() { ... }, Fn2: function(a, b) { ... } }); --Klaus
[jQuery] Re: How do I use my functions with jQuery syntax alike?
And what exactly it means to hide a function, making it anonymous? timothytoe wrote: JavaScript has really expressive ways to call functions. The first parentheses hide the function (make it anonymous) and the second executes the code immediately with the parameter listed. I'm a newbie myself, but I think that means right now, pass the variable jQuery in as $ to the function and execute the code. On Feb 22, 4:06 pm, Nazgulled [EMAIL PROTECTED] wrote: Thanks... And what's up with the: (function($) { // CODE })(jQuery); This was the thing that got me most confused when reading the documentation. Can someone explain me this, what it does, what is for and the best scenarios where would I need to use something like this? If possible, explain me like I was really dumb :P Klaus Hartl wrote: On Feb 23, 12:14�am, Nazgulled [EMAIL PROTECTED] wrote: Hi, Let's say I have 2 different javascript files. I like to organize my code that's why I use 2 different files so each file will only have functions that fall into that file's category. Anyway, here's the files layout... file1.js: function Fn1() { ... } function Fn2(a, b) { ...} file2.js function FnX(a, b, c) { ... } function FnY(a, b) { ... } function FnZ(a) { ... } How can I call those functions in a syntax like this: $.groupName.Fn1(); $.groupName.Fn2('text', 123); or jQuery.groupName.FnZ(true); How do I do this? P.S: I've read the plugins authoring documentation page but I'm still confused and I don't know how to achieve this, please advise... Something like: $.groupName = $.groupName || {}; $.extend($.groupName, { Fn1: function() { ... }, Fn2: function(a, b) { ... } }); --Klaus
[jQuery] Re: $.( 'a:link' )
On Feb 23, 1:05 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: This has to be obvious - but I can't find it! I'm trying to have a script restyle the a:links. Using the CSS name (which is, precisely, #nav a:link) doesn't get a result. It does if I take the :link part off, but that overrides the child styles. Seeing as link isn't a DOM element, I've tried all sorts of combinations without success can somebody please tell me the one I haven't tried, that works? a:link in CSS is basically the same as a[href], try: $('#nav a[href]') --Klaus
[jQuery] jQuery design pattern for dom.ready snippets
Hi there, I am going to be implementing jQuery on a very large enterprise level website, and have a few questions with regards to some best-practices for managing scripts. Where is the best place to include all of the initialization code for plugins? I'd like to keep everything external, but since the site is so large, I can't put all of the dom.ready initilizers inside of one big .js file (like jquery.com). I need to keep things split up for specific sections of the site, and if a plugin is only required for one specific page, do I create a new .js file just to run that specific initializer, or do I bite the bullet and stick it in the head of the page itself? I am trying to take advantage of browser- cache as much as possible, which also makes a global .js file unappealing since adding a snippet for one page would make browsers have to dump the cache across the board, even if they never visit that one page. Any suggestions or thoughts would be great, along with some examples of other large sites that handle this problem well. Thanks very much!
[jQuery] Re: jQuery Firefox bug.
If you remove the href (which has the postback), it will work in firefox.