[jQuery] Variable within document ready... where is it in the DOM?
Hi, I've been trying to understand a little tidbit of jQuery here... Lets say we define an object in the Document ready method: $(function(){ var pen = { type: Ballpoint, color: blue, hasInk: true } }); Where in the DOM can we find the pen object?
[jQuery] Re: Variable within document ready... where is it in the DOM?
It has to be stored somewhere though... Say, for example, we bind a handler to the click event on the BODY of the document and we log the pen object to the console. $(function(){ var pen = { type: Ballpoint, color: blue, hasInk: true } $(BODY).click(function(){ console.log(pen) }) }); As you can see when you run that code, the pen object is logged to the console so it has to be stored somewhere... Where, is the question. On Oct 24, 8:01 pm, donb falconwatc...@comcast.net wrote: You can't. It exists for the duration of the ready function, then it's gone. On Oct 24, 7:51 pm, Nikola nik.cod...@gmail.com wrote: Hi, I've been trying to understand a little tidbit of jQuery here... Lets say we define an object in the Document ready method: $(function(){ var pen = { type: Ballpoint, color: blue, hasInk: true } }); Where in the DOM can we find the pen object?
[jQuery] Re: Variable within document ready... where is it in the DOM?
Right, thanks, I understand how to make it a global but what I'd really like to understand is how to access it within the ready object. On Oct 24, 8:17 pm, MorningZ morni...@gmail.com wrote: it's local to that event if you need it globally var pen = {}; $(function(){ pen = { type: Ballpoint, color: blue, hasInk: true } }); would allow you to reference pen from anywhere in your code On Oct 24, 8:01 pm, donb falconwatc...@comcast.net wrote: You can't. It exists for the duration of the ready function, then it's gone. On Oct 24, 7:51 pm, Nikola nik.cod...@gmail.com wrote: Hi, I've been trying to understand a little tidbit of jQuery here... Lets say we define an object in the Document ready method: $(function(){ var pen = { type: Ballpoint, color: blue, hasInk: true } }); Where in the DOM can we find the pen object?
[jQuery] Re: Variable within document ready... where is it in the DOM?
Thanks Mike, I generally understand closures and your explanation was very good. I think what your saying is that the example pen object is just a local variable to the ready callback. Thanks for clearing that up... On Oct 24, 10:51 pm, Michael Geary m...@mg.to wrote: The concept you're looking for is called a closure. Search for: javascript closure and you will find all sorts of information about closures. It really has nothing to do with jQuery or the DOM. Closures are part of the core JavaScript language and work in any environment where JavaScript is implement. For example, Adobe Acrobat supports JavaScript, but it has no HTML-oriented DOM, and certainly no jQuery. But closures work exactly the same in JavaScript code in a PDF file as they do in a web page. Here's a simple way to understand closures: 1. When you nest one function inside another, the inner function can read and write variables declared in the outer function. 2. That *always* works, even if the outer function has already completed running and returns to its caller. That's what is happening in your example: You have an outer function - the ready callback - and an inner function - the click handler. The inner function can access the variable declared in the outer function, even though the inner function runs long after the outer function has returned. -Mike On Sat, Oct 24, 2009 at 5:23 PM, Nikola nik.cod...@gmail.com wrote: It has to be stored somewhere though... Say, for example, we bind a handler to the click event on the BODY of the document and we log the pen object to the console. $(function(){ var pen = { type: Ballpoint, color: blue, hasInk: true } $(BODY).click(function(){ console.log(pen) }) }); As you can see when you run that code, the pen object is logged to the console so it has to be stored somewhere... Where, is the question. On Oct 24, 8:01 pm, donb falconwatc...@comcast.net wrote: You can't. It exists for the duration of the ready function, then it's gone. On Oct 24, 7:51 pm, Nikola nik.cod...@gmail.com wrote: Hi, I've been trying to understand a little tidbit of jQuery here... Lets say we define an object in the Document ready method: $(function(){ var pen = { type: Ballpoint, color: blue, hasInk: true } }); Where in the DOM can we find the pen object?
[jQuery] Re: Variable within document ready... where is it in the DOM?
Actually, thanks to everybody for the replies. I think you were all basically saying the same thing in different ways come to think of it... On Oct 24, 11:30 pm, Nikola nik.cod...@gmail.com wrote: Thanks Mike, I generally understand closures and your explanation was very good. I think what your saying is that the example pen object is just a local variable to the ready callback. Thanks for clearing that up... On Oct 24, 10:51 pm, Michael Geary m...@mg.to wrote: The concept you're looking for is called a closure. Search for: javascript closure and you will find all sorts of information about closures. It really has nothing to do with jQuery or the DOM. Closures are part of the core JavaScript language and work in any environment where JavaScript is implement. For example, Adobe Acrobat supports JavaScript, but it has no HTML-oriented DOM, and certainly no jQuery. But closures work exactly the same in JavaScript code in a PDF file as they do in a web page. Here's a simple way to understand closures: 1. When you nest one function inside another, the inner function can read and write variables declared in the outer function. 2. That *always* works, even if the outer function has already completed running and returns to its caller. That's what is happening in your example: You have an outer function - the ready callback - and an inner function - the click handler. The inner function can access the variable declared in the outer function, even though the inner function runs long after the outer function has returned. -Mike On Sat, Oct 24, 2009 at 5:23 PM, Nikola nik.cod...@gmail.com wrote: It has to be stored somewhere though... Say, for example, we bind a handler to the click event on the BODY of the document and we log the pen object to the console. $(function(){ var pen = { type: Ballpoint, color: blue, hasInk: true } $(BODY).click(function(){ console.log(pen) }) }); As you can see when you run that code, the pen object is logged to the console so it has to be stored somewhere... Where, is the question. On Oct 24, 8:01 pm, donb falconwatc...@comcast.net wrote: You can't. It exists for the duration of the ready function, then it's gone. On Oct 24, 7:51 pm, Nikola nik.cod...@gmail.com wrote: Hi, I've been trying to understand a little tidbit of jQuery here... Lets say we define an object in the Document ready method: $(function(){ var pen = { type: Ballpoint, color: blue, hasInk: true } }); Where in the DOM can we find the pen object?
[jQuery] Re: Switch image source during toggle
You could toggle classes making sure each class is styled with the appropriate image, use the css() method to change the background / background-image property or, if your working with an img element, you can use the attr() method to change the images src. On Oct 2, 12:26 pm, Gremlyn1 greml...@gmail.com wrote: I have some divs I am toggling and there is a little + sign image I want to change to a - sign image when the toggle event occurs, but can't quite figure it out. Here is the toggle code I have (taken from a helpful post on here): $j(document).ready(function() { $j('#answerbox').hide(); $j('a.faq').click(function() { var faq_id = $j(this).attr('id'); $j('#faq' + faq_id).slideToggle(fast); return false; }); }); The image is not contained within the a tag, so I guess I need a separate function to callback.
[jQuery] Access a plug-in option from within the initial call?
Hi, I'm wondering how to access a plug-in's options from within the initial plug-in call. Here's an example: $(#someDiv).somePlugIn({ optionA: true, trigger: $(this).children('#trigger'), callback: function(){ trigger.doSomething(); } }); As you can see, all I'm trying to do is access optionB within the callback function I'm specifying in the initial call but I don't know how to access it. Any ideas? Thanks...
[jQuery] Re: new plugin: miniZoomPan
That's really great... I like this. On Jun 19, 6:16 am, GianCarlo Mingati giancarlo.ming...@gmail.com wrote: Hello everyone, during the initial phase in the development of amuch more complex zommpan widget, i ended up with this tiny (yet another) zoompan plugin. Since it's small and with just few functionalities i'd call it miniZoomPan. http://www.gcmingati.net/wordpress/wp-content/lab/jquery/minizoompan/ Basically it just loads a new (bigger) image when you hover the container DIV. You need to pass the width and height of the two images (the small and the large one) and also the images must have a special char at the end: mycat_s.jpg mycat_l.jpg Hope you find it useful ;-)http://www.gcmingati.net/wordpress/wp-content/lab/jquery/minizoompan/ Kindly report any bug. Cheers GC
[jQuery] Re: jQuery Works fine with Firefox and Internet Explorer 8. Not with IE7?
You know, you can view sites in IE7 mode with IE8 Just change the Document Mode to IE7 standards. Also, it's not a problem with jQuery you have a trailing comma on line 65 of your inline script: clip: {baseUrl: 'http://www.pangeaadvisors.org'}, // -- This comma is the problem On Jun 17, 1:38 pm, efet efetun...@gmail.com wrote: I developed a website using jQuery plugins in part of it. Couple of visitors visited the website with internet explorer complained that some part of the website does not function at all. I have Internet Explorer 8 installed and I dont know how to downgrade it. Can someone test the website and tell me the error please. Thank you in advance! http://www.pangeaadvisors.org
[jQuery] Re: Select/Unselect radio buttons
Give the three master radio buttons unique ID's or classes. Then, upon clicking one of them you can add / remove classes and attributes... $('#masterRadioOne').click(function(){ ($('.radio1').is('.on')) ? $('.radio1').removeClass('on').attr (checked,false) : $('.radio1').addClass('on').attr (checked,checked) ; }); I used the class name 'on' so that the ternary would show on one line.. normally I'd use something like 'selected' or 'checked'.. On Jun 15, 12:26 pm, Erich93063 erich93...@gmail.com wrote: I have a very long form full of items that the user rates from 1 to 3. There may be 100 items that the user needs to rate. For each item to rate they are given three radio buttons for 1, 2 or 3 for them to choose from. Now initially all the radio buttons are unchecked, but each item to rate is required. So this process can take quite a bit of time having to check each radio button. I need a way at the top of the form to have three master radio buttons for 1, 2 and 3 to where if they click 1 it will select/deselect all of the radio buttons for the rating 1 and the same for 2 and 3. I would like to work off of the CSS class selecter for this so I will be giving the radio buttons classes of radio1, radio2 and radio3. What's the best way to go about this? THANKS
[jQuery] Re: Tablesorter UI Theme Support
Very nice. On May 29, 7:39 pm, Panman rpann...@gmail.com wrote: This is a double post, at least going to be a double post from in the jQuery Plugin list. I'm being moderated yet on that list, and it doesn't seem to get much activity. -- Hi, I'm going to post this here since the Tablesorter developer hasn't gotten back to me yet. I took a copy of the latest version in SVN and modified it to have jQuery UI Theme support. It seems to work very well and anyone is welcome to use it. Here are the features: New Options -- uiTheme: boolean true/false (default false) uiThemeIconAsc: string 'icon-class-name' (default 'ui-icon-carat-1- s') uiThemeIconDesc: string 'icon-class-name' (default 'ui-icon-carat-1- n') uiThemeIconSort: string 'icon-class-name' (default 'ui-icon-carat-2-n- s') New Widgets --- zebraStripes - same thing as zebra, just vertically checkers - just what it sounds like Note: zebra and zebraStripes can be used together but zebra must be first Download --- I was hoping this would be included into tablesorter so I just threw up the modified version on my work site for now. Let me know what you think! http://www.stma.k12.mn.us/tablesorter.zip
[jQuery] Re: Recommendations for jQuery method to play mp3 audio
Here's a few I've come across: jQuery Media PlugIn: http://malsup.com/jquery/media/ jPlayer http://www.happyworm.com/jquery/jplayer/ FlowPlayers a nice PlugIn as well but it looks like the site is down at the moment. On May 20, 10:02 am, SamCKayak s...@elearningcorner.com wrote: Is there a cross-browser jQuery plug-in that can preload several different mp3 audio files and provide play / stop methods?
[jQuery] Re: jquery beginner question: defer $('x').text('change') until after $('x').animate()
You're going to want to use callbacks... $('#word1, #story').fadeOut('fast', function(){ $(#word 1).text (lorem); $(#word).text(ipsum); $('#word1, #story').fadeIn (slow)}); $('.frame3').click(function(){ $('#story, #word1').fadeOut('fast', function(){ $('#story').text (lorem); $('#word1').text(ipsum); $('#story, #word1').fadeIn (slow)}); }); On May 14, 12:34 pm, illovich illov...@gmail.com wrote: I also tried $(function(){ $('.frame3').click(function(){ $('#story').animate({ opacity: 'hide'}, 'fast').css ('background-position' , '-0px -302px').animate({ opacity: 'show'}, 'fast'); $('#word1').animate({ opacity: 'hide'}, 'fast').text(I loved you).animate({ opacity: 'show'}, 'fast'); }); }) And that didn't work either - even though the .text method is after the .animate method, it still happens first. Frustrating!
[jQuery] Re: jquery beginner question: defer $('x').text('change') until after $('x').animate()
Since you want to execute the text change and fadeIn after the animation completes you need to use a callback... $('.frame3').click(function(){ $('#story, #word1').fadeOut('fast', function(){ $('#story').text(lorem); $('#word1').text(ipsum); $('#story, #word1').fadeIn(slow) }); }); On May 14, 12:34 pm, illovich illov...@gmail.com wrote: I also tried $(function(){ $('.frame3').click(function(){ $('#story').animate({ opacity: 'hide'}, 'fast').css ('background-position' , '-0px -302px').animate({ opacity: 'show'}, 'fast'); $('#word1').animate({ opacity: 'hide'}, 'fast').text(I loved you).animate({ opacity: 'show'}, 'fast'); }); }) And that didn't work either - even though the .text method is after the .animate method, it still happens first. Frustrating!
[jQuery] Re: Is any one else experiencing serious slowdowns on their site due to 'waiting for jqueryui.com' ?
I experienced this, yes. In my case it was the Themeroller Dev tool which was slowing things down. Additionally, I wasn't able to download any themes. I'd say it's probable that the Themeroller and Dev tool are being updated at this time. On May 2, 4:08 pm, Michael Geary m...@mg.to wrote: It sounds like you must be loading some JavaScript files directly from jqueryui.com. Instead of that, you should load the files from your own server or use Google's copies: http://code.google.com/apis/ajaxlibs/ If you would post a link to your site, I'm sure someone can give you more specifics. -Mike From: stasch I was surprised to today to discover that my site was running much slower than usual (3 to 4 times slower!). Most of the delay was spent with the message 'waiting for jqueryui.com'. This really freaked me out. First of all what gives the jquery folks the right to ping their site from their code? Second of all, if they're going to do that they'd better make sure that the site they are pinging is super fast. Can anybody enlighten me as to what is going on here? Better yet, how can I remove that code from my jquery library? I can't afford to have this kind of performance hit due to uncontrollable 'features' like this in my code. And if I'm legally bound to keep that code in the library please advise me so that I can go back to Prototype. Totally unacceptable!
[jQuery] Re: Best tooltip plug-in -- opinions?
I really like the 'Simplest Tooltip ever' by Alen Grakalic at CSS Globe, it's a tiny script and it works well. Q-Tip is another nice one I've used in the past as well.. On Apr 20, 5:11 pm, Jack Killpatrick j...@ihwy.com wrote: worth a look: http://craigsworks.com/projects/qtip/docs/ http://cssglobe.com/post/4380/easy-tooltip--jquery-plugin http://www.lullabot.com/files/bt/bt-latest/DEMO/index.html - Jack René wrote: There are so many to choose from, I'd like to hear some opinions. 1. Relatively lean and fast. 200+ KB seems, to me, ridiculously large. 2. Ridiculously good-looking. 3. Compatible. Firefox, IE 6/7, Safari, etc. Opinions? ...Rene
[jQuery] Re: Difference between .bind() and .click()
Is there any performance difference at all? Say between using .hover vs. binding to mouseenter and mouseleave? On Apr 6, 6:40 pm, James james.gp@gmail.com wrote: Yes, basically two different way to do the same thing. Though with bind(), you can define more than one type of events at once to the same callback. .bind('mouseover mouseout blur', function(){... On Apr 6, 6:53 am, jQueryAddict jqueryadd...@gmail.com wrote: I want to do something based on the click event. I was looking at examples and at the jQuery Docs. Read them but so then a .blind() is adding an event handler where .click() is obviously an event handler but you could I guess use either or to handle for example a click event: .bind('click', function(){... or .click(function(){ right? either will work on whatever element you're working with right? just 2 different ways of doing the same thing in jQuery I assume.- Hide quoted text - - Show quoted text -
[jQuery] Re: Get text of external HTML and encode
I've encountered a minor issue performance wise. For some reason, after injecting the text into a UI tab the performance of the tabs suffers greatly. Why would getting the contents of a file and injecting them into a tab as text slow the performance of tab switching after the injection? On Apr 4, 12:24 am, Nikola nik.cod...@gmail.com wrote: Perfect. Thank you, I did try using a $.get request but I was tyring to replace charecters instead of injecting the data as text. This is exactly what I was trying to do. I thought there was a very simple and clean way to do it but I wasn't sure how. Thank you much! On Apr 4, 12:08 am, Abdullah Rubiyath alif...@gmail.com wrote: Hi There, If I am getting this right.. you are trying to get the contents of another file and inject it into an element, but ensuring it shows as plain text and javascripts are not executed. Can you try replacing $('#thisDiv').load with a $.get request and do the following: $.get('../sample.html', function(data) { $('#thisDiv').text( data ); }); With this approach, the html entities (,, etc.) will be converted to their appropriate characters and then injected to $('#thisDiv'). I hope this helps, Thanks, Abdullah. On Apr 3, 11:27 pm,Nikolanik.cod...@gmail.com wrote: Anyone have any ideas or input on this one? On Apr 3, 6:29 pm,Nikolanik.cod...@gmail.com wrote: Thanks MorningZ, I gave this approach whirl and in a roundabout sort of way it seems to accomplish the same thing I was doing in my third example. $(#thisDiv).load(../sample.html, { }, function() { var div = document.createElement(div); var text = document.createTextNode($(#thisDiv).html()); div.appendChild(text); var EscapedHTML = div.innerHTML; $(#thisDiv).text(EscapedHTML); }); In a nutshell I want to display the text of an HTML file as plain text. I'm able to do this, with HTML, but I'm unable to prevent the javascipt in the HTML from executing. My goal is to write a simple function that loads code from a document and displays it as text.- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Get text of external HTML and encode
Hello, I'm trying to load an external HTML file and encode the with lt. I've tried a number of different approaches but I haven't found the proper method yet. Here are a few examples of how I've approached this.. $(#thisDiv).load(../sample.html); $(#thisDiv).text().replaceWith(lt); __ $(#thisDiv).load(../sample.html).text(); $(#thisDiv).text().html(); __ $(#thisDiv).load(../sample.html).text(); $(#thisDiv).text().replace(//g,'lt;'); Any suggestions or ideas?
[jQuery] Re: Get text of external HTML and encode
Thanks MorningZ, I gave this approach whirl and in a roundabout sort of way it seems to accomplish the same thing I was doing in my third example. $(#thisDiv).load(../sample.html, { }, function() { var div = document.createElement(div); var text = document.createTextNode($(#thisDiv).html()); div.appendChild(text); var EscapedHTML = div.innerHTML; $(#thisDiv).text(EscapedHTML); }); In a nutshell I want to display the text of an HTML as plain text. I'm able to do this, with HTML, but I'm unable to prevent the js in the HTML from executing. My goal is to write a simple function to load code snippets directly from their parent document. On Apr 3, 5:27 pm, MorningZ morni...@gmail.com wrote: Does the .load() at least work? - Your first method - $(#thisDiv).text().replaceWith(lt); that's going to fill #thisDiv with - Your second method --- $(#thisDiv).text().html(); is going to be a string value after .text() and would throw an error because there is no .html() method on a string object - Your third attempt --- Would have worked, except you are missing the fact that the .load call is an asynchronous call, meaning you have no control over the object so soon to use the .html() method So with all that said (with help of some Html Encode code that i found by Google-ing): $(#thisDiv).load(../sample.html, { }, function() { var div = document.createElement(div); var text = document.createTextNode($(#thisDiv).html()); div.appendChild(text); var EscapedHTML = div.innerHTML; }); On Apr 3, 5:05 pm, Nikola nik.cod...@gmail.com wrote: Hello, I'm trying to load an external HTML file and encode the with lt. I've tried a number of different approaches but I haven't found the proper method yet. Here are a few examples of how I've approached this.. $(#thisDiv).load(../sample.html); $(#thisDiv).text().replaceWith(lt); __ $(#thisDiv).load(../sample.html).text(); $(#thisDiv).text().html(); __ $(#thisDiv).load(../sample.html).text(); $(#thisDiv).text().replace(//g,'lt;'); Any suggestions or ideas?- Hide quoted text - - Show quoted text -
[jQuery] Re: Get text of external HTML and encode
Thanks MorningZ, I gave this approach whirl and in a roundabout sort of way it seems to accomplish the same thing I was doing in my third example. $(#thisDiv).load(../sample.html, { }, function() { var div = document.createElement(div); var text = document.createTextNode($(#thisDiv).html()); div.appendChild(text); var EscapedHTML = div.innerHTML; $(#thisDiv).text(EscapedHTML); }); In a nutshell I want to display the text of an HTML file as plain text. I'm able to do this, with HTML, but I'm unable to prevent the javascipt in the HTML from executing. My goal is to write a simple function that loads code from a document and displays it as text.
[jQuery] Re: effect similar to windows task bar in auto-hide mode
Check out the amazing jQuery UI Layout plugin. Go through the demos, I'm sure you can keep the south pane hidden and then show it on hover. Conversly, you could always use a fixed position DIV at the bottom of the page, hide it and then on hover use something like slideUp to show it.. jQuery UI Layout - a really well thoughtout PlugIn (great for Control Panels as well) http://layout.jquery-dev.net/ On Apr 3, 1:41 pm, sso strongsilent...@gmail.com wrote: Hi I'm looking for a quick and easy way to have an effect similar to that of the windows taskbar in auto-hide mode. It would be especially nice if it stayed at the bottom of the page even while scrolling. Suggestions?
[jQuery] Re: Get text of external HTML and encode
Anyone have any ideas or input on this one? On Apr 3, 6:29 pm, Nikola nik.cod...@gmail.com wrote: Thanks MorningZ, I gave this approach whirl and in a roundabout sort of way it seems to accomplish the same thing I was doing in my third example. $(#thisDiv).load(../sample.html, { }, function() { var div = document.createElement(div); var text = document.createTextNode($(#thisDiv).html()); div.appendChild(text); var EscapedHTML = div.innerHTML; $(#thisDiv).text(EscapedHTML); }); In a nutshell I want to display the text of an HTML file as plain text. I'm able to do this, with HTML, but I'm unable to prevent the javascipt in the HTML from executing. My goal is to write a simple function that loads code from a document and displays it as text.
[jQuery] Re: Selectively load js files
What a great example, very usefull! I never thought of doing something like that... On Apr 3, 11:44 pm, Eric Garside gars...@gmail.com wrote: If you get the developer build, each of the files is separated out into a: ui.core.js, ui.draggable.js, etc format. If you want to add a bit of spice: $.uinclude = function(){ var scripts = ['core'], counter, loaded = 0; scripts.push.apply(this, arguments); counter = scripts.length; $.each(scripts, function(){ $.ajax({ type: GET, url: '/path/to/ jqueryui/ui.' + this + '.js', success: function(){ loaded++; if (loaded == counter) $('body').trigger('ui-included'); }, dataType: script, cache: true });} // Example Usage $('body').bind('ui-included', function(){ // Triggered when your UI scripts are included }); $.uinclude('draggable', 'resizable', 'tabs'); On Apr 3, 1:36 pm, Brendan bcorco...@gmail.com wrote: Hi, I'm looking at including jQuery UI in a project I am working on, but one of my concerns is the large size of the full file. I was wondering if there is something easy or built in that would allow me to load only which jQuery UI plugins/effects I need on a particular page. So, something like: loadUI({core,accordion}); Does that make sense? And each file would be separate on the server, so they get cached. (like individual script tags loaded, without going through all that hassle)- Hide quoted text - - Show quoted text -
[jQuery] Re: Get text of external HTML and encode
Perfect. Thank you, I did try using a $.get request but I was tyring to replace charecters instead of injecting the data as text. This is exactly what I was trying to do. I thought there was a very simple and clean way to do it but I wasn't sure how. Thank you much! On Apr 4, 12:08 am, Abdullah Rubiyath alif...@gmail.com wrote: Hi There, If I am getting this right.. you are trying to get the contents of another file and inject it into an element, but ensuring it shows as plain text and javascripts are not executed. Can you try replacing $('#thisDiv').load with a $.get request and do the following: $.get('../sample.html', function(data) { $('#thisDiv').text( data ); }); With this approach, the html entities (,, etc.) will be converted to their appropriate characters and then injected to $('#thisDiv'). I hope this helps, Thanks, Abdullah. On Apr 3, 11:27 pm, Nikola nik.cod...@gmail.com wrote: Anyone have any ideas or input on this one? On Apr 3, 6:29 pm, Nikola nik.cod...@gmail.com wrote: Thanks MorningZ, I gave this approach whirl and in a roundabout sort of way it seems to accomplish the same thing I was doing in my third example. $(#thisDiv).load(../sample.html, { }, function() { var div = document.createElement(div); var text = document.createTextNode($(#thisDiv).html()); div.appendChild(text); var EscapedHTML = div.innerHTML; $(#thisDiv).text(EscapedHTML); }); In a nutshell I want to display the text of an HTML file as plain text. I'm able to do this, with HTML, but I'm unable to prevent the javascipt in the HTML from executing. My goal is to write a simple function that loads code from a document and displays it as text.- Hide quoted text - - Show quoted text -
[jQuery] Re: Problems using JRC corner or curvycorner
I've found JRC and the Bullet Proof CornerZ PlugIns to be foolproof... except in IE8 thus far. On Mar 26, 11:44 am, banacan banaca...@gmail.com wrote: I'm creating a page with many divs that I would like to have rounded corners, and several problems keep coming up. When using JRC for rounding, not all elements will round even though they have the correct class. Reloading the page will, after several attempts, create the rounded corners, though sometimes some elements will never round. This is even more problematic when the div has a border; I can see the rounded bg but the border is still square. Again, after repeated reloadings (3 or 4 times) it will usually work, though in some browsers it might not. Also, when using a gradient background on the parent div, the corner does not pick up the underlying color. When using curvycorner, the underlying color does come through, but again the div is not always rounded on the first load. It too needs refreshing multiple times before displaying correctly. Also, with curvycorners IE (6 anyway) does not produce rounded corners at all. So my questions are: Is this a common failing of these scripts? Is having the CSS in an external file the problem? Could these problems be caused by my local testing server? MAC OSX10.4.9, Apache 1.3.1, PHP 5.2, MySQL 5.0 Is a traditional CSS approach more reliable - though not easier? I don't want to spend much more time on this and I was hoping to hear from others whether or not they have experienced similar problems. If this is just not reliable, I need to take a different approach. TIA
[jQuery] Re: Problems using JRC corner or curvycorner
Here you go.. it hasn't been refactored for IE8 yet though. http://labs.parkerfox.co.uk/cornerz/ On Mar 26, 2:54 pm, banacan banaca...@gmail.com wrote: Nicola, I'm not familiar with CornerZ. I searched the plugin repository and found nothing. Can you supply a link? Thanks. On Mar 26, 1:59 pm, Nikola nik.cod...@gmail.com wrote: I've found JRC and the Bullet Proof CornerZ PlugIns to be foolproof... except in IE8 thus far. On Mar 26, 11:44 am, banacan banaca...@gmail.com wrote: I'm creating a page with many divs that I would like to have rounded corners, and several problems keep coming up. When using JRC for rounding, not all elements will round even though they have the correct class. Reloading the page will, after several attempts, create the rounded corners, though sometimes some elements will never round. This is even more problematic when the div has a border; I can see the rounded bg but the border is still square. Again, after repeated reloadings (3 or 4 times) it will usually work, though in some browsers it might not. Also, when using a gradient background on the parent div, the corner does not pick up the underlying color. When using curvycorner, the underlying color does come through, but again the div is not always rounded on the first load. It too needs refreshing multiple times before displaying correctly. Also, with curvycorners IE (6 anyway) does not produce rounded corners at all. So my questions are: Is this a common failing of these scripts? Is having the CSS in an external file the problem? Could these problems be caused by my local testing server? MAC OSX10.4.9, Apache 1.3.1, PHP 5.2, MySQL 5.0 Is a traditional CSS approach more reliable - though not easier? I don't want to spend much more time on this and I was hoping to hear from others whether or not they have experienced similar problems. If this is just not reliable, I need to take a different approach. TIA- Hide quoted text - - Show quoted text -
[jQuery] Re: Pointless but fun jQuery experiment
That was really neat... jQuery physics! On Mar 25, 11:40 pm, brian bally.z...@gmail.com wrote: I'll second that! On Wed, Mar 25, 2009 at 9:26 PM, Rick Faircloth r...@whitestonemedia.com wrote: Pretty cool, Kelvin! Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Kelvin Luck Sent: Wednesday, March 25, 2009 9:22 PM To: jquery-en Subject: [jQuery] Pointless but fun jQuery experiment Inspired by google's chrome experiments I recently put together a pointless but fun experiment with the help of jQuery and I thought that people on the list might like to check it out: http://www.kelvinluck.com/assets/jquery/boingPic/index.html As I said, completely pointless but makes a nice change from serious progressive enhancement! Hope you like it, Kelvin :)
[jQuery] Re: Regarding jQuery UI tabs()
You might wan't to post this in the UI group.. http://groups.google.com/group/jquery-ui You could, also, just add / remove your own 'active' class pretty easily. On Mar 24, 10:32 pm, MorningZ morni...@gmail.com wrote: it's definitely possible, but would require going through the js and theme css and changing the class name so why would this be important to do? On Mar 24, 9:21 pm, BigFisch arac...@gmail.com wrote: I was wondering if there was a way to rename the class when something is active. Is it possible to define this in a parameter? Instead of ui-state-active, I'd like it to use active- Hide quoted text - - Show quoted text -
[jQuery] Re: Cannot get height in Opera
Is anyone familiar with this? On Mar 22, 10:32 pm, Nikola nik.cod...@gmail.com wrote: Hello, I posted this in the UI group but I'm thinking the question may belong here. I can't seem to get the height of Dialog titlebars in Opera. I've tried numerous approaches. You can run the below code in Opera with any page that contains a Dialog. It always returns 0. Thanks http://paste.pocoo.org/show/109098/
[jQuery] Cannot get height in Opera
Hello, I posted this in the UI group but I'm thinking the question may belong here. I can't seem to get the height of Dialog titlebars in Opera. I've tried numerous approaches. You can run the below code in Opera with any page that contains a Dialog. It always returns 0. Thanks http://paste.pocoo.org/show/109098/
[jQuery] Re: Develop Ajax apps 100% faster - thanks to jQuery Raxan PDI
Very interesting! On Mar 18, 2:14 pm, xwisdom xwis...@gmail.com wrote: Hi Jack, Yes, Raxan is still in alpha stages right now but we're anticipating a beta and then a final release very soon. donb, The grid system used by Raxan is based on BluePrintCSS which include a lot more than layouts but it also possible to intergrate Raxan with the 960 grid system. All you have to do is drop you grid file into the styles folder and then include it inside your project. Thanks for sharing __ Raymond Irving
[jQuery] Re: proper syntax for a local path ../myDirectory/myFile.htm
I do this all the time... file:///c:/myDirectory/myFile.htm #myDiv On Mar 18, 3:32 pm, rolfsf rol...@gmail.com wrote: I need to make a simple 'freestanding' prototype to be run locally. I used a simple load() to grab a div from another file: $('#ajax-panel').load(../myDirectory/myFile.htm #myDiv); but the ../ in the url chokes. How can I accomplish that for a prototype that runs locally on my machine without a proper server? Thanks
[jQuery] Re: New Plugin: jQuery Finder (Mac-style 'Treeview' with Columns)
Hi, I noticed that the API browser @ http://www.nicolas.rudas.info/jquery/finder/api.html isn't displaying the info. Is it being updated for 1.7 maybe? Thanks... On Mar 5, 5:37 pm, Nicolas R ruda...@googlemail.com wrote: All right, I added IE6 support. Latest files (ui.finder.js,ui.finder-min.js, and ui-finder.ie.css) can be found at the trunk:http://code.google.com/p/jqueryfinder/source/browse/trunk Its not the same as in decent browsers but its good enough. On Mar 4, 7:41 pm, Nicolas R ruda...@googlemail.com wrote: Matt, I'll get back to you tomorrow with some code snippets. It's been a while since I did the bug fixing for IE and I can't remember right now what the issues were. And since I'm really smart I didn't save the code that fixed the issues. So, yeah, tomorrow I'll have a look and post back. Cheers On Mar 4, 4:47 pm, matt mathias.leimgru...@gmail.com wrote: Hi Nicolas first, its a great tool to work with! Currently I'm trying to use it in Plone CMS as a reference widget. It works great on nearly all browser (as you said) except on IE6. My approach was to give fixed height and width to the div's (.ui- finder-column, .ui-finder-wrapper): but without happy-end -.- I figured out how to make it work on IE6 (mostly), but as the changes are very specific I did not include them in the code. If anyone requires ie6 support just ask. So here I am and I'm asking for support :-) a few code snips should be enough. Thanks in advance best regards Matt
[jQuery] How can I specify what $(this) is within a function?
Hello, I've written a simple function for a hover event but I can't seem to specify what $(this) is properly. Here's a little example I put together, any input would be great. Thanks.. http://jsbin.com/ezeye/edit
[jQuery] Re: How can I specify what $(this) is within a function?
Oh Thank you! I've tried so many different things, like defining _this after the event but I never thought of writing it this way. Thanks much, this explains it. On Feb 21, 4:18 pm, 浩翔 blackange...@gmail.com wrote: sorry for my poor english, i hope you can understand my mean. On Feb 22, 5:12 am, Alex blackange...@gmail.com wrote: $(this) is no problem. hover_in() and hover_out() should place in each method. if hover_in() and hover_out() placed outside each method, $this in hover_in() and hover_out() is all li tag. are u understand ? you should write like this : = $.fn.simpleFunction = function(options) { var options = jQuery.extend( {colorOne:'#660066', colorTwo:'#808080'},options); this.each(function() { var $this = $(this); function hover_in() { $this.css({backgroundColor:options.colorOne}); }; function hover_out() { $this.css({backgroundColor:options.colorTwo}); }; $(this).hover(function () { hover_in(); },function(){ hover_out(); }); }); return this;}; $(.hover_me).simpleFunction(); }); === On 2009-2-22, at 上午3:06, Nikola wrote: Hello, I've written a simple function for a hover event but I can't seem to specify what $(this) is properly. Here's a little example I put together, any input would be great. Thanks.. http://jsbin.com/ezeye/edit
[jQuery] Re: How can I specify what $(this) is within a function?
Thanks again, I understand what's happening now and I've been able to correct my code. The plugin I'm working on is functioning perfectly - I no longer need to filter out results or toggle classes. On Feb 21, 4:20 pm, Nikola nik.cod...@gmail.com wrote: Oh Thank you! I've tried so many different things, like defining _this after the event but I never thought of writing it this way. Thanks much, this explains it. On Feb 21, 4:18 pm, 浩翔 blackange...@gmail.com wrote: sorry for my poor english, i hope you can understand my mean. On Feb 22, 5:12 am, Alex blackange...@gmail.com wrote: $(this) is no problem. hover_in() and hover_out() should place in each method. if hover_in() and hover_out() placed outside each method, $this in hover_in() and hover_out() is all li tag. are u understand ? you should write like this : = $.fn.simpleFunction = function(options) { var options = jQuery.extend( {colorOne:'#660066', colorTwo:'#808080'},options); this.each(function() { var $this = $(this); function hover_in() { $this.css({backgroundColor:options.colorOne}); }; function hover_out() { $this.css({backgroundColor:options.colorTwo}); }; $(this).hover(function () { hover_in(); },function(){ hover_out(); }); }); return this;}; $(.hover_me).simpleFunction(); }); === On 2009-2-22, at 上午3:06, Nikola wrote: Hello, I've written a simple function for a hover event but I can't seem to specify what $(this) is properly. Here's a little example I put together, any input would be great. Thanks.. http://jsbin.com/ezeye/edit
[jQuery] Re: Queuing jQuery animations
You can use a callback which will be executed when the animation is finished, like this: $(#i2).animate({left: +=110px}, 1500, function(){ $(this).css ({zindex:19}); } ); On Feb 20, 7:06 am, paul.mac paul.mcma...@uuconstruct.co.uk wrote: Hi, A newie to jQuery although I do have quiet a lot of JavaScript experience. I can't seem to grasp the queuing of animations in jQuery I have the following code $(#right).click(function(){ ... $(#tv2).animate({left: +=110px}, 1500).animate({left: - =110px}, 0); $(#i2).animate({left: +=110px}, 1500); ... }); which both execute at the same time - exactly what I want - and what I would like to do is change the z-index of i2 after the animation has stopped. I tried appending .css(z-index, 19) to the end of the #i2 line (before the semi colon) but it seems to execute it straight away. (There are some more bits to the code but they will only clutter things up) Thanks paul.mac
[jQuery] Re: Queuing jQuery animations
I made a typo it's 'zIndex' not 'zindex' - disregard the quotes there... On Feb 20, 2:32 pm, Nikola nik.cod...@gmail.com wrote: You can use a callback which will be executed when the animation is finished, like this: $(#i2).animate({left: +=110px}, 1500, function(){ $(this).css ({zindex:19}); } ); On Feb 20, 7:06 am, paul.mac paul.mcma...@uuconstruct.co.uk wrote: Hi, A newie to jQuery although I do have quiet a lot of JavaScript experience. I can't seem to grasp the queuing of animations in jQuery I have the following code $(#right).click(function(){ ... $(#tv2).animate({left: +=110px}, 1500).animate({left: - =110px}, 0); $(#i2).animate({left: +=110px}, 1500); ... }); which both execute at the same time - exactly what I want - and what I would like to do is change the z-index of i2 after the animation has stopped. I tried appending .css(z-index, 19) to the end of the #i2 line (before the semi colon) but it seems to execute it straight away. (There are some more bits to the code but they will only clutter things up) Thanks paul.mac
[jQuery] Re: jQuery Curvy Corners
Thanks, I am going to take a look at this. JRC is worth mentioning as well, it's seems to be a bit faster than curvy corners but it also breaks down with nested HTML and for some reason it's interfering with the UI Dialog call... http://jrc.meerbox.nl/?p=13cpage=1#comment-1312 Also, any input into curvy corners would be greatly appreciated. On Jan 30, 11:07 am, Rusco j.reb...@gmail.com wrote: Hi, I also tried a lot of rounded corners plug-ins and found out that each one reveals its weakness once you begin nesting html-tags and messing around with css. The only somewhat reliable rounded corners plugin is imho: http://labs.parkerfox.co.uk/cornerz/ Rusco. On 30 jan, 07:57, Nikola nik.cod...@gmail.com wrote: I just discovered how nice jQuery Curvy Corners is. It works well in Firefox but only seems to work in IE7 when using jQuery 1.2.6. I did a quick search through the code to look for any obvious problems but I couldn't see any. This is a great plug-in and I'd really like to get it working. Any input or advice is greatly appreciated. http://blue-anvil.com/jquerycurvycorners/test.html Thanks, Nikola
[jQuery] jQuery Curvy Corners
I just discovered how nice jQuery Curvy Corners is. It works well in Firefox but only seems to work in IE7 when using jQuery 1.2.6. I did a quick search through the code to look for any obvious problems but I couldn't see any. This is a great plug-in and I'd really like to get it working. Any input or advice is greatly appreciated. http://blue-anvil.com/jquerycurvycorners/test.html Thanks, Nikola
[jQuery] Re: Happy 牛 Year !
Happy New Year to our Chinese friends! Long life and good health to you!
[jQuery] .append with a var
Hello, I am trying to figure out how to .append a php session $var to a given div. I'm not sure what the correct syntax is. I was trying something along the lines of how I'd display the var in HTML: $(#someDiv).append(Some value is:b'.$var.'/b); I'm not sure the best way to go about this. Any input is appreciated. Thanks much.
[jQuery] Re: .append with a var
Thanks, that's one of the expressions I tried out to no avail. I am trying to append an error message to a div much like how the form plug- in allows you to set a target container for server output. So, this entire function is within an if statement and is already being echoed. On Jan 22, 4:12 am, Liam Potter radioactiv...@gmail.com wrote: you would need to have the javascript with the php in the same file so it would be something like this ?php $var = testing; ? script type=text/javascript $(function () { $(#someDiv).append(Some value is:b?php $var ?/b);}); /script Nikola wrote: Hello, I am trying to figure out how to .append a php session $var to a given div. I'm not sure what the correct syntax is. I was trying something along the lines of how I'd display the var in HTML: $(#someDiv).append(Some value is:b'.$var.'/b); I'm not sure the best way to go about this. Any input is appreciated. Thanks much.
[jQuery] Re: Solution To Many Of Your CSS Nightmares!
One hour. I am betting that an individual with beginner to intermediate skill could find and replace the conflicting class names in the HTML, CSS and js. That is the cleanest, most logical and most professional solution in my opinion. It makes sense to make sense out of one's code especially if one is going to reactor it or make any changes.
[jQuery] Re: New Plugin: jQuery Finder (Mac-style 'Treeview' with Columns)
Super plug-in! the first thing that came to mind when I tried it out was the new jQuery 1.3 API...
[jQuery] Re: jQuery 1.3 Released
Well done!
[jQuery] Re: Once validated..
I see, you set a js var to equal the var in php, that's very good to know. Thank you.
[jQuery] Re: .animate() queue without pause between animations
It's hard to tell without having a look at the code. You may want to try http://paste.pocoo.org to post code like this. Are you chaining the animations? ie. $(this).animate({},speed).animate ({},speed).animate({},speed); You could always try setting a delay on your second animation with setTimeout. setTimeout ('$(this).animate({},speed)', 400); Hope that helps. Nikola
[jQuery] Re: .animate() queue without pause between animations
Also, you might want to try posting questions like this one in the jQuery UI group as .animate is part of jQuery UI. http://groups.google.com/group/jquery-ui?hl=enpli=1
[jQuery] Re: .animate() queue without pause between animations
What about doing something similar to what Karl Swedberg did in his animated scrolling example? http://www.learningjquery.com/2007/09/animated-scrolling-with-jquery-12
[jQuery] Re: .animate() queue without pause between animations
Ahh, sorry about that UI always comes to mind when I think of visual presentation, ie. fading, exploding, animating etc..
[jQuery] Re: jQuery 1.3rc1 Ready
Thanks for the info duck, I thought it was something along those lines... good to know.
[jQuery] Once validated..
I'm validating a form in php and am wondering how I can bind a jQuery function to a successful validation or how to check a var set in php with jQuery.
[jQuery] Re: IE8.
I'd like to start testing in IE8b2 as well but I can't seem to get it installed. Has anyone else had difficulties getting it up and running? I'm running Windows XP sp3. I installed IE8, rebooted but IE8 wouldn't start up. I checked the version to confirm it was installed and it was. I re-installed it again to no avail. I actually had the same problem with Google Chrome. The installation completed successfully but I was not able to run the program. I uninstalled IE8 now and am able to use IE7. I'm stumped...
[jQuery] Re: IE8.
I'd like to start testing in IE8b2 as well but I can't seem to get it working. Has anyone else had difficulties with it? My PC is running Windows XP sp3. I installed IE8, rebooted, but IE8 wouldn't start up. I checked the version to confirm it was actually installed and it was. I re-installed it again to no avail. I had the same problem with Google Chrome. The installation completed successfully but I was not able to run the program. I went ahead and uninstalled IE8 and IE7 works as usual...
[jQuery] Re: IE8.
I'd like to start testing in IE8b2 as well but I can't seem to get it working. Has anyone else had difficulties with it? My PC is running Windows XP sp3. I installed IE8, rebooted, but IE8 wouldn't start up. I checked the version to confirm it was actually installed and it was. I re-installed it again to no avail. I had the same problem with Google Chrome. The installation completed successfully but I was not able to run the program. I went ahead and uninstalled IE8 and IE7 works as usual...
[jQuery] Re: jQuery 1.3rc1 Ready
I was using 1.3b2 with UI1.6rc4 on one particular project I'm working on. I threw 1.3rc1 in to try it out and for some reason my tabs are all over the place. It will really take me some time to put a minimal case together but I'll try to narrow this down a bit tomorrow. Are there any particular changes between b2 and rc4 that would have a significant effect on tabs or anything that would effect the functionality of older plug ins like jCarousel or Galleria might not like?
[jQuery] Re: jQuery 1.3rc1 Ready
I was using 1.3b2 with UI1.6rc4 on one particular project I'm working on. I threw 1.3rc1 in to try it out and for some reason my tabs are all over the place. It will really take me some time to put a minimal case together but I'll try to narrow this down a bit tomorrow. Are there any particular changes between b2 and rc4 that would have a significant effect on tabs or anything that older plug-ins like jCarousel or Galleria might not like?
[jQuery] Re: jQuery 1.3rc1 Ready
Well, that was really strange. The problem was somewhere in the validate plug-in, I'm still working on this and not exactly sure what happened... but, all is well.
[jQuery] Debugging in IE7
I haven't really found a good solution for debugging in IE7. Any suggestions or recommendations? Thanks, Nikola
[jQuery] Re: Debugging in IE7
Thanks much, I'm going to try these all out later today.
[jQuery] Validation: Which and why...
I am wondering what the relative advantages / disadvantages are of validating purely in php vs. in jQuery.
[jQuery] Re: Validation: Which and why...
Thanks for the info, I was thinking along the same lines but wasn't altogether sure.
[jQuery] Re: Validation: Which and why...
Great information, I have some very strong ideas of when and how I'll impliment jQuery and php validation now. Thanks much, Nikola
[jQuery] Re: a:not named anchor
Indeed, thanks much... this is an extremely versatile and useful selector. Sorry for the double post. I deleted my initial message to fix a typo then had to re-post.
[jQuery] Re: Combo box problem
I learned a lot from that bit of code, great example.
[jQuery] Re: a:not referencing named anchors
That is a thing of beauty! Thanks much.
[jQuery] Re: a:not named anchor
Sure does, thanks much... this is an extremely useful and versatile selector. Sorry for double post. I deleted my initial message to fix a typo which in turn removed the entire message and I had to re-post it so now we have two.. ;)
[jQuery] a:not named anchor
Hi, I have a relatively simple question that I have been working on. I would like exclude all anchors that point to named anchors within a given page from a particular function. What's the simplest way to express this? Anchors that don't have # as the first character in their reference.. $(a:not # as the first character in their href).someaction Any ideas? Thanks much, Nikola
[jQuery] Re: Combo box problem
Off the top of my head, why not just use one list and append the relevant text?
[jQuery] a:not referencing named anchors
Hi, I have a relatively simple question that I have been working on. I would like to exclude all anchors which reference named anchors from a particular function. What's the simplest way to express this? Although I don't quite know how I'd write this up I was thinking something along the lines of: Anchors that don't have # as the first character in their reference.. $(a:not # as the first character in their href).someaction Any ideas? Thanks much, Nikola
[jQuery] Re: jQuery 1.3b1 and the Galleria Plug-In
Thats great info... I did the same but in my case the caption text is missing where as the prev/next buttons are ok.
[jQuery] Re: jQuery 1.3b1 and the Galleria Plug-In
The image thumbs don't stay active when selected for some reason. I still haven't really dove into Galleria yet as I'm working on some things with Dialog at the moment but I thought I'd mention it... @Deaven Select Edit my membership and choose your notification preferences...
[jQuery] jQuery 1.3b1 and the Galleria Plug-In
Has anyone had any problems with Galleria and jQuery 1.3b1? Galleria seems to be incompatible with 1.3B1. I'll try to dig into later and see what I come up with...
[jQuery] Re: .animate and border sides
Thanks Ricardo, I forgot to link to UI in my minimal case but I do have it included in the project I am working on so that wasn't the problem. I was, however, unaware of the borderSideColor color animation. Sometimes the answers can be right under ones nose. Thanks much... now if I could just find my glasses. haha
[jQuery] .animate and border sides
Hello, I am trying to animate a color change for the top and right borders of an element. A) In Firefox the border size is animated but the color change is not on the first hover only. After that the border color changes as though you were affecting it via a pseudo class in CSS. B) Behavior in IE7 varies. In some cases animating a borderSide breaks the code altogether. In the minimal case I'm providing the top border changes color without animation and there is no effect on the right border. It would be great to be able to animate individual border sides. In addition it would be great to control what aspect of the border we wish to animate, just the size, size and color, just the color etc.. Animating individual border colors can be very useful... MINIMAL TEST CASE: http://paste.pocoo.org/show/96878/ Thanks, Nikola
[jQuery] Re: .animate and border sides
You can play around with it more here: http://jsbin.com/anala/edit
[jQuery] Re: Merry Xmass
God Peace Christ is born! Merry Christmas from America to all!
[jQuery] Re: middleclick event
On Jan 17, 3:39 am, RobG [EMAIL PROTECTED] wrote: Control + click or command + click also opens links in a new tab for some settings in some browsers. I can also set Firefox to always open new windows in a tab, trying to stop that is futile. Absolutely correct. There are many ways to open a link. However my intentions are not preventing the user from opening any link at all. I just want to record exactly which links are clicked. The thing is that it is possible to have the same anchor in the content and in the sidebar. I want to know which one is clicked. And by all means load the link :) Maybe mousedown is the way to go but I'm unsure about firing it when the right mouse button is clicked.
[jQuery] Re: middleclick event
In any case the main question is: is there a way to catch the middleclick?
[jQuery] middleclick event
Hello, I'm working an a very simple behavior: capturing clicks on anchors. Binding the click event and doing the rest of the logic is easy. Problem is the middle click (opens the link in a new tab) and both available options in the context menu: open in new tab/open in new window. While it's hard to imagine that the browser fires an event for the clicked option in the context menu, I'm looking now for capturing the middle click. And I've been looking for it for some time now. The close I get to my desired behavior is to bind the mousedown event. Do you know of a way to catch the middle-click? What do you think of mousedown?
[jQuery] Re: jQuery Logging (to firebug)
How about integrating it in the core? After if ( console ) of course
[jQuery] parents() clears vars
I have the following funtion: function foo() { console.log( arguments ); // -- OK var e = arguments[0]; console.log( e );// -- OK var p = arguments[0].parents( 'li' ); // -- problem occurs ONLY if this selection is empty // and empty selection is legit in my case // same behavior also when var p = e.parents( 'li' ) ; console.log( arguments ); // -- if p.empty -- [ ], else OK console.log( e );// -- if p.empty -- [ ], else OK console.log( p );// -- OK } What am I missing? Thank you.
[jQuery] parents() clears vars
I have the following funtion: function foo() { console.log( arguments ); // -- OK var e = arguments[0]; console.log( e );// -- OK var p = arguments[0].parents( 'li' ); // -- problem occurs ONLY if this selection is empty // and empty selection is legit in my case // same behavior also when var p = e.parents( 'li' ) ; console.log( arguments ); // -- if p.empty -- [ ], else OK console.log( e );// -- if p.empty -- [ ], else OK console.log( p );// -- OK } What am I missing? Thank you.
[jQuery] Re: parents() clears vars
What does OK mean? It means, that I'm getting the expected output. What's the problem? The problem is that after calling e.parents(), arguments gets cleared out and is afterwards empty, but only when parents( 'li' ) is empty. How are you trying to use this function? I have a recursive tree with an unknown depth. When a leaf is clicked I want to navigate to the top of the tree. I know this may not be the best approach, but I'm having a deadline and right now best performance is not top issue. However it will be in the future, but then I will have enough time to investigate all possible ways of doing this. So, when a leaf (leafs are wrapped in span) is clicked, I select all parents that are li and check each one li to see if its direct parent is( 'ul.treeview' ). There is one situation (see P.S.): 1) a leaf with depth = 0 is clicked == parents( 'li' ) is not empty, but after calling it arguments points to the same object as parents( 'li' ) P.S. I had an incorrect wrapping of span and a and that was the reason for parents( 'li' ) to return an empty object. Now it always return the correct li parents of the curent element. But the problem remains - other variables inside the same function are changed and all the same: parents( 'li' ) Thank you. Nikola
[jQuery] Re: parents() clears vars
Gee, I've just read my last post: I couldn't understand my point :). Sorry about that, I will give it a new shot: Consider the tree: ul class=treeview liaspanel 1/span/a/li liaspanel 2/span/a/li li aspanel 3/span/a ul liaspanel 3.1/span/a/li liaspanel 3.2/span/a/li li aspanel 3.3.1/span/a ul liaspanel 3.3.1/span/a/li /ul /li /ul /li /ul Goal is: when clicked on el 3.3.1 to navigate to el 3, click event is bundled with the span element. This means: I want the span surrounding 'el 3' My idea: despite the depth of the list 'e.parents( 'li', $ ('ul.treeview') );' returns a set ot li elements. one of this li elements is a direct descendant of the top ul list, so selecting the span element inside this li is made by .children().children()[0]. Because of my unadvanced knowledge about the selectors I'm making this by iterating the resultset and checking each one element to see if it fits my criteria. The Problem: let's say 'e' points to a single element, consider this: console.log( e ); // -- [span] var p = e.parents( 'li', $('ul.treeview') ); console.log( e ); // -- [li] console.log( p ); // -- [li] or, which is even more frustrating: foo( 1,2 ) function foo() { var a = arguments; console.log( a ); // -- [1,2] var e = $( $( 'span' )[a[0]] ); console.log( e ); // -- [span] var p = e.parents( 'li', $('ul.treeview') ); console.log( a ); // -- [li] console.log( e ); // -- [li] console.log( p ); // -- [li] } jQuery version is: 1.0.4 and unfortunately I can't change it Now, let's hope I've managed it to be more precise about my thoughts :) Greetings -- Nikola