Re: [jQuery] External or anonymous function - which is best?
Thanks, that makes sense. One more thing - after this code runs, is the resizeDiv function in the global namespace, in a persistant JQuery object, or garbage collected? - Original Message - From: "Jörn Zaefferer" <[EMAIL PROTECTED]> To: "jQuery Discussion." Sent: Thursday, January 25, 2007 4:37 PM Subject: Re: [jQuery] External or anonymous function - which is best? PragueExpat schrieb: > My question: is it better to define this function as above and pass "this" > or to define an anonymous function within the .each statement? I read that > the above method only has to compile the function once, as opposed to a > re-compile each time the (anonymous) function runs. What is the recommend > way of doing this? > I'd like to quote here: We *should* forget about small efficiencies, say about 97% of the time: premature optimizations is the root of all evil. - Donal E. Knuth We follow two rules in the matter of optimization: Rule 1. Don't do it. Rule 2 (for experts only). Don't do it yet - that is, not until you have perfectly clear and unoptimized solution. In other words: Write clean and succinct code! Something like this: $(function(){ function resizeDiv(){ var x = $(this); if(x.height() < 600){ x.css("height", 600); } }; $("#mydiv").each(resizeDiv); }); And in case you don't use that function anywhere else: $(function(){ $("#mydiv").each(function(){ var x = $(this); if(x.height() < 600){ x.css("height",600); } } ); }); The cleaner your code, the easier it is to optimize later, but only where really appropiate. Firebug's profiler is a great tool for that issue. -- Jörn Zaefferer http://bassistance.de ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] 1.0.4 bug - please confirm...
(Sorry if this is posted twice - tried through Nabble first but it wasn't sent) This page works with 1.0.3, but not 1.0.4 - it simply calls a javascript function on the focus event: Error returned is: "c[j].apply is not a function" Can someone confirm before I post a bug report? Copy / Paste the following: function myfunction(x){ alert(x); } ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Drop Down Menu
I modified the rb_menu to work as a nice drop down. You can see it at http://www.ibx.cz/bho - Original Message - From: "Olivier Percebois-Garve" <[EMAIL PROTECTED]> To: "jQuery Discussion." Sent: Wednesday, October 25, 2006 1:11 AM Subject: Re: [jQuery] Drop Down Menu > look at http://be.twixt.us/jquery/suckerFish.php > olivvv > > > [EMAIL PROTECTED] wrote: >> Hello there: >> >> Is there a reliable Drop-Down menu plug-in for JQuery? >> I've created a quick example here: *http://tinyurl.com/y4qsx5* >> So far, I cannot figure out how to postpone the SlideUp effect when the >> mouse goes over the drop down menu itself. >> Please help, thank you. >> >> Roso >> * >> * >> >> >> ___ >> jQuery mailing list >> discuss@jquery.com >> http://jquery.com/discuss/ >> >> > > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] HTML and XHTML
At the risk of sounding like a total noob, are there any situations with JQuery where XHTML is required (some DOM manipulation, maybe?) or do all functions/methods/plugins work in both HTML and XHTML? ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Mouseover/out + CSS background image behavior change in IE between r
That fixed it completely. Thank you very much! >From: EJ12N <[EMAIL PROTECTED]> >Reply-To: "jQuery Discussion." >To: discuss@jquery.com >Subject: Re: [jQuery] Mouseover/out + CSS background image behavior change >in IE between r >Date: Tue, 17 Oct 2006 18:56:18 -0700 (PDT) > > >Hello, I believe this is IE background-image flickering problem you are >experiencing... >http://evil.che.lu/2006/9/25/no-more-ie6-background-flicker > >In jQuery code... >//Stop IE flicker >if ($.browser.msie == true) { >document.execCommand('BackgroundImageCache', false, true); >} > >-EJ > > >Prague Expat wrote: > > > > Does JQuery try to refresh/reload any CSS on mouse events? In my >version > > of > > IE (with JQuery rev 413) every mouseover/out is causing all my CSS > > background images to quickly reload (but not quickly enough, as it is > > quite > > noticeable). I did not have this problem with rev 249 (I just updated >to > > 413 yesterday and noticed the strange behavior). > > > > One more thing: the dev PC at work does not show a problem with IE with > > either JQuery version. My home PC shows the problem with version 413 >only. > > At home, 249 works perfectly but fails as soon as I try the 413 version. > > > > Is it possible that the memory leak fixes (that I understand are in the > > updated JQuery) are causing quick refreshes on the CSS? > > > > Thanks for any insight. Feel free to email be w/questions. pragueexpat > > (at) > > hotmail.com > > > > code: > > > > $(document).ready(function(){ > > //remove anchors in menu table tds - replace w/bkimg > > $(".menuanchor").remove(); > > > > >$("#menutab1").css({backgroundImage:"url(i/about.jpg)",cursor:"pointer"}).rb_menu(); > > >$("#menutab2").css({backgroundImage:"url(i/practice.jpg)",cursor:"pointer"}).rb_menu(); > > >$("#menutab3").css({backgroundImage:"url(i/offices.jpg)",cursor:"pointer"}).rb_menu(); > > >$("#menutab4").css({backgroundImage:"url(i/tech.jpg)",cursor:"pointer"}).rb_menu(); > > >$("#menutab5").css({backgroundImage:"url(i/patients.jpg)",cursor:"pointer"}).rb_menu(); > > $(".links").click(function(){window.location=this.id+".php"}); > > $("#logo").click(function(){window.location="/bho/index.php"}); > > >$("#newsbody").height($("#contentcol2").height()-111+"px");});$.fn.rb_menu > > = function(options) {var self = this;this.options = {// > > transitions: easein, easeout, easeboth, bouncein, bounceout,// > > bounceboth, elasticin, elasticout, elasticbothtransition: > > 'easein',// trigger events: mouseover, mousedown, mouseup, >click, > > dblclicktriggerEvent: 'mouseover',// number of ms to > > delay before hiding menu (on page load)loadHideDelay : 500, > > // number of ms to delay before hiding menu (on mouseout) > > blurHideDelay: 500,// number of ms for transition effect > > effectDuration: 500}// make sure to check if options are given! > > if(options) {$.extend(this.options, options);}return > > this.each(function() {var menu = $("#drop"+this.id); > > menu.closed = true;menu.hide();menu.hide = function() { > > if(menu.css('display') == 'block' && !menu.closed) { > > menu.BlindUp(self.options.effectDuration, > > function() {menu.closed = true; > > menu.unbind();}, > > self.options.transition);} $(".dropmenu > > li").css("fontWeight","normal");}menu.show = function() >{ > > if(menu.css('display') == 'none' && menu.closed) { > > menu.BlindDown(self.options.effectDuration, > > function() {menu.closed = false; > > menu.hover(function() { > > clearTimeout(menu.timeout);}, function() { > > menu.timeout = setTimeout( function() { > > menu.hide();}, self.options.blurHideDelay); > > });},self.options.transition > > );} //highlight each li option on mouseover > > >$(".dropmenuli").mouseover(function(){$(this).css({fo
Re: [jQuery] Mouseover/out + CSS background image behavior changein IE between rev 249 and 413
Thanks for the information. I have posted a quick screencam of the problem here: using 249: http://www.ibx.cz/jq/old.htm using 413: http://www.ibx.cz/jq/new.htm The only difference between the two is the new version of JQuery. >From: "Brandon Aaron" <[EMAIL PROTECTED]> >Reply-To: "jQuery Discussion." >To: "jQuery Discussion." >Subject: Re: [jQuery] Mouseover/out + CSS background image behavior >changein IE between rev 249 and 413 >Date: Tue, 17 Oct 2006 12:45:00 -0500 > >On 10/17/06, Prague Expat <[EMAIL PROTECTED]> wrote: > > Is it possible that the memory leak fixes (that I understand are in the > > updated JQuery) are causing quick refreshes on the CSS? > >This is doubtful as the code that fixes the memory leak only runs at >unload. > >-- >Brandon Aaron > >___ >jQuery mailing list >discuss@jquery.com >http://jquery.com/discuss/ _ Get today's hot entertainment gossip http://movies.msn.com/movies/hotgossip?icid=T002MSN03A07001 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Mouseover/out + CSS background image behavior change in IE between rev 249 and 413
Does JQuery try to refresh/reload any CSS on mouse events? In my version of IE (with JQuery rev 413) every mouseover/out is causing all my CSS background images to quickly reload (but not quickly enough, as it is quite noticeable). I did not have this problem with rev 249 (I just updated to 413 yesterday and noticed the strange behavior). One more thing: the dev PC at work does not show a problem with IE with either JQuery version. My home PC shows the problem with version 413 only. At home, 249 works perfectly but fails as soon as I try the 413 version. Is it possible that the memory leak fixes (that I understand are in the updated JQuery) are causing quick refreshes on the CSS? Thanks for any insight. Feel free to email be w/questions. pragueexpat (at) hotmail.com code: $(document).ready(function(){ //remove anchors in menu table tds - replace w/bkimg $(".menuanchor").remove(); $("#menutab1").css({backgroundImage:"url(i/about.jpg)",cursor:"pointer"}).rb_menu(); $("#menutab2").css({backgroundImage:"url(i/practice.jpg)",cursor:"pointer"}).rb_menu(); $("#menutab3").css({backgroundImage:"url(i/offices.jpg)",cursor:"pointer"}).rb_menu(); $("#menutab4").css({backgroundImage:"url(i/tech.jpg)",cursor:"pointer"}).rb_menu(); $("#menutab5").css({backgroundImage:"url(i/patients.jpg)",cursor:"pointer"}).rb_menu(); $(".links").click(function(){window.location=this.id+".php"}); $("#logo").click(function(){window.location="/bho/index.php"}); $("#newsbody").height($("#contentcol2").height()-111+"px");});$.fn.rb_menu = function(options) {var self = this;this.options = {// transitions: easein, easeout, easeboth, bouncein, bounceout,// bounceboth, elasticin, elasticout, elasticbothtransition: 'easein',// trigger events: mouseover, mousedown, mouseup, click, dblclicktriggerEvent: 'mouseover',// number of ms to delay before hiding menu (on page load)loadHideDelay : 500,// number of ms to delay before hiding menu (on mouseout)blurHideDelay: 500, // number of ms for transition effecteffectDuration: 500}// make sure to check if options are given!if(options) { $.extend(this.options, options);}return this.each(function() { var menu = $("#drop"+this.id);menu.closed = true;menu.hide(); menu.hide = function() {if(menu.css('display') == 'block' && !menu.closed) {menu.BlindUp( self.options.effectDuration,function() { menu.closed = true;menu.unbind(); },self.options.transition);} $(".dropmenu li").css("fontWeight","normal");}menu.show = function() {if(menu.css('display') == 'none' && menu.closed) { menu.BlindDown(self.options.effectDuration, function() {menu.closed = false; menu.hover(function() { clearTimeout(menu.timeout);}, function() { menu.timeout = setTimeout( function() { menu.hide();}, self.options.blurHideDelay); });}, self.options.transition);} //highlight each li option on mouseover $(".dropmenuli").mouseover(function(){$(this).css({fontWeight:"bold",color:"white",background:"#e6ccb3"});}).mouseout(function(){$(this).css({fontWeight:"normal",color:"#a0a0a0",background:"#f2e6da"});}); }//show drop down when mouseover table tds self.bind("mouseover", function() { menu.show();}); //hide drop downs if mouseout of table tdsself.bind("mouseout", function() { menu.timeout = setTimeout( function() {menu.hide();},self.options.blurHideDelay);});});}; ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/