[jQuery] Re: Superfish image menu
I looked at your page. It seems like you have the CSS figured out. Nice menu! The styling to show where the user is would be via classes on the relevant list item. This is not something that Superfish does - it's best done on the server-side via PHP or whatever you use there. That way your menu is not reliant on JS being available to provide that navigation info. Once you have the current class being added to the relevant list items (via your back-end script) you can then use Superfish to add further enhancements such as smoothly fading in the submenus rather than the instant CSS behaviour, timed delay on mouseout to negate minor mouse-piloting errors, and so on. I'd also recommend using the pathClass option for this type of menu. You can read more about that and check out the code I used here: http://users.tpg.com.au/j_birch/plugins/superfish/all-horizontal-example/ Joel Birch.
[jQuery] Re: Superfish Menu Width Auto Resize
Personally, I just design the menu so that the longer menu items do flow onto a second or even third line if required. You have to use padding instead of text-indent to provide the horizontal spacing in this case. As for your original request which would resize the width so that the menu items are always only one-liners, I think that's a good idea for a separate plugin that you could then add to the function chain after Superfish. $('ul.nav').superfish().submenuResize(); Joel Birch.
[jQuery] Re: Superfish pathClass problem
Hi Dave, Sorry, but I don't understand your issue from what you posted. Can you explain further please. Cheers Joel Birch.
[jQuery] Re: Superfish skins...
Hi Phil, No there is no resource like that unfortunately - the styling has been down to the developer. The easiest thing to do is start with the demo CSS which as you can see is very basic, and alter the CSS file gradually (remember to check IE as you go so you know when bugs occur) to get the style you want. There is a commented version of one of the Superfish CSS files which may help you to understand what each rule does, here: http://users.tpg.com.au/j_birch/plugins/superfish/superfish.commented.css In that (rather messy looking) file I have attempted to separate the styling into two groups - the essential styles that are crucial to Superfish working (but in some cases can be tweaked slightly), and the skin styles that are purely presentational which you can alter to your heart's content. Joel Birch.
[jQuery] Re: Need help on jQuery.browser.version
On May 5, 1:11 pm, chrbar [EMAIL PROTECTED] wrote: Thanks a lot Mike, I've tried, it works perfectly! I would like to add FF 1 and IE 5 which are not supported too. Could you tell me if my code is correct... I think I did an error: Now you see the futility of browser detection as a strategy. Are you going to add a user agent sniff for every single browser that your site doesn't support? Create a feature detection test that ensures the appropriate features are supported and use that, then you don't care what the browser UA string is. URL: http://www.jibbering.com/faq/faq_notes/not_browser_detect.html -- Rob
[jQuery] Re: [autocomplete] Hyperlinks in returned list
I've documented my approach here: http://docs.jquery.com/Plugins/Autocomplete#Search_Page_Replacement Jörn On Sat, May 3, 2008 at 10:23 AM, theintoy [EMAIL PROTECTED] wrote: Jörn Hi. I would appreciate your solution too. Having checked the solution provided by Chris across all browsers, it appears IE7 throws an alert with the following text: Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus. I have assumed this is due to the textfield being made read-only. This was a nice touch by Chris and one which would be nice to keep in. Any ideas? Carl
[jQuery] Help With XML Parsing + Array Manipulation
Here is what I'm trying to do: (1) Parse an external XML, (2) enter the list of devices in the XML into an array, (3) sort the array alphabetically (and group items in the arrays by name if possible), (4) print the devices individually in table cells. Ideally, I'd like if the devices taken from the XML file (straightforward: just devicesdevice device1 /devicedevice device2 /device ... /devices) could be more easily manipulated. $(function() { $.ajax({ type: GET, url: devices.xml, dataType: xml, success: function(xml) { // create array for the devices var device_name = '', device_array = []; // iterate through the xml and add the devices to the array $(xml).find('device').each(function(index){ device_name = ($this).text(); device_array.push(device_name); }); // sort the array device_array.sort(); // iterate through and print the elements for (var i = 0, item; item = device_array[i]; i++) { $('trtd class=device_name/td/tr') .html(item) .appendTo('#devicelist'); }; } }); }); -- This just outputs a blank space. I know there's an issue with sorting on jQuery arrays, but I don't think that's where the script is failing. Altogether, I'm having a difficult time trying to manipulate an on-the-fly table created from a parsed XML, but can't think of any alternatives. If it's of any help, the following script works, but doesn't produce a sorted, manipulate-able set of devices: $(function() { $.ajax({ type: GET, url: devices.xml, dataType: xml, success: function(xml) { $(xml).find('device').each(function(index){ var device_name = $(this).text() // create table layout $('trtd class=device_name/td/tr') .html(device_name) .appendTo('#devicelist'); }); } }); });
[jQuery] Refresh a Div in a page (via a button)
Hello, I'm looking for a code/script which allows the user to refresh (via a button) a specific Div inside a Web page, without refresh the full page. Do you have any idea how to do that? Thanks a lot for your help :) Chris
[jQuery] Re: Reinitialization of css values
Greaaat! Thank you! My div are draggables and resizables. Now I would like to restore them in the previous state they were before I first click on it. Is that possible, please? Thanks! -Gildas On May 6, 6:54 pm, Richard D. Worth [EMAIL PROTECTED] wrote: $(this).attr('style', ); -or- $(this).removeAttr('style'); - Richard On Tue, May 6, 2008 at 9:51 AM, Gildas [EMAIL PROTECTED] wrote: Hello people! I'm looking for a solution to put div properties to initial state. Explanation : $(div).toggle(function(){ $(this).animate({ width : 90%, height : 90%, left : 5%, top : 5% },500); },function(){ //Reinitialization of initial values which are described in the CSS file }); Thank you!
[jQuery] superfish in ie5.5
A days ago i asked a question about compatibility of superfish in ie5.5. Now i see this: http://www.i-cre8.co.uk/sf-menu/ A superfish menu that works in ie5.5 at least in part (works, submenus but no sub-submenus) What is the difference?? How to implement this?
[jQuery] Re: using.attr('type') returns undefined
works fine in my web as well ... may be you make a typo mistakes :) On May 7, 5:12 am, JP [EMAIL PROTECTED] wrote: if i have input id=fname name=fname type=text value= / if I do: $('#fname').attr('type') - it returns undefined how can I get the type ?
[jQuery] Re: TableSorter + Filtering + Ajax
Hi Patrick, with Flexigrid, filtering is already possible! Using the following options, you can filter the initial data that is displayed. $(#flex1).flexigrid ( { url: 'post2.php', dataType: 'json', query: 'Dublin', qtype: 'city', colModel : [ {display: 'ID', name: 'id' width : 20, sortable : false, align: 'center'}, {display: 'City name', name : 'city', width : 200, sortable : true, align: 'left'} ], sortname: city, sortorder: desc, usepager: true, resizable:false, title: 'Cities', useRp: true, rp: 10, showTableToggleBtn: false, width: 500, height: 400 } ); The 'query' and 'qtype' options do the trick! And with this filtered data, you can still page through your ajax'd data! Kevin On May 6, 10:13 pm, patrick davey [EMAIL PROTECTED] wrote: Hi Kevin, That looks like a really excellent plugin - might have to give it a try. The one thing it doesn't do that I need it to - is *filtering*. That is, say I am returning rows and one of the columns is a city - and there may be multiple rows with the same city data. I want to be able to choose 'Dublin' and then only have rows which have dublin as a city returned. And then... I want to be able to continue sorting and paging through my ajax'd data! Fun eh ;) When I get something working I'll try to post it up somewhere... as long as I can make it readable etc! Thanks, Patrick On May 6, 9:47 pm, Kevin Kietel [EMAIL PROTECTED] wrote: Try Flexigrid! http://webplicity.net/flexigrid/ This jQuery plugin is a Lightweight but rich data grid with resizable columns and a scrolling data to match the headers, plus an ability to connect to an json/xml based data source using Ajax to load the content. If you need any help implementing it, just contact me or take a look at the Flexigrid discussion on CodeIgniter forums:http://codeigniter.com/forums/viewthread/75326/ There are several examples that you can use. Let me know if this is what you're looking for! Bye, Kevin On May 6, 2:18 am, patrick davey [EMAIL PROTECTED] wrote: Hi, I am using the tablesorter pluginghttp://tablesorter.com/andit works fine for smallish tables. However, I need to page through large result sets (and filter them) - so I am going to use AJAX to repopulate the table once the options have been selected. Now, if through filtering / whetever - less than 100 rows are returned, then I want tablesorter to just sort the table (without having to make an AJAX call) To do this I want to edit the tablesorter plugin to call a function which returns true/false depending on how many records there are to sort. So my question (there is one!) is how do I do that with tablesorter. I have tried using 'sortStart' and returning false but no joy. I can edit the source of course - but if there is a simple way I'd love to know it. Better still, does anyone have an example of doing filteringsorting paging of large datasets using JSON/AJAX and Jquery? :) Thanks, Patrick
[jQuery] Re: Superfish pathClass problem
Joel, am I right in thinking that I have to add the css class to the relevant li items manually ? -- Dave Buchholz I-CRE8 http://www.i-cre8.co.uk Skype ID: I-CRE8 On May 7, 7:10 am, Joel Birch [EMAIL PROTECTED] wrote: Hi Dave, Sorry, but I don't understand your issue from what you posted. Can you explain further please. Cheers Joel Birch.
[jQuery] how to access this function (flexigrid)
Hi .. I download the Flexigrid from http://www.webplicity.net/flexigrid/ and I just doing a test, everything work fine but I found that my quick search doesn't work .. and I don't know why. I have read the code and found doSearch() function to perform search ... but I don't know how to call it manually (I mean from my own button). But I am here to ask ... how to get access for doSearch function in Flexigrid. (I want to have my own quick search that's not embed in Flexigrid table) [code] var g = { hset : {}, the rest of the code .. doSearch: function () { p.query = $('input[name=q]',g.sDiv).val(); p.qtype = $('select[name=qtype]',g.sDiv).val(); p.newp = 1; this.populate(); }, another codes here } [/code] Another questions, in line 1191 [code] $('input[name=q],select[name=qtype]',g.sDiv).keydown(function(e) {if(e.keyCode==13) g.doSearch()}); [/code] I just knowing that I could type input[name=q], etc .. I just curious and want to learn more about this syntax. Which documents/web I should read to know more about this ?
[jQuery] Re: Flash file redraw cutting through JS pop up window
Hi guys Apologies for the late reply to this. thanks so much for your help, all useful information I didnt know - hope it will also be useful for others too. I now have a slightly strange thing going on though... The wmode (in my case using object) works to stop the flash redraw on the main pop up window, its background - and any overlay images... however if another Flash element is visible over the chosen flash file on the page underneath - the flash file seems to 'rise to the top' and become visible again (the whole banner - not just the redraw regions) this may sound a little confusing - let me just clarify the context. I have made a banner chooser. a user goes to a 'page setup' area where they can choose a banner to be displayed on that page. when the user selects 'choose' - a lighbox esque pop up appears showing all of the available banners. when they choose the banner to use - the banner is then pulled into the main page - showing it has been selected. the problem then occurs if the user wishes to select a different banner. bringing up the chooser for a second time (to select a different banner) will then show all the available banners, but the flash banner now displayed on the page beneath the popup (the pop up window is semi transparent) now 'cuts through' the window ONLY when it is directly below a flash banner - i.e. it only seems to happen if the flash files are kind of touching ('dont cross the streams!' - Dr. Egon Spengler) sorry if this is over egging the pudding so to speak, just wanted to clarify the problem as its really getting on my nuts now!! L On Mar 28, 9:28 pm, Alexandre Plennevaux [EMAIL PROTECTED] wrote: good point Karl, it's typically the wmode that has to be set to transparent. Be aware that it will make your flash file more resource-intensive on low spec computers. but if it's just for running ads, it shouldn't be a problem. On Fri, Mar 28, 2008 at 7:43 PM, Karl Swedberg [EMAIL PROTECTED] wrote: Hi Lewis, It could be a z-index issue, but you probably have to also set wmode to transparent for the flash object. If you're using swfObject, you can just use: so.addParam(wmode, transparent); for embed, you add the attribute: wmode=transparent for object, you do param name=wmode value=transparent / hope that helps --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Mar 28, 2008, at 11:44 AM, Lewis wrote: Hi i have a problem where im calling a JS pop-up overlay (is a custom script not adapted from the various lightbox plugins around ) but when the overlay is over the page - the redraw sections of the flash banners are cutting through the js window showing the banners animating content. is this a z-indexing problem - or is there something in Jquery i need to call to eliminate? if anyone has experienced similar problems and resolved it, drop me a line - or if you might have a solution and need some more info - lemmie know as im stuck :( thanks L -- Alexandre Plennevaux LAb[au] http://www.lab-au.com
[jQuery] jqModal add trigger with javascript
Hi! When I add a trigger with javascript and after that I click on the trigger, the jqModal doesn't show. First i Click on show jqModal and everything works perfectly, after that i click on show 2nd trigger and the 2nd trigger is shown. Now i Click on the 2nd trigger show jqModal2 but nothing happens. When i click on show jqModal everything works. Here is my code (i wrote a { instead a in the front of the a-tags, otherwise i hasn't been shown correctly here): ... script $(document).ready(function(){ $('#divModal').jqm({trigger: '.jqModal'}); }); function helpClick() { $(#help).html('{a href=# class=jqModalShow jqModal2{/a'); } /script ... {a href=# class=jqModalShow jqModal{/abr / {a href=# onClick=helpClick();show 2nd trigger{/a div id=help/div div id=divModal class=jqmWindowlorem ipsum, /div -- View this message in context: http://www.nabble.com/jqModal-add-trigger-with-javascript-tp17099129s27240p17099129.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Superfish Menu Fade-out
Thanks Joel Hadn't heard of Accordion but I'll give it a go. I agree, the delay stuff isn't needed quite so much with my nav. I'll see what I can do with it :o) Cheers On 7 May, 15:41, Joel Birch [EMAIL PROTECTED] wrote: Hi Reuben, No further progress to report on the closing animations for Superfish I'm afraid. Looking at your page, it seems like maybe the Accordion plugin may be more suitable for your menu. Have you looked into that? Your menu behaves just like an Accordion menu. The only thing you would miss out on is the timed delay, which really helps usability for most dropdowns, but your style of menu does not need it so much. Also, adding the hoverIntent plugin with Accordion will give you back some of the benefits of the delay feature I think. Joel Birch.
[jQuery] Re: Unified approach to get the value of input fields
$(:input).val() - Richard On Wed, May 7, 2008 at 5:35 AM, August Lilleaas [EMAIL PROTECTED] wrote: Hello there, A textarea's value is inside the actual textarea tags, while input fields values is stored in the value attribute on the tag. Is there a unified way to get the value of both text areas and input fields? $ (:input).attr(value) works for input fields, $(:input).text() works for textareas. But not for both. Ideas?
[jQuery] Re: Help With XML Parsing + Array Manipulation
Try this $(function() { $.ajax({ type: GET, url: devices.xml, dataType: xml, success: function(xml) { $ (xml.responseXML).find('device').each(function(index){ var device_name = $(this).text() // create table layout $('trtd class=device_name/td/tr') .html(device_name) .appendTo('#devicelist'); }); } }); Regards Tony On May 7, 7:35 am, catharsis [EMAIL PROTECTED] wrote: Here is what I'm trying to do: (1) Parse an external XML, (2) enter the list of devices in the XML into an array, (3) sort the array alphabetically (and group items in the arrays by name if possible), (4) print the devices individually in table cells. Ideally, I'd like if the devices taken from the XML file (straightforward: just devicesdevice device1 /devicedevice device2 /device ... /devices) could be more easily manipulated. $(function() { $.ajax({ type: GET, url: devices.xml, dataType: xml, success: function(xml) { // create array for the devices var device_name = '', device_array = []; // iterate through the xml and add the devices to the array $(xml).find('device').each(function(index){ device_name = ($this).text(); device_array.push(device_name); }); // sort the array device_array.sort(); // iterate through and print the elements for (var i = 0, item; item = device_array[i]; i++) { $('trtd class=device_name/td/tr') .html(item) .appendTo('#devicelist'); }; } }); }); -- This just outputs a blank space. I know there's an issue with sorting on jQuery arrays, but I don't think that's where the script is failing. Altogether, I'm having a difficult time trying to manipulate an on-the-fly table created from a parsed XML, but can't think of any alternatives. If it's of any help, the following script works, but doesn't produce a sorted, manipulate-able set of devices: $(function() { $.ajax({ type: GET, url: devices.xml, dataType: xml, success: function(xml) { $(xml).find('device').each(function(index){ var device_name = $(this).text() // create table layout $('trtd class=device_name/td/tr') .html(device_name) .appendTo('#devicelist'); }); } }); });
[jQuery] Re: TableSorter + Filtering + Ajax
Uhmm ... flexigrid looks more difficult to master that tablesorter :) btw, can tablesorter sort using ajax and pagination. I have 1000 data and I dont want to throw all the data to user. so i use pagination, separated into 10 records per page ... but I dont have any idea how to override the sort function, because when the sort clicked, I want to call my ajax function and doing sort from database. On May 7, 3:13 am, patrick davey [EMAIL PROTECTED] wrote: Hi Kevin, That looks like a really excellent plugin - might have to give it a try. The one thing it doesn't do that I need it to - is *filtering*. That is, say I am returning rows and one of the columns is a city - and there may be multiple rows with the same city data. I want to be able to choose 'Dublin' and then only have rows which have dublin as a city returned. And then... I want to be able to continue sorting and paging through my ajax'd data! Fun eh ;) When I get something working I'll try to post it up somewhere... as long as I can make it readable etc! Thanks, Patrick On May 6, 9:47 pm, Kevin Kietel [EMAIL PROTECTED] wrote: Try Flexigrid! http://webplicity.net/flexigrid/ This jQuery plugin is a Lightweight but rich data grid with resizable columns and a scrolling data to match the headers, plus an ability to connect to an json/xml based data source using Ajax to load the content. If you need any help implementing it, just contact me or take a look at the Flexigrid discussion on CodeIgniter forums:http://codeigniter.com/forums/viewthread/75326/ There are several examples that you can use. Let me know if this is what you're looking for! Bye, Kevin On May 6, 2:18 am, patrick davey [EMAIL PROTECTED] wrote: Hi, I am using thetablesorterpluginghttp://tablesorter.com/andit works fine for smallish tables. However, I need to page through large result sets (and filter them) - so I am going to use AJAX to repopulate the table once the options have been selected. Now, if through filtering / whetever - less than 100 rows are returned, then I wanttablesorterto just sort the table (without having to make an AJAX call) To do this I want to edit thetablesorterplugin to call a function which returns true/false depending on how many records there are to sort. So my question (there is one!) is how do I do that withtablesorter. I have tried using 'sortStart' and returning false but no joy. I can edit the source of course - but if there is a simple way I'd love to know it. Better still, does anyone have an example of doing filteringsorting paging of large datasets using JSON/AJAX and Jquery? :) Thanks, Patrick
[jQuery] Re: Problem using livequery jquery.form and simplemodal together
still getting used to google groups here. thought i posted a reply yesterday but it didnt show up here. options is set with var options = { target:'#fastcart' // target element(s) to be updated with server response }; thanks for your reply.
[jQuery] Re: Photo Crop proposal
I've experienced with the jquery crop plugin.. I am busy with an imagemanager, where u can do lots of things with images. (rotate / crop / drag - drop / etc.) take a look @ http://www.netvibe.nl/imagemanager/ On May 6, 8:22 pm, Richard D. Worth [EMAIL PROTECTED] wrote: On Mon, May 5, 2008 at 11:21 AM, LTG [EMAIL PROTECTED] wrote: Please see the video of my prototype here: http://www.hdgreetings.com/view.aspx?name=JQuery%20Crop%20Prototypev... Funny story. At 0:45 in your video, the picture of the family sitting on the bench/porch swing - that's my brother's family (I waited to check with him before I posted, and he's cool with it). #1 google image search for 'family' when filtered for Extra Large images http://images.google.com/images?q=familyum=1hl=ensa=Nimgsz=huge I'm curious. Is that how you found it? It's a great picture for what you're demonstrating. - Richard
[jQuery] getJSON, $(this) and scope
Hi everybody - new to both this group and jQuery, so please be gentle ;) I have some code which roughly looks something like this: $(.container ul li a).click( // only do the JSON if the a isn't followed by a DL if(!($(this).next(dl).length)){ $.getJSON(json.js, function(data){ htmlString = dldtResults:/dtddOutput: + data.title + , Input: + data.name + /dd; }); ) ) Now, what I want to do is put htmlString after the a-object - $(this) - , but obviously I am out of scope, so I can't just add it like this $(this).after(htmlString) Any suggestions on how I can do this?
[jQuery] Unified approach to get the value of input fields
Hello there, A textarea's value is inside the actual textarea tags, while input fields values is stored in the value attribute on the tag. Is there a unified way to get the value of both text areas and input fields? $ (:input).attr(value) works for input fields, $(:input).text() works for textareas. But not for both. Ideas?
[jQuery] Re: Superfish pathClass problem
Yes, that's correct. It's a job best suited to a server-side language so that the current information is still present when JS is not available. Joel Birch.
[jQuery] Re: Refresh a Div in a page (via a button)
On Mittwoch, 7. Mai 2008, chrbar wrote: I'm looking for a code/script which allows the user to refresh (via a button) a specific Div inside a Web page, without refresh the full page. Use an (on)click event on a button that points to Javascript issuing a $.load from your backend to the DIV area. Of course your backend needs to send a partial page. (Or you use $.load's abilities to load just a part of the DOM you get from the backend.) Christoph signature.asc Description: This is a digitally signed message part.
[jQuery] [ANNOUNCE] markItUp! 1.1 is released!
Hi all, markItUp! 1.1 is released! This release brings thousands bug fixes, better cross-browser compatibility (Mac users will be happy!), removal function, Html preview in templates, and due to popular demand, no more absurd textarea ID moving. Some advanced examples and add-ons have been added for the occasion. markItUp! 1.0 is no longer supported. Thanks! markItUp! http://markitup.jaysalvat.com/ -- http://markitup.jaysalvat.com/examples/ http://markitup.jaysalvat.com/downloads/
[jQuery] Re: getJSON, $(this) and scope
On Wed, May 7, 2008 at 2:30 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi everybody - new to both this group and jQuery, so please be gentle ;) I have some code which roughly looks something like this: $(.container ul li a).click( // only do the JSON if the a isn't followed by a DL if(!($(this).next(dl).length)){ $.getJSON(json.js, function(data){ htmlString = dldtResults:/dtddOutput: + data.title + , Input: + data.name + /dd; }); ) ) Now, what I want to do is put htmlString after the a-object - $(this) - , but obviously I am out of scope, so I can't just add it like this $(this).after(htmlString) Any suggestions on how I can do this? Save 'this' in a var first: $(.container ul li a).click(function() { // only do the JSON if the a isn't followed by a DL var $a = $(this); // save the anchor if ( ! ($a.next(dl).length) ) { $.getJSON(json.js, function(data) { var s = dldtResults:/dtddOutput: + data.title + ,Input: + data.name + /dd; $a.after(s); }); } });
[jQuery] slideToggle Problem
Hello, I am using this code to slide a div up/down: $(#slide).click(function(){ $(#slider).slideToggle(slow); $(this).toggleClass(active); }); It works alright, just like it's supposed to, but how can I have the #slide div be in the up position by default? Right now it's always down when the page loads... Thanks for the help, Bo
[jQuery] Re: strange behaviour: multiple selectors responding
karl, thanks for your help. you make it seem so easy... On May 6, 10:33 pm, Karl Swedberg [EMAIL PROTECTED] wrote: Hi Bob, I'd probably just do this without the ajaxStart and ajaxStop methods. Try this: $(#contests ul li span a).toggle( function(){ //store ref to toggling element for use in ajax callbacks... var lnk = $(this); var url_title = lnk.html(); lnk.html(loading...); // just before the stuff is loaded $(.contest-form- + this.name).load(this.href, function() { lnk.html(url_title); // after the stuff is loaded }).show(); return false; }, function(){ $(.contest-form- + this.name).hide(fast); return false; } ); --Karl _ Karl Swedbergwww.englishrules.comwww.learningjquery.com On May 6, 2008, at 6:34 AM, bobh wrote: I'm afraid the behaviour is still there using your code. I've updated my example page with it. On May 6, 12:25 am, Wizzud [EMAIL PROTECTED] wrote: The problem is the context of 'this' within the ajaxStart() and ajaxStop() functions. try this instead... $(#contests ul li span a).toggle( function(){ //store ref to toggling element for use in ajax callbacks... var lnk = $(this); var url_title = lnk.html(); lnk.ajaxStart(function(){ lnk.html(loading...); }).ajaxStop(function(){ lnk.html(url_title); }); $(.contest-form- + this.name).load(this.href).show(); return false; }, function(){ $(.contest-form- + this.name).hide(fast); return false; } ); On May 5, 2:26 pm, bobh [EMAIL PROTECTED] wrote: hi, I'm trying to change the innerHtml of an anchor to loading for the duration of an ajax load with this code: $(#contests ul li span a).toggle( function(){ var url_title = $(this).html(); $(this).ajaxStart(function(){$ (this).html(loading...);}).ajaxStop(function(){$ (this).html(url_title);}); $(.contest-form- + this.name).load(this.href).show(); return false; }, function(){ $(.contest-form- + this.name).hide(fast); return false; } ); both the ajax load and the text replacing work fine. the problem however is that all links that have been clicked are getting the loading innerHtml. in stead of only the one that is clicked on. for clarification I've put an example page online here:http://allnighters.net/jq/ . try clicking a few different links. thanks
[jQuery] Re: getJSON, $(this) and scope
Thanx a lot for that :)
[jQuery] How to start a slide show (Cycle Plugin)
Hi, I have a following problem: I used a Cycle Plugin configured as follows: $('#s4').cycle({ fx: 'custom3', easeOut: 'backin', easeIn: 'bounceout', after: onAfter4, speed: 800, timeout: 3, autostop: 1, autostopCount: 2, cssBefore: { top: 0, left: 0, width: 308, height: 0, zIndex: 1 }, animIn: { width: 308, height: 282 }, animOut: { top: 0, left: 0, width: 308, height: 0 }, cssAfter: { zIndex: 0 }, delay: 0 }); and I don't know how to start my slideshow after it stops (due to options: autostop and autostopCount). I know there are two opposite arguments - 'pause' and 'resume' that allow us to control our slideshow (for example: $('#s4').cycle('pause');). I've seen in documentation that there is also 'stop' argument - which holds the slideshow, but I can't find the opposite one, which starts the slideshow. Does anyone know how to turn it back on? Best regards.
[jQuery] Re: How to start a slide show (Cycle Plugin)
and I don't know how to start my slideshow after it stops (due to options: autostop and autostopCount). I know there are two opposite arguments - 'pause' and 'resume' that allow us to control our slideshow (for example: $('#s4').cycle('pause');). I've seen in documentation that there is also 'stop' argument - which holds the slideshow, but I can't find the opposite one, which starts the slideshow. Does anyone know how to turn it back on? Best regards. Just call cycle again like you did the first time, passing in the desired args.
[jQuery] Loading a js file with the ajax content
i already have a base javascript file containing $ (document).ready().. but i am loading a content using ajax into a div container for those items i just need to load a js file with a $ (document).ready() can any one help me regards vimal das
[jQuery] Re: slideToggle Problem
never mind, found the answer about 1 minute after posting this here On May 7, 9:39 pm, Bo [EMAIL PROTECTED] wrote: Hello, I am using this code to slide a div up/down: $(#slide).click(function(){ $(#slider).slideToggle(slow); $(this).toggleClass(active); }); It works alright, just like it's supposed to, but how can I have the #slide div be in the up position by default? Right now it's always down when the page loads... Thanks for the help, Bo
[jQuery] IE7, window.open hangs
I am trying to add JQuery functionality to a window created with window.open, document.write, etc. and as a result IE7 is hanging (99% cpu). Here is the html creating the window: html head titleJunk1/title script src=\cgi-bin\jquery-1.2.3.js/script script language=JavaScript type=text/JavaScript $(document).ready(function() { alert('Test'); }); function popUp() { OpenWindow=window.open(, newwin, height=700, width=400,toolbar=no,resizable=yes,scrollbars=+scroll+,menubar=no); OpenWindow.document.write('html'); OpenWindow.document.write('headtitlePopUp\/title'); OpenWindow.document.write('script src=\\cgi-bin\\jquery-1.2.3.js\/ script'); OpenWindow.document.write('script src=\\cgi-bin\\inPopUp.js\/ script'); OpenWindow.document.write('script type=text\/javascript'); OpenWindow.document.write('$(document).ready(function() {'); OpenWindow.document.write('alert(in1);'); OpenWindow.document.write('});'); OpenWindow.document.write('$(document).ready(function() {'); OpenWindow.document.write('alert(in2);'); OpenWindow.document.write('});'); OpenWindow.document.write('\/script'); OpenWindow.document.write('\/head'); OpenWindow.document.write('body'); OpenWindow.document.write('span class=ml_Money$123,456.78\/ span'); OpenWindow.document.write('\/body\/html'); OpenWindow.document.close(); }; /script /head body a href=javascript:popUp();PopUp/a /body /html and here is inPopUp.js: $(document).ready(function() { alert(in0); }); If I remove inPopUp.js then the popup window works fine, and repeatably. However, with it the new window can be opened and close only 0 to 4 times (seems random) before IE7 hangs (TaskManager shows high cpu). I have tested this with Safari v3 and it works fine, no matter how many times I open and close the window. Any ideas/ suggestions? Dennis
[jQuery] Re: validating dynamically generated data
pedalpete wrote: Have you checked out the validate plugin? http://plugins.jquery.com/project/validate Their is a method they have where you can actually run an ajax call to your server to check for a valid input, or you could use it with your statically set value as you have already done. I've looked at that. But data I need to compare is right there on the page! All I want to do is say: On keyup () { var x = getCurrentValue(input); var y = getCurrentValue(div.qty); if (x y) { error(not enough in stock); } } -- View this message in context: http://www.nabble.com/validating-dynamically-generated-data-tp17091060s27240p17104102.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Expression/Selector question...
Just wonder if there were any comments to this? On May 5, 4:24 pm, Dan G. Switzer, II [EMAIL PROTECTED] wrote: One thing that I've noticed is that the expr attribute is pretty inconsistent across methods (such as filter, find, parents, parent, etc.) The documentation is very vague about what an expression is, other than it just being a selector. However I would assume a valid expression for one element would be valid for all elements, but I've noticed that an HTML element is only a valid expression in the find() method. For example: $li = $(li); // returns the first matches for $li $(body ul li).find($li[0]); // this actually errors with a t.substring is not a function error $(body ul li).filter($li[0]); // I would expect this to only return the element which is the first $li, // but instead it ignores the expression altogether and returns all parents $(li[rel=45]).parents($li[0]); Shouldn't expressions work the same across all methods? Right now I'm having to use this to find only the explicit parent: $el.parents().filter(function (){ return this === $parent[0]; }); However, if parents() worked like find() I would be able to do: $el.parents($parent[0]); (Before you say Why not just use $parent?, it's because I'm checking to see if an element is a child of a specific element.) -Dan
[jQuery] requesting and sending JSON in a ruby on rails app
Hi - first of all this is a plugin-specific question (about treeview) - i sent it to the plugin discussion page but it seems pretty dead (no posts for over a year), so i'm sending it here as well. If anyone could help me out that would be fantastic. I've been using treeview and have no problems with it so far. However, to get better performance i'm now trying to switch to the asynchronous version: http://jquery.bassistance.de/treeview/demo/async.html In the example they use php to return some json to the tree, but i'm using it in a ruby on rails app, and can;t work out how to get it to work. Can anyone help? I'm really just not sure how to get the required json for the update back to the treeview. This is what i'm doing at the moment: In the view: jQuery(document).ready(function(){ jQuery(#prop-tree).treeview({ url: tree/self_and_children }); }); ... ul id=prop-tree /ul The url tree/self_and_children does seem to be calling the correct controller and action, which is as follows: def self_and_children # expects the id of the branch which is clicked on, which will be something like # property_id_79. We want property with id 79. if params[:id] property = Property.find(params[:id].split(_).last) else property = Property.root end @json = property.self_and_children_to_json respond_to do |format| if @json #should never get an html request for this format.html { render :text = @json } format.xml { head :ok } format.js { render :text = @json } else format.html { } format.xml { render :xml = @json.errors, :status = :unprocessable_entity } format.js end end end But, nothing comes back - at least, the tree doesn't change. My questions are as follows: a) is doing render :text = @json the proper way to send back the chunk of json to treeview? Should i do something in a js.rjs file instead? b) how do i send through the id of the clicked-on branch to the controller? (and retrieve it in the controller) thanks in advance max
[jQuery] Re: how do it?
I try do your example, but no make upper-case, so i try: $(this).val($(this).val().toUpperCase()); and got success without problems, onkeyup all upunts make this value for upper-case... thank`s On Tue, May 6, 2008 at 5:47 PM, Karl Swedberg [EMAIL PROTECTED] wrote: Luciano, If you're trying to get the value of an element with an ID of search, and make it upper-case, do this: $('#search').val().toUpperCase(); --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On May 6, 2008, at 3:10 PM, Luciano Mazzetto wrote: sure!, but i need do it ? $('input#search').toUpperCase(); // ??? On Tue, May 6, 2008 at 12:27 PM, Alexandre Plennevaux [EMAIL PROTECTED] wrote: first, get your markup correct: if you need to use several times the same ID, then use a CLASS instead. ID are for UNIQUE entities. besides that, this $('input #search') should be $('input#search') Hope this helps! alex On Tue, May 6, 2008 at 3:46 PM, Luciano [EMAIL PROTECTED] wrote: I have a input = search and a form = form-search, well i need create action keypress on input search i do this: $(document).ready(function() { $('input #search') .keypress(function(){ $('#inf').fadeIn('normal'); }) }); but no sucess, so i try it: $(document).ready(function() { $('#search') .keypress(function(){ $('#inf').fadeIn('normal'); }) }); it`s ok but i want especify input first, i have two more objects with this id, no inputs normal divs.. exist ? $('input #search') or $('input #search') or $('input search') ? tks -- Alexandre Plennevaux LAb[au] http://www.lab-au.com -- att. Luciano M. www.m2t.com.br -- att. Luciano M. www.m2t.com.br
[jQuery] Re: Photo Crop proposal
Does anyone know who did the existing real world crop example? I see no credits for it. Michel, I have looked at your site. You have done nice work. If you are interested in adding the features for my spec to earn a bounty please contact me (email is in my profile). Regards, LTG On May 7, 2:32 am, netvibe [EMAIL PROTECTED] wrote: I've experienced with the jquerycropplugin.. I am busy with an imagemanager, where u can do lots of things with images. (rotate /crop/ drag - drop / etc.) take a look @http://www.netvibe.nl/imagemanager/ On May 6, 8:22 pm, Richard D. Worth [EMAIL PROTECTED] wrote: On Mon, May 5, 2008 at 11:21 AM, LTG [EMAIL PROTECTED] wrote: Please see the video of my prototype here: http://www.hdgreetings.com/view.aspx?name=JQuery%20Crop%20Prototypev... Funny story. At 0:45 in your video, the picture of the family sitting on the bench/porch swing - that's my brother's family (I waited to check with him before I posted, and he's cool with it). #1 google image search for 'family' when filtered for Extra Large images http://images.google.com/images?q=familyum=1hl=ensa=Nimgsz=huge I'm curious. Is that how you found it? It's a great picture for what you're demonstrating. - Richard
[jQuery] Re: Photo Crop proposal
Hi Don't sell the functionality (crop,rotate,...) Sell the service: Online Image manager. Store, manage, Edit, Share, Comment, . my 2 Cents ;-) cheers tlz On May 5, 5:21 pm, LTG [EMAIL PROTECTED] wrote: Hi, (pls excuse dbl post) I would like to get feedback on: 1) Would a photo crop plug-in be useful to others? 2) How doable is it in JQuery? 3) Would anyone be interested in a bounty on it? ($$$) Please see the video of my prototype here:http://www.hdgreetings.com/view.aspx?name=JQuery%20Crop%20Prototypev... So the basic features are: - Photo cropping with aspect ratio locking - Face cropping (elliptical crop) - Straighten photo with real time adjustments - Real-time preview of result photo This the prototype is a working application, so all the logic is known and perfected. I think I know ways to make all the imaging pieces fast enough for good performance. Any feedback on these points would be appreciated. thank you, Lee
[jQuery] Superfish - modified Richard Willis
Hi, I've seen one other post regarding this, but no one ever answered so I'm trying again. I'm using the Richard Willis example (http://users.tpg.com.au/j_birch/ plugins/superfish/richard-willis-example/), and have also taken the functionality from the All Horizontal example (http://users.tpg.com.au/ j_birch/plugins/superfish/all-horizontal-example/) to make my second tier appear by default. Check out my menu here: http://secure2.vqcdesigns.com/~hbgrc/index.php The obvious problem is that when you navigate to a 2nd tier link with more links below it (for example, About Us) the dropdowns stay open. I've tried adding to the CSS, but that isn't helping. I assume I need to add something to superfish.js so that only the 2nd tier appears, but have no clue where to begin. Is this even possible, or am I out of luck? Any help is greatly appreciated.
[jQuery] Re: Background image change fade transition
I figured it out just in case someone ends up looking here for the answer! script type=text/javascript $(document).ready(function(){ $(.small).hover(function(){ var hoverObj = this; $(#big).fadeOut(fast, function(){ $(this).css(backgroundImage, url( + $(hoverObj).attr(big) + )); $(this).fadeIn(fast); }); }); }); /script On May 7, 11:27 am, Stuart Mullen [EMAIL PROTECTED] wrote: Hi all I've just started using jQuery (it's great!) and I'm looking to re- factor what I have written to have a fade transition between each image change. Any ideas would be greatly appreciated! My code is below, many thanks in advance! :) !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / title/title script type=text/javascript src=jquery/jquery-1.2.3.pack.js/ script script type=text/javascript $(document).ready(function(){ $(.small) .hover(function(){ $(#big).css(backgroundImage, url( + $(this).attr(big) + )); });}); /script /head body table tr td id=big style=background:url(img/amazing-cars.jpg); height: 200px; width: 200px;/td /tr /table br / br / br / img class=small src=img/t_amazing-cars.jpg big=img/amazing- cars.jpg / img class=small src=img/t_Cars.jpg big=img/Cars.jpg / img class=small src=img/t_ethel-cars.jpg big=img/ethel- cars.jpg / /body /html
[jQuery] Firing a jQuery function from loaded content via the load method
Firing a jQuery function from loaded content via load method. It seems to work fine in FF and IE but Safari wont make it happen :( Thanks for the help.
[jQuery] Re: [ANNOUNCE] markItUp! 1.1 is released!
Excellent, Jay! Very excited to hear about those changes. This gives me even more motivation to include it for comment textareas on learningjquery.com Cheers! --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On May 7, 2008, at 7:17 AM, Jay Salvat wrote: Hi all, markItUp! 1.1 is released! This release brings thousands bug fixes, better cross-browser compatibility (Mac users will be happy!), removal function, Html preview in templates, and due to popular demand, no more absurd textarea ID moving. Some advanced examples and add-ons have been added for the occasion. markItUp! 1.0 is no longer supported. Thanks! markItUp! http://markitup.jaysalvat.com/ -- http://markitup.jaysalvat.com/examples/ http://markitup.jaysalvat.com/downloads/
[jQuery] Re: [autocomplete] Hyperlinks in returned list
Hi, Is Chris approach documented anywhere ? It would be useful to be able to open a new window too. I did have this requirement when I first found the autocomplete library last year. I ended up writing my own autocomplete solution to meet the requirements. Let me know if you plan to develop a better solution as I'd rather use your Jörn library regards jose On Wed, May 7, 2008 at 11:27 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: I've documented my approach here: http://docs.jquery.com/Plugins/Autocomplete#Search_Page_Replacement Jörn On Sat, May 3, 2008 at 10:23 AM, theintoy [EMAIL PROTECTED] wrote: Jörn Hi. I would appreciate your solution too. Having checked the solution provided by Chris across all browsers, it appears IE7 throws an alert with the following text: Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus. I have assumed this is due to the textfield being made read-only. This was a nice touch by Chris and one which would be nice to keep in. Any ideas? Carl
[jQuery] Re: requesting and sending JSON in a ruby on rails app
Well, I don't use RoR or treeview, so my advice is more general... jQuery(#prop-tree).treeview({ url: tree/self_and_children }); a) No idea what this actually achieves, but I think the goal is to set the content type header. Using Firefox (with Firebug/Developer Extensions) you can check if the content type header is set correctly. Also, using firebug, you can look at the result sent back via Ajax, and paste it into the console to see if it's valid JSON/javascript. Hope that helps... On May 7, 2:05 pm, Max Williams (Brighton) [EMAIL PROTECTED] wrote: Hi - first of all this is a plugin-specific question (about treeview) - i sent it to the plugin discussion page but it seems pretty dead (no posts for over a year), so i'm sending it here as well. If anyone could help me out that would be fantastic. I've been using treeview and have no problems with it so far. However, to get better performance i'm now trying to switch to the asynchronous version:http://jquery.bassistance.de/treeview/demo/async.html In the example they use php to return some json to the tree, but i'm using it in a ruby on rails app, and can;t work out how to get it to work. Can anyone help? I'm really just not sure how to get the required json for the update back to the treeview. This is what i'm doing at the moment: In the view: jQuery(document).ready(function(){ jQuery(#prop-tree).treeview({ url: tree/self_and_children }); }); ... ul id=prop-tree /ul The url tree/self_and_children does seem to be calling the correct controller and action, which is as follows: def self_and_children # expects the id of the branch which is clicked on, which will be something like # property_id_79. We want property with id 79. if params[:id] property = Property.find(params[:id].split(_).last) else property = Property.root end @json = property.self_and_children_to_json respond_to do |format| if @json #should never get an html request for this format.html { render :text = @json } format.xml { head :ok } format.js { render :text = @json } else format.html { } format.xml { render :xml = @json.errors, :status = :unprocessable_entity } format.js end end end But, nothing comes back - at least, the tree doesn't change. My questions are as follows: a) is doing render :text = @json the proper way to send back the chunk of json to treeview? Should i do something in a js.rjs file instead? b) how do i send through the id of the clicked-on branch to the controller? (and retrieve it in the controller) thanks in advance max
[jQuery] Re: requesting and sending JSON in a ruby on rails app
It sounds like you're trying to debug three things at once: * Can I generate valid JSON from my Rails app? * Can I get a JSON download to work with JavaScript and jQuery? * Can I get async JSON to work with treeview? I would simplfy the debugging problem by separating those three questions and tackling them one at a time. That will make it a lot easier to track down the problem. For example, you can test the first one all by itself by generating your JSON data and simply copying and pasting it into www.jsonlint.com to see if it accepts it. That way you don't even have to think about JavaScript at all; you are simply debugging your Rails app. Once you know you have good JSON data, you can test question #2 with a simple test case that just downloads the JSON data with jQuery and displays it (even with just a console.log call). Finally, with all that working, you can tackle the treeview question. -Mike From: Max Williams (Brighton) Hi - first of all this is a plugin-specific question (about treeview) - i sent it to the plugin discussion page but it seems pretty dead (no posts for over a year), so i'm sending it here as well. If anyone could help me out that would be fantastic. I've been using treeview and have no problems with it so far. However, to get better performance i'm now trying to switch to the asynchronous version: http://jquery.bassistance.de/treeview/demo/async.html In the example they use php to return some json to the tree, but i'm using it in a ruby on rails app, and can;t work out how to get it to work. Can anyone help? I'm really just not sure how to get the required json for the update back to the treeview. This is what i'm doing at the moment: In the view: jQuery(document).ready(function(){ jQuery(#prop-tree).treeview({ url: tree/self_and_children }); }); ... ul id=prop-tree /ul The url tree/self_and_children does seem to be calling the correct controller and action, which is as follows: def self_and_children # expects the id of the branch which is clicked on, which will be something like # property_id_79. We want property with id 79. if params[:id] property = Property.find(params[:id].split(_).last) else property = Property.root end @json = property.self_and_children_to_json respond_to do |format| if @json #should never get an html request for this format.html { render :text = @json } format.xml { head :ok } format.js { render :text = @json } else format.html { } format.xml { render :xml = @json.errors, :status = :unprocessable_entity } format.js end end end But, nothing comes back - at least, the tree doesn't change. My questions are as follows: a) is doing render :text = @json the proper way to send back the chunk of json to treeview? Should i do something in a js.rjs file instead? b) how do i send through the id of the clicked-on branch to the controller? (and retrieve it in the controller) thanks in advance max
[jQuery] Re: event data ?
Using the name btn for the event function parameter will surely make things confusing - because you'll be looking for it to be a DOM element for the button, which it isn't. The parameter to the event function is an *event* object. Inside the function, this refers to the button element, and so does event.target. -Mike From: motob The best way to see what the btn object is all about is to download and install firebug. Then use the console to output that object. for example: $('.mybutton').bind('click',function(btn){ console.log( btn); } ); Then on the console panel of firebug, you'll see the btn object, which is clickable. If clicked, firebug will show you the DOM representation of that object and all of its properties that are accessible. On May 6, 9:22 am, Adwin Wijaya [EMAIL PROTECTED] wrote: Thanks .. but I still curious what is inside the variable that passed through function callback (btn in my example) and how to have access on it. On May 6, 6:39 pm, motob [EMAIL PROTECTED] wrote: $('.mybutton').click(function(){ alert($(this).attr(id)); //get the id $(this).attr(disabled, disabled); //disable the clicked button }); On May 6, 3:33 am, Adwin Wijaya [EMAIL PROTECTED] wrote: Hi I got a problem ... I have more than 1 buttons and each buttons has unique name. I assign / bind the button with function like this : $('.mybutton').bind('click',function(btn){ alert( btn.id); } ); every time i click on the buttons the alert always show undefined. How to get the ID of button who clicked ? i want to get the id, change the button to disabled ... how to do that one ... and what is event.data actually is thanks !
[jQuery] Re: Giving more parameters to the async load function ?
I haven't gotten to quite that level of abstraction yet, but I came up with a solution for my problem that could be helpful to some. I will think about this more and see if I can make it more generic to be reused by others, but here is what I did for now (these changes are all in jquery.treeview.async.js): in $.fn.treeview, right below the line var container = this; I added: settings.my_custom_id!=? settings.params={current_id:settings.my_custom_id}:settings.params=null; (my_custom_id is set in the initialization of the widget) and changed the call to load to: load(settings, settings.params, this, container); Then, within proxied.call, I changed the call to: load(settings, {id:this.id}, childList, container); Basically, I am using this to determine if I use the default of {id:some_number} or my own param that brings back the full list down to the section of the tree where I last was (this is determined serverside based on the page requested, which may not be something available in the tree). Part of what I wanted to do here was remove the logic of building the param hash in the call to getJSON. It likely needs to be further decoupled, but this is a first stab. In keeping with this plan, I changed the signature of load to be: function load(settings, params, child, container) { and getJSON just reused params instead of building them inline like so: $.getJSON(settings.url, params, function(response) { I like the idea you mentioned Jörn, so I will see if I can come up with any better thoughts on how to pull that off, and let you know if I do. Thanks for the assistance. -j On May 5, 10:01 am, Jörn Zaefferer [EMAIL PROTECTED] wrote: I discussed the idea of jQuery core supporting dynamic data parameters with Scott recently - we haven't made progress, but it could solve a lot of issues like this one. Basically you'd replace static values with functions that return those values, while thetreeviewplugin just passes these through to $.ajax, which then evaluates those functions while serializing the data. I think every plugin that uses jQuerys ajax methods could leverage that. Jörn On Fri, May 2, 2008 at 11:35 PM, jayg [EMAIL PROTECTED] wrote: Excellent thought. I was thinking of having some sort of parameter hash to pass in, maybe I can hook that together with this idea. On May 2, 11:39 am, markus.staab [EMAIL PROTECTED] wrote: Maybe a callback function (given some usefull context parameters..) which produces the url could do the trick.. On 2 Mai, 17:24, jayg [EMAIL PROTECTED] wrote: Thanks Jörn, I will post code here when I get a good solution. However, I know the treeviewis being worked on in the UI project as well, should I be looking at something other than treview.asynch to make these changes to? Additionally, I was considering adding a 'custom' persist option, I can provide a patch if you think it would be useful (and assuming it is done generically enough). Probably also going to be looking at adding a 'loading' spinner option, unless it is there and I have just missed it. On Apr 30, 11:42 am, Jörn Zaefferer [EMAIL PROTECTED] wrote: jayg schrieb: I need to set up dynamic urls with async trees as well, though I am using rails, so I am looking for something more like 'foo/bar/1', but same functionality. The problem I have with the idea to use source.php?id=firsttree or something similar is that I don't know how many subtrees I may have - this needs to be built dynamically. If I misunderstood, and this is intended to be dynamic, a code snippet would be greatly helpful. If not, my thought was in the getJSON function of thetreeview.asynch to have _that_ create the url info for the newly returned tree. We already have this.id and could easily return the name of the controller and method to call. Then, at the end when we call $(container).treeview({add:child}), we could insert the url we created into ts setting. I may hack on this until I hear another idea, but let me know what you think of that approach. Ideas, especially in the form of code, are very welcome. The basic problem, dynamic arguments and different URL formats, applies now to bothtreeviewand autocomplete plugins, so solving it properly would help a lot. Jörn
[jQuery] livequery in navigation
I am using jquery and superfish in my horizontal navigation menu. The navigation is loaded via an external file. The drop down menus set up nicely, and I have js set up so that when a user select a menu item, different content is loaded into a div in the middle of the page depending on what they click on. I just switched to livequery, so my js is: $(document).ready(function() { ('#home') .livequery('click', (function() { $('#content').load('index.php') return false; }) ('#search') .livequery('click', (function() { $('#content').load('search.php') return false; }) ); My goal is for the user to always be able to click on the navigation menu and start over or load new content. So if the user chooses search, search.php is loaded, which is a form. They enter the users company name and press submit. Data is shown in the div in the middle of the page. Now I want the user to be able to click on a navigation link, or the home link to do whatever they want. This does not work - it seems like once data is displayed in the #content div, the navigation menu doesn't work. I guess I thought this was what livequery would do for me. Does anyone have time to look at this and see what I am doing wrong?
[jQuery] Re: requesting and sending JSON in a ruby on rails app
Hi Mike, thanks for your advice. In answer: 1) The JSON is valid (it was generated using rails .to_json method and that site you recommended says it's valid) 2) I'm pretty sure a JSON download will work with JS/jQuery, because the async treeview example uses a php script to return some json - see http://jquery.bassistance.de/treeview/demo/async.html, look at the 'server component used' to see the php in question. 3) See 2. I'm confident that the json/jquery side of things is all cool. My problem is purely rails-specific: how do i ask a rails controller for a specific chunk of json, and how do i send it back? Or, in other words, how do i manage in rails what the example uses a php script for? thanks again On May 7, 4:57 pm, Michael Geary [EMAIL PROTECTED] wrote: It sounds like you're trying to debug three things at once: * Can I generate valid JSON from myRailsapp? * Can I get a JSON download to work with JavaScript and jQuery? * Can I getasyncJSON to work withtreeview? I would simplfy the debugging problem by separating those three questions and tackling them one at a time. That will make it a lot easier to track down the problem. For example, you can test the first one all by itself by generating your JSON data and simply copying and pasting it intowww.jsonlint.comto see if it accepts it. That way you don't even have to think about JavaScript at all; you are simply debugging yourRailsapp. Once you know you have good JSON data, you can test question #2 with a simple test case that just downloads the JSON data with jQuery and displays it (even with just a console.log call). Finally, with all that working, you can tackle thetreeviewquestion. -Mike From: Max Williams (Brighton) Hi - first of all this is a plugin-specific question (abouttreeview) - i sent it to the plugin discussion page but it seems pretty dead (no posts for over a year), so i'm sending it here as well. If anyone could help me out that would be fantastic. I've been usingtreeviewand have no problems with it so far. However, to get better performance i'm now trying to switch to the asynchronous version: http://jquery.bassistance.de/treeview/demo/async.html In the example they use php to return some json to the tree, but i'm using it in a ruby onrailsapp, and can;t work out how to get it to work. Can anyone help? I'm really just not sure how to get the required json for the update back to thetreeview. This is what i'm doing at the moment: In the view: jQuery(document).ready(function(){ jQuery(#prop-tree).treeview({ url: tree/self_and_children }); }); ... ul id=prop-tree /ul The url tree/self_and_children does seem to be calling the correct controller and action, which is as follows: def self_and_children # expects the id of the branch which is clicked on, which will be something like # property_id_79. We want property with id 79. if params[:id] property = Property.find(params[:id].split(_).last) else property = Property.root end @json = property.self_and_children_to_json respond_to do |format| if @json #should never get an html request for this format.html { render :text = @json } format.xml { head :ok } format.js { render :text = @json } else format.html { } format.xml { render :xml = @json.errors, :status = :unprocessable_entity } format.js end end end But, nothing comes back - at least, the tree doesn't change. My questions are as follows: a) is doing render :text = @json the proper way to send back the chunk of json totreeview? Should i do something in a js.rjs file instead? b) how do i send through the id of the clicked-on branch to the controller? (and retrieve it in the controller) thanks in advance max
[jQuery] Re: requesting and sending JSON in a ruby on rails app
Ah, very good, Max, you're a step ahead of me on the debugging. Since you've narrowed it down to a Rails issue, would it make more sense to ask on a Rails list? Don't get me wrong, there are a number of Rails experts here who would probably be happy to help, it's just that you might get more focused assistance that way. -Mike From: Max Williams (Brighton) Hi Mike, thanks for your advice. In answer: 1) The JSON is valid (it was generated using rails .to_json method and that site you recommended says it's valid) 2) I'm pretty sure a JSON download will work with JS/jQuery, because the async treeview example uses a php script to return some json - see http://jquery.bassistance.de/treeview/demo/async.html, look at the 'server component used' to see the php in question. 3) See 2. I'm confident that the json/jquery side of things is all cool. My problem is purely rails-specific: how do i ask a rails controller for a specific chunk of json, and how do i send it back? Or, in other words, how do i manage in rails what the example uses a php script for? thanks again On May 7, 4:57 pm, Michael Geary [EMAIL PROTECTED] wrote: It sounds like you're trying to debug three things at once: * Can I generate valid JSON from myRailsapp? * Can I get a JSON download to work with JavaScript and jQuery? * Can I getasyncJSON to work withtreeview? I would simplfy the debugging problem by separating those three questions and tackling them one at a time. That will make it a lot easier to track down the problem. For example, you can test the first one all by itself by generating your JSON data and simply copying and pasting it intowww.jsonlint.comto see if it accepts it. That way you don't even have to think about JavaScript at all; you are simply debugging yourRailsapp. Once you know you have good JSON data, you can test question #2 with a simple test case that just downloads the JSON data with jQuery and displays it (even with just a console.log call). Finally, with all that working, you can tackle thetreeviewquestion. -Mike From: Max Williams (Brighton) Hi - first of all this is a plugin-specific question (abouttreeview) - i sent it to the plugin discussion page but it seems pretty dead (no posts for over a year), so i'm sending it here as well. If anyone could help me out that would be fantastic. I've been usingtreeviewand have no problems with it so far. However, to get better performance i'm now trying to switch to the asynchronous version: http://jquery.bassistance.de/treeview/demo/async.html In the example they use php to return some json to the tree, but i'm using it in a ruby onrailsapp, and can;t work out how to get it to work. Can anyone help? I'm really just not sure how to get the required json for the update back to thetreeview. This is what i'm doing at the moment: In the view: jQuery(document).ready(function(){ jQuery(#prop-tree).treeview({ url: tree/self_and_children }); }); ... ul id=prop-tree /ul The url tree/self_and_children does seem to be calling the correct controller and action, which is as follows: def self_and_children # expects the id of the branch which is clicked on, which will be something like # property_id_79. We want property with id 79. if params[:id] property = Property.find(params[:id].split(_).last) else property = Property.root end @json = property.self_and_children_to_json respond_to do |format| if @json #should never get an html request for this format.html { render :text = @json } format.xml { head :ok } format.js { render :text = @json } else format.html { } format.xml { render :xml = @json.errors, :status = :unprocessable_entity } format.js end end end But, nothing comes back - at least, the tree doesn't change. My questions are as follows: a) is doing render :text = @json the proper way to send back the chunk of json totreeview? Should i do something in a js.rjs file instead? b) how do i send through the id of the clicked-on branch to the controller? (and retrieve it in the controller) thanks in advance max
[jQuery] Sending datastring using $.ajax with 'invalid characters'
Hi There I have been struggling to correctly format a datastring to be sent via POST that may contain 'invalid characters'. I am trying to send text html via ajax post, and this has been achieved mainly due to Javascript's escape() function. For example, to send the ampersand (), escape() is used to convert the character to it's (8bit?) value. For the most part the escape function correctly formats the data string, but there are certain characters that will not be escaped, and will be processed literally, eg: the plus (+) character. I assume the reason why I cannot send the + char as part of the data string, is because if the + is used in the url it is seen as an escaped space character. Without completely re-working my system, is there any possible way of sending all data literally in a data string using $.ajax via post? I'm using the following code: $.ajax({ type: POST, url: '/cms_page_manager/savepage', data: dataString, error: function(XHR, status, error) { }, success: function(msg){ } }); Any suggestions would be greatly appreciated. I wish I had some more experience with character handling, right now i'm about to pull my hair out! Many thanks in advance.
[jQuery] Re: need some help with selecting text nodes
What about doing is client-side? So cycle through each line with each() and then use .wrap(span/span). This will put into the DOM what you need to use later. Also, you might be interested in this plugin. http://www.jquery.info/The-plugin-SearchHighlight It finds text based on search criteria in a large block of random text. It might be useful. Glen On Tue, May 6, 2008 at 6:44 PM, darren [EMAIL PROTECTED] wrote: oh man, i wish i could do as you suggested, that was my first idea and it would make things so much easier. However, the code i'm working with is markup of Shakespeare's works. Its incredibly complex and we use Cocoon to generate these pages from xml. long story short, my employer can't afford to make such a change now so I have to make due with what's there. I think i came up with a reasonable solution though: 1. Find the div with the lower tln value. Then get its index with respect to the parent. 2. Find the next highest div tln and get its index as well. 3. From this we know the text node lies within the indexes, so search for the text there. Again, because of the code complexity, this does not always work, but at least i'm making progress. Thanks for your insight though. On May 6, 9:28 am, Glen Lipka [EMAIL PROTECTED] wrote: I tried to cut corners by skimming your html. I see it now. The divs close and the text is after the div. This is really strange HTML to me. Why not just put the text inside the div? Or just wrap the text inside a span? If you wrap the text inside spans, then the jQuery is pretty simple. I whipped up a sample. http://commadot.com/jquery/findTextElements.php $(#tln21).next(span).addClass(highlight) Sometimes, fancy JS is not as good as clean html. Glen On Mon, May 5, 2008 at 6:51 PM, darren [EMAIL PROTECTED] wrote: hi glen, thanks for replying. That still wouldn't work. With that you are looking for the text inside div elements which are descendants of of the id'd element. What i want to select are certain text elements of the id'd element. I figured something out, but this is surprisinlgy difficult: div id=21 div text node div text node ... /div I had to use .contains() and [nodeType=3] to pick text nodes. not pretty. On May 5, 4:23 pm, Glen Lipka [EMAIL PROTECTED] wrote: $(#tln21 div).text(); Like that? By the way, firebug is very helpful to test our selectors and see what they come up with. Hmm, it would be nice to have a tutorial on how to do this. I can try and whip one up. Glen On Mon, May 5, 2008 at 2:47 PM, darren [EMAIL PROTECTED] wrote: hi Joe, thanks for your comment If you look closer, you can see that the text is not actually in the div element. i basically need to select the text after that node: div div tln=xxx/div Some text div tln=xxx/div some more text div tln=xxx3/div even more text /div So that wouldnt work On May 5, 2:06 pm, Joe [EMAIL PROTECTED] wrote: $(#tln21').text(); This will return the text associated with id=tln21. http://docs.jquery.com/Attributes/text Joe www.subprint.com On May 5, 2:34 pm, darren [EMAIL PROTECTED] wrote: Hi everybody, new member here. I have a project with the following snipped of code: =start html= div class=line div name=tln4 id=tln4 class=ln tln ! /divAs I remember, Adam, it was upon this fashion div name=tln5 id=tln5 class=ln tln5/divbequeathed me by will but poor a thousand div name=tln6 id=tln6 class=ln tln ! /divcrowns, and, as thou say'st, charged my brother, div name=tln7 id=tln7 class=ln tln ! /divon his blessing, to breed me well; and div name=tln8 id=tln8 class=ln tln ! /divthere begins my sadness. My brother Jaques he keeps div name=tln9 id=tln9 class=ln tln ! /divat school, and report speaks goldenly of his profit. div name=tln10 id=tln10 class=ln tln10/divFor my part, he keeps me rustically at home, or, to speak div name=tln11 id=tln11 class=ln tln
[jQuery] Re: Need help with hover and fadein and fade out
Does this help? http://commadot.com/jquery/hoverFade.php Maybe if you post something in the ballpark, we could help troubleshoot it? Glen On Tue, May 6, 2008 at 5:48 PM, Aaron [EMAIL PROTECTED] wrote: Can you give me an example code of what I need to do to get a table to fade in above the picture which when the mouse is over the picture will activate the fade in function and also when the mouse goes off the photo or that new fadeded in table then it would fade out. The table that fades will will contain more photos of that user. On May 3, 5:20 pm, Aaron [EMAIL PROTECTED] wrote: Hi I am having trouble using the hover and fade in and fade out I look at the doc I understand it but I don't understand how I can use it for what I want to do. I want the user to be able when the mouse is over a photo of them a table or window fades in with other photos they uploaded ect when the mouse moves off the photo or the table then the table or window fades out. can some one explain how I can do this and what rules I should follow when using hover and fade in and fade out ect. could I make a javascript use jquery? if so how?? I know I can do this in html but I would like to make a javascript with jquery functions ect and have that file added to the html doc.
[jQuery] droppable() question
I have a list of pictures that I would like to allow the user to drag and drop to a trash can. All works fine except an unwanted get request is made on the picture, after it is trashed. Here is the code: $(document).ready(function(){ $(.photos img).draggable(); $(#trash).droppable({ accept: img, drop: function(ev, ui){ var url = window.location + /photos/ + ui.draggable.attr(id); $.post(url, {'_method': delete}, function(){ $(ui.draggable).remove(); }); return false; } }); }); Is there an option for the droppable method, to prevent the bubbling, that I am not aware of? Thanks for the help.
[jQuery] preset selection of radio buttons
what is correct way to preset selection of radio buttons? !DOCTYPE html html head title/title script src=/lib/jquery/jquery-1.2.3.min.js/script script src=/lib/jquery/jquery.field.js/script $(#radioname:checked).val([0, 1]); }); /script /head body div input type=radio id=radioname name=radioname value=0 / input type=radio id=radioname name=radioname value=1 / input type=radio id=radioname name=radioname value=2 /br/ /div /body /html
[jQuery] function not showing scrollbars in IE6
I've got a page that has 3 forms on it and using a dropdown to select which form to show. It's letting the admin create 3 other types of users. It works fine in Safari, Firefox and IE7, but in IE6 when a form is shown that expands past the bottom of the page, it displays everything, but the window's scrollbars do not appear. If I manually resize the browser, it still doesn't show scrollbars, but will show all of the content. I've tried turning the display to none and then back to block on the main content area to force redraw but nothing. I've also tried calling $(window).resize() to force it. Again nothing. Here's the code: script type=text/javascript charset=utf-8 $(document).ready(function(){ // Show the right form. $(#user_type).change(function(){ // Hide all of the forms $(fieldset).css(display, none); // Hide all of the user_stats forms $(div.user_stats).css(display, none); // Get our current user type to show var type = fld_ + $(#user_type option:selected).html(); $(#+type).css(display, block); $(window).resize(); }); }); /script Any ideas?
[jQuery] Has anyone ever done a newsletter signup?
Hello. I'm trying to patch together something like the newsletter signup on http://www.gimme.no except with jQuery and perhaps Facebox. I haven't gotten around to finding the PHP code I'll be needing either. When I do, it'll probably be something so bloated that I'll have to spend hours trying to clean it up. I'm just curious if anybody's already done this and presently feel happy enough to maybe share their code with me? Much obliged, Kyrre
[jQuery] Re: validating dynamically generated data
I figured it out... mostly: $(document).ready(function() { $(div.instock input.order-qty).keyup(function(){ var x = parseInt($(this).val()); var y = parseInt($(this).siblings(span.qty).attr(title)); if (x y) { $(this).siblings(span.error).text(Not enough in stock); } else { $(this).siblings(span.error).text(); } }); }); however, it still allows the user to submit the form. How do I stop them from being able to submit the for if the quantity they ordered is over the limit? -- View this message in context: http://www.nabble.com/validating-dynamically-generated-data-tp17091060s27240p17111078.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: SELECTOR MADNESS! How To Grab Lowest Child Node's Text?!
Hi! I replied in the previous thread but it hasn't appeared in Google groups, just here: http://www.nabble.com/Selector-Madness!--How-to-Select-all-the-Text-on-a-Page--td17018965s27240.html So there is a translate plugin that works this way: http://code.google.com/p/jquery-translate/ On May 5, 9:32 pm, Joe [EMAIL PROTECTED] wrote: Last week I had a question on how to traverse the DOM and find all elements that had some text (p, a, li, h1, etc.) so I could manipulate it with Google's translation API. Well with some help from the community I was able to accomplish this feat. http://groups.google.com/group/jquery-en/browse_thread/thread/c63da32... However, I have a bigger problem. Now, when I grab theallproperelements: $a = $(' #container * ').contents(); And parse thru them tofindwhich ones have text, it does just that BUT if an unordered list is within a div and that UL has text it will show up not only with the UL, but within the DIV as well. $a.each(function() { ... translate stuff here ..}); So in iteration one, wefindthe DIV, and then locate any andALLtext in the DIV. Quite a bit for the header navigation. Example Result for Div: HOME BUSINESS CONTACT ABOUT Then the next iteration is the UL, and it finds its text, which is basically the same as the DIV's text result. Example Result for UL: HOME BUSINESS CONTACT ABOUT Then the next iteration is the LI element, which has the proper text but, The next iteration is the A element which is finally the text I actually want to translate. Example Result for LI and A: HOME So myquestionis how can Itraversedown and grab thelastchild on that particular branch of theDOM. Surely there's a way to check if current node has or does not have a child, but how with jQuery? Thanks! BTW, Ariel Fleisler's recommendation from the previous post appears to be the best approach, but my pure Javascript mixing with jQuery skills are not quite up to snuff to hash that out...
[jQuery] Re: Need help with hover and fadein and fade out
Ok here is the code I made so far. $(document).ready(function() { $('#table1').hide(); $(#image).hover( function () { $(this).fadeIn('#table1'); }, function () { $(this).fadeOut('#table1');}) On May 7, 1:34 pm, Glen Lipka [EMAIL PROTECTED] wrote: Does this help?http://commadot.com/jquery/hoverFade.php Maybe if you post something in the ballpark, we could help troubleshoot it? Glen On Tue, May 6, 2008 at 5:48 PM, Aaron [EMAIL PROTECTED] wrote: Can you give me an example code of what I need to do to get a table to fade in above the picture which when the mouse is over the picture will activate the fade in function and also when the mouse goes off the photo or that new fadeded in table then it would fade out. The table that fades will will contain more photos of that user. On May 3, 5:20 pm, Aaron [EMAIL PROTECTED] wrote: Hi I am having trouble using the hover and fade in and fade out I look at the doc I understand it but I don't understand how I can use it for what I want to do. I want the user to be able when the mouse is over a photo of them a table or window fades in with other photos they uploaded ect when the mouse moves off the photo or the table then the table or window fades out. can some one explain how I can do this and what rules I should follow when using hover and fade in and fade out ect. could I make a javascript use jquery? if so how?? I know I can do this in html but I would like to make a javascript with jquery functions ect and have that file added to the html doc.- Hide quoted text - - Show quoted text -
[jQuery] Re: Need help with hover and fadein and fade out
no that's not what I plan to do. What I am trying to do is this: I have an image of the user already on the page when the user puts it's mouse over the image I want a table or somthing that would fade it on top of the image . so that table will contain all photos the user uploaded when the user moves the mouse off the image or off the table the table will fade in. it's like a navigation but it's a quick way for the user or friends to look at their photo albums without loading a new page ect. On May 7, 1:34 pm, Glen Lipka [EMAIL PROTECTED] wrote: Does this help?http://commadot.com/jquery/hoverFade.php Maybe if you post something in the ballpark, we could help troubleshoot it? Glen On Tue, May 6, 2008 at 5:48 PM, Aaron [EMAIL PROTECTED] wrote: Can you give me an example code of what I need to do to get a table to fade in above the picture which when the mouse is over the picture will activate the fade in function and also when the mouse goes off the photo or that new fadeded in table then it would fade out. The table that fades will will contain more photos of that user. On May 3, 5:20 pm, Aaron [EMAIL PROTECTED] wrote: Hi I am having trouble using the hover and fade in and fade out I look at the doc I understand it but I don't understand how I can use it for what I want to do. I want the user to be able when the mouse is over a photo of them a table or window fades in with other photos they uploaded ect when the mouse moves off the photo or the table then the table or window fades out. can some one explain how I can do this and what rules I should follow when using hover and fade in and fade out ect. could I make a javascript use jquery? if so how?? I know I can do this in html but I would like to make a javascript with jquery functions ect and have that file added to the html doc.- Hide quoted text - - Show quoted text -
[jQuery] Re: append div trouble [SOLVED]
That was it Richard. thanks. I ended up using livequery to rebind the click handler $('#navigation [EMAIL PROTECTED]#]').livequery('click', function(event) { $('#navigation').empty().append(hex); . . that way the append content acts like it used to. you can see it in action here -- http://studio4nine.com/html2/index.html the whole idea was to be able to de link the link you clicked on. a friend of mine helped with setting that up based on the hash in the URL. that way you can deep link the site, since it's only 1 html page. kind of a goofy experiment, but i think it worked out cool. thanks again. gary.
[jQuery] New to JQ
Hi All, I'm a newbie to jQ and would like to use it/implement for a site. The goal i'm trying to achieve is similar to site http://www.mariusroosendaal.com/ in appearance but in functionality i would like it to load content via Request and then slide the box down with the containing content while simultaneously closing any open ones. Here's what i have so far: script $(document).ready(function(){ $(headline a).click(function(){ $(.content:visible).slideUp(slow); $(this).parent().next().load(test.xml).slideDown(slow); return false; }); }); /script body headlinea href=#Link/a/headline div class=content !-- Load this via HTTPRequest -- /div headlinea href=#Link/a/headline div class=content !-- Load this via HTTPRequest -- /div headlinea href=#Link/a/headline div class=content !-- Load this via HTTPRequest -- /div /body Along with this if i change the xml headline tag to a div tag or h1 tag it stops working.. Any help is greatly appreciated!
[jQuery] Syntax confusion
X-no-archive:yes Is the comma after line 1854 valid syntax or is it an error? // Init the element's event structure 1854 var events = jQuery.data(elem, events) || jQuery.data(elem, events, {}), 1855 handle = jQuery.data(elem, handle) || jQuery.data(elem, handle, function(){ 1856 // returned undefined or false 1857 var val; 1858 1859 // Handle the second event of a trigger and when 1860 // an event is called after a page has unloaded 1861 if ( typeof jQuery == undefined || jQuery.event.triggered ) 1862 return val; 1863 1864 val = jQuery.event.handle.apply(arguments.callee.elem, arguments); 1865 1866 return val; 1867 });
[jQuery] jQuery Conference
Just watched John's video on What's Next for jQuery and Javascript ( http://vimeo.com/984675 ) and he mentioned a conference. I will definitely be attending, but need to know where I'm going and when! Anyone have any details on this?
[jQuery] Re: SELECTOR MADNESS! How To Grab Lowest Child Node's Text?!
Balazs, Thanks, but I tried your plugin and it did not work. There is no demo for say clicking a button and converting the page; the bookmarklet is cool, but doesn't really help when I can't get the plugin to work. I emailed you so hopefully I'll hear back... I did actually re-create your plugin, but didn't author it or add any bells and whistles, just translating an entire page and/or element... Cheers. Joe www.subprint.com On May 7, 1:39 pm, Balazs Endresz [EMAIL PROTECTED] wrote: Hi! I replied in the previous thread but it hasn't appeared in Google groups, just here:http://www.nabble.com/Selector-Madness!--How-to-Select-all-the-Text-o... So there is a translate plugin that works this way: http://code.google.com/p/jquery-translate/ On May 5, 9:32 pm, Joe [EMAIL PROTECTED] wrote: Last week I had a question on how to traverse the DOM and find all elements that had some text (p, a, li, h1, etc.) so I could manipulate it with Google's translation API. Well with some help from the community I was able to accomplish this feat. http://groups.google.com/group/jquery-en/browse_thread/thread/c63da32... However, I have a bigger problem. Now, when I grab theallproperelements: $a = $(' #container * ').contents(); And parse thru them tofindwhich ones have text, it does just that BUT if an unordered list is within a div and that UL has text it will show up not only with the UL, but within the DIV as well. $a.each(function() { ... translate stuff here ..}); So in iteration one, wefindthe DIV, and then locate any andALLtext in the DIV. Quite a bit for the header navigation. Example Result for Div: HOME BUSINESS CONTACT ABOUT Then the next iteration is the UL, and it finds its text, which is basically the same as the DIV's text result. Example Result for UL: HOME BUSINESS CONTACT ABOUT Then the next iteration is the LI element, which has the proper text but, The next iteration is the A element which is finally the text I actually want to translate. Example Result for LI and A: HOME So myquestionis how can Itraversedown and grab thelastchild on that particular branch of theDOM. Surely there's a way to check if current node has or does not have a child, but how with jQuery? Thanks! BTW, Ariel Fleisler's recommendation from the previous post appears to be the best approach, but my pure Javascript mixing with jQuery skills are not quite up to snuff to hash that out...
[jQuery] Re: Syntax confusion
It is valid -- you can declare multiple variables in javascript by comma-separating the declarations as it is done there. -- Josh - Original Message - From: [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Wednesday, May 07, 2008 12:03 PM Subject: [jQuery] Syntax confusion X-no-archive:yes Is the comma after line 1854 valid syntax or is it an error? // Init the element's event structure 1854 var events = jQuery.data(elem, events) || jQuery.data(elem, events, {}), 1855 handle = jQuery.data(elem, handle) || jQuery.data(elem, handle, function(){ 1856 // returned undefined or false 1857 var val; 1858 1859 // Handle the second event of a trigger and when 1860 // an event is called after a page has unloaded 1861 if ( typeof jQuery == undefined || jQuery.event.triggered ) 1862 return val; 1863 1864 val = jQuery.event.handle.apply(arguments.callee.elem, arguments); 1865 1866 return val; 1867 });
[jQuery] Re: preset selection of radio buttons
I hatwe this google forum -- can't edit posts Revised sample code: html head title/title script src=/lib/jquery/jquery-1.2.3.min.js/script script type=text/javascript $(document).ready(function(){ $(#radioname:checked).val([0, 1]); }); /script /head body input type=radio id=radioname name=radioname value=0 / input type=radio id=radioname name=radioname value=1 / input type=radio id=radioname name=radioname value=2 / br/ /body /html
[jQuery] Re: preset selection of radio buttons
I hate this google group -- can't edit posts Revised sample code: !DOCTYPE html html head title/title script src=/lib/jquery/jquery-1.2.3.min.js/script script type=text/javascript $(document).ready(function(){ $(#radioname:checked).val([0, 1]); }); /script /head body input type=radio id=radioname name=radioname value=0 / input type=radio id=radioname name=radioname value=1 / input type=radio id=radioname name=radioname value=2 / br/ /body /html On May 7, 11:12 am, JP [EMAIL PROTECTED] wrote: what is correct way to preset selection of radio buttons? !DOCTYPE html html head title/title script src=/lib/jquery/jquery-1.2.3.min.js/script script src=/lib/jquery/jquery.field.js/script $(#radioname:checked).val([0, 1]); }); /script /head body div input type=radio id=radioname name=radioname value=0 / input type=radio id=radioname name=radioname value=1 / input type=radio id=radioname name=radioname value=2 /br/ /div /body /html
[jQuery] preset selection of radio buttons
(I hate this google group -- can't edit posts) I need to know how to preset multiple radio buttons Revised sample code: !DOCTYPE html html head title/title script src=/lib/jquery/jquery-1.2.3.min.js/script script type=text/javascript $(document).ready(function(){ $(#radioname:checked).val([0, 1]); }); /script /head body input type=radio id=radioname name=radioname value=0 / input type=radio id=radioname name=radioname value=1 / input type=radio id=radioname name=radioname value=2 / br/ /body /html
[jQuery] Re: preset selection of radio buttons
On Mittwoch, 7. Mai 2008, JP wrote: I hate this google group -- can't edit posts You said that three times already. You do know that this group is mainly a mailing list? And that's is technically impossible to cancel emails that are sent our to thousand of recipients already? Christoph signature.asc Description: This is a digitally signed message part.
[jQuery] jquery docs - example not working
why does this jquery example for val(val) of radio buttons not work ? http://docs.jquery.com/Attributes/val
[jQuery] Re: Superfish pathClass problem
On May 7, 11:38 am, Joel Birch [EMAIL PROTECTED] wrote: Yes, that's correct. It's a job best suited to a server-side language so that the current information is still present when JS is not available. Joel Birch. Thanks Joel -- Dave Buchholz I-CRE8 http://www.i-cre8.co.uk Skype ID: I-CRE8
[jQuery] Re: jQuery Conference
Just throwing this out there, but I'm guessing it may be similar to the one day jQuery Camp '07 that was in Boston, MA following The Ajax Experience East conference (http://theajaxexperience.com). TAE is scheduled for Sept/Oct of this year. Cheers, -Jonathan On Wed, May 7, 2008 at 2:20 PM, Joe [EMAIL PROTECTED] wrote: Just watched John's video on What's Next for jQuery and Javascript ( http://vimeo.com/984675 ) and he mentioned a conference. I will definitely be attending, but need to know where I'm going and when! Anyone have any details on this?
[jQuery] Re: preset selection of radio buttons
I can never tell what's working here because there is the lag time of what is posted. if stuff is immediately mailed out then that is unfortunate, since the group allows for removal. The two concepts seem to be incompatible. On May 7, 1:17 pm, Christoph Haas [EMAIL PROTECTED] wrote: On Mittwoch, 7. Mai 2008, JP wrote: I hate this google group -- can't edit posts You said that three times already. You do know that this group is mainly a mailing list? And that's is technically impossible to cancel emails that are sent our to thousand of recipients already? Christoph signature.asc 1KDownload
[jQuery] Re: Expression/Selector question...
Hey Dan, Yeah, it's also strange that while this doesn't work: $(body ul li).filter($li[0]); this does: $(body ul li).not($li[0]); I'm a little lost by your parents example, though. Not sure exactly what you're trying to get (esp. since you don't show where you've declared $el and $parent. couldn't you do something like $el.parent() ? or $el.parent('.someclass') ? or $el.parents('.someclass:first') ? (just using class in the parents filter because not sure what you're after). --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On May 7, 2008, at 9:06 AM, Dan G. Switzer, II wrote: Just wonder if there were any comments to this? On May 5, 4:24 pm, Dan G. Switzer, II [EMAIL PROTECTED] wrote: One thing that I've noticed is that the expr attribute is pretty inconsistent across methods (such as filter, find, parents, parent, etc.) The documentation is very vague about what an expression is, other than it just being a selector. However I would assume a valid expression for one element would be valid for all elements, but I've noticed that an HTML element is only a valid expression in the find() method. For example: $li = $(li); // returns the first matches for $li $(body ul li).find($li[0]); // this actually errors with a t.substring is not a function error $(body ul li).filter($li[0]); // I would expect this to only return the element which is the first $li, // but instead it ignores the expression altogether and returns all parents $(li[rel=45]).parents($li[0]); Shouldn't expressions work the same across all methods? Right now I'm having to use this to find only the explicit parent: $el.parents().filter(function (){ return this === $parent[0]; }); However, if parents() worked like find() I would be able to do: $el.parents($parent[0]); (Before you say Why not just use $parent?, it's because I'm checking to see if an element is a child of a specific element.) -Dan
[jQuery] Re: [autocomplete] Hyperlinks in returned list
Hi Jose, just replace the location.href = item.url code with window.open(item.url). Jörn On Wed, May 7, 2008 at 5:50 PM, Jose [EMAIL PROTECTED] wrote: Hi, Is Chris approach documented anywhere ? It would be useful to be able to open a new window too. I did have this requirement when I first found the autocomplete library last year. I ended up writing my own autocomplete solution to meet the requirements. Let me know if you plan to develop a better solution as I'd rather use your Jörn library regards jose On Wed, May 7, 2008 at 11:27 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: I've documented my approach here: http://docs.jquery.com/Plugins/Autocomplete#Search_Page_Replacement Jörn On Sat, May 3, 2008 at 10:23 AM, theintoy [EMAIL PROTECTED] wrote: Jörn Hi. I would appreciate your solution too. Having checked the solution provided by Chris across all browsers, it appears IE7 throws an alert with the following text: Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus. I have assumed this is due to the textfield being made read-only. This was a nice touch by Chris and one which would be nice to keep in. Any ideas? Carl
[jQuery] Re: validating dynamically generated data
You need to run that validation on submit, too. If you don't need remote validation, you can still use the validation plugin and implement the logic you have as a custom method: http://docs.jquery.com/Plugins/Validation/Validator/addMethod#namemethodmessage Jörn On Wed, May 7, 2008 at 8:07 PM, jpl80 [EMAIL PROTECTED] wrote: I figured it out... mostly: $(document).ready(function() { $(div.instock input.order-qty).keyup(function(){ var x = parseInt($(this).val()); var y = parseInt($(this).siblings(span.qty).attr(title)); if (x y) { $(this).siblings(span.error).text(Not enough in stock); } else { $(this).siblings(span.error).text(); } }); }); however, it still allows the user to submit the form. How do I stop them from being able to submit the for if the quantity they ordered is over the limit? -- View this message in context: http://www.nabble.com/validating-dynamically-generated-data-tp17091060s27240p17111078.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] textarea remplacement
Hi, I'm searching for a textarea remplacement. Thanx for your help
[jQuery] Re: textarea remplacement
Do you mean: a) A way to replace a textarea on a page with something else? b) A user-input element similar to a textarea? JK -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of LPA Sent: Wednesday, May 07, 2008 3:12 PM To: jQuery (English) Subject: [jQuery] textarea remplacement Hi, I'm searching for a textarea remplacement. Thanx for your help
[jQuery] Best way to do Lightbox-like modal windows?
Hello! What's the best way to do a Lightbox-like modal windows? jqModal? Facebox? Thickbox? There are so many options out there, so many of them look so bloated and really getting confused. Maybe you guys with experience and all could show me the right way? I'm looking for the simplest, most elegant alternative where I can do stuff like newsletter signups, logins, etc. Much obliged, Kyrre
[jQuery] Simple AJAX Call to Google Maps
I'm having trouble taking various fields from a form, concatenating them and then sending it off to do a local business search on Google maps. I'll send the results to a lightbox for users to click, which will return the location information to another text field. Sorry, i'm new to the jQuery/JS scene! Any ideas to go forward? Thanks!
[jQuery] Re: Best way to do Lightbox-like modal windows?
blockUI - http://www.malsup.com/jquery/block/ You wanted simple. On May 7, 3:36 pm, Kyrre Nygård [EMAIL PROTECTED] wrote: Hello! What's the best way to do a Lightbox-like modal windows? jqModal? Facebox? Thickbox? There are so many options out there, so many of them look so bloated and really getting confused. Maybe you guys with experience and all could show me the right way? I'm looking for the simplest, most elegant alternative where I can do stuff like newsletter signups, logins, etc. Much obliged, Kyrre
[jQuery] Re: SELECTOR MADNESS! How To Grab Lowest Child Node's Text?!
Hey, made a 10 min class to do this. It doesn't use jQuery at all, so it will work as fast as possible. You only need to specify the translating function. Made a blog post to detail its use. http://flesler.blogspot.com/2008/05/textnode-translator-for-javascript.html I never used Google translator, but it probably requires AJAX, so pay attention to the 'sync' part. Cheers -- Ariel Flesler http://flesler.blogspot.com On 7 mayo, 16:22, Joe [EMAIL PROTECTED] wrote: Balazs, Thanks, but I tried your plugin and it did not work. There is no demo for say clicking a button and converting the page; the bookmarklet is cool, but doesn't really help when I can't get the plugin to work. I emailed you so hopefully I'll hear back... I did actually re-create your plugin, but didn't author it or add any bells and whistles, just translating an entire page and/or element... Cheers. Joe www.subprint.com On May 7, 1:39 pm, Balazs Endresz [EMAIL PROTECTED] wrote: Hi! I replied in the previous thread but it hasn't appeared in Google groups, just here:http://www.nabble.com/Selector-Madness!--How-to-Select-all-the-Text-o... So there is a translate plugin that works this way: http://code.google.com/p/jquery-translate/ On May 5, 9:32 pm, Joe [EMAIL PROTECTED] wrote: Last week I had a question on how to traverse the DOM and find all elements that had some text (p, a, li, h1, etc.) so I could manipulate it with Google's translation API. Well with some help from the community I was able to accomplish this feat. http://groups.google.com/group/jquery-en/browse_thread/thread/c63da32... However, I have a bigger problem. Now, when I grab theallproperelements: $a = $(' #container * ').contents(); And parse thru them tofindwhich ones have text, it does just that BUT if an unordered list is within a div and that UL has text it will show up not only with the UL, but within the DIV as well. $a.each(function() { ... translate stuff here ..}); So in iteration one, wefindthe DIV, and then locate any andALLtext in the DIV. Quite a bit for the header navigation. Example Result for Div: HOME BUSINESS CONTACT ABOUT Then the next iteration is the UL, and it finds its text, which is basically the same as the DIV's text result. Example Result for UL: HOME BUSINESS CONTACT ABOUT Then the next iteration is the LI element, which has the proper text but, The next iteration is the A element which is finally the text I actually want to translate. Example Result for LI and A: HOME So myquestionis how can Itraversedown and grab thelastchild on that particular branch of theDOM. Surely there's a way to check if current node has or does not have a child, but how with jQuery? Thanks! BTW, Ariel Fleisler's recommendation from the previous post appears to be the best approach, but my pure Javascript mixing with jQuery skills are not quite up to snuff to hash that out...- Ocultar texto de la cita - - Mostrar texto de la cita -
[jQuery] Re: Best way to do Lightbox-like modal windows?
I use JQuery UI Dialog ...easy and elegant :) enough for simple to complex dialog box. for displaying error/warning/info I use jqalert() as replacement of alert box by browser. On May 8, 4:36 am, Kyrre Nygård [EMAIL PROTECTED] wrote: Hello! What's the best way to do a Lightbox-like modal windows? jqModal? Facebox? Thickbox? There are so many options out there, so many of them look so bloated and really getting confused. Maybe you guys with experience and all could show me the right way? I'm looking for the simplest, most elegant alternative where I can do stuff like newsletter signups, logins, etc. Much obliged, Kyrre
[jQuery] Re: Best way to do Lightbox-like modal windows?
There's Shadowbox too (http://mjijackson.com/shadowbox/). On May 8, 12:06 am, Adwin Wijaya [EMAIL PROTECTED] wrote: I use JQuery UI Dialog ...easy and elegant :) enough for simple to complex dialog box. for displaying error/warning/info I use jqalert() as replacement of alert box by browser. On May 8, 4:36 am, Kyrre Nygård [EMAIL PROTECTED] wrote: Hello! What's the best way to do a Lightbox-like modal windows? jqModal? Facebox? Thickbox? There are so many options out there, so many of them look so bloated and really getting confused. Maybe you guys with experience and all could show me the right way? I'm looking for the simplest, most elegant alternative where I can do stuff like newsletter signups, logins, etc. Much obliged, Kyrre
[jQuery] Re: Modal Dialog in blockUI
On May 6, 9:34 am, Adam [EMAIL PROTECTED] wrote: Is it possible to show an external webpage inside of a blockUI modal dialog? I'd like to call another page via ajax and populate the dialog instead of using a reference to a hidden div, etc. You bet:: $('someLink').click(function(){ $.blockUI({ message: $('div/div').load($(this).attr('href')) }); return false; });
[jQuery] Re: Need help with hover and fadein and fade out
Something like this? http://www.commadot.com/jquery/hoverTableFade.php Glen On Wed, May 7, 2008 at 11:25 AM, Aaron [EMAIL PROTECTED] wrote: no that's not what I plan to do. What I am trying to do is this: I have an image of the user already on the page when the user puts it's mouse over the image I want a table or somthing that would fade it on top of the image . so that table will contain all photos the user uploaded when the user moves the mouse off the image or off the table the table will fade in. it's like a navigation but it's a quick way for the user or friends to look at their photo albums without loading a new page ect. On May 7, 1:34 pm, Glen Lipka [EMAIL PROTECTED] wrote: Does this help?http://commadot.com/jquery/hoverFade.php Maybe if you post something in the ballpark, we could help troubleshoot it? Glen On Tue, May 6, 2008 at 5:48 PM, Aaron [EMAIL PROTECTED] wrote: Can you give me an example code of what I need to do to get a table to fade in above the picture which when the mouse is over the picture will activate the fade in function and also when the mouse goes off the photo or that new fadeded in table then it would fade out. The table that fades will will contain more photos of that user. On May 3, 5:20 pm, Aaron [EMAIL PROTECTED] wrote: Hi I am having trouble using the hover and fade in and fade out I look at the doc I understand it but I don't understand how I can use it for what I want to do. I want the user to be able when the mouse is over a photo of them a table or window fades in with other photos they uploaded ect when the mouse moves off the photo or the table then the table or window fades out. can some one explain how I can do this and what rules I should follow when using hover and fade in and fade out ect. could I make a javascript use jquery? if so how?? I know I can do this in html but I would like to make a javascript with jquery functions ect and have that file added to the html doc.- Hide quoted text - - Show quoted text -
[jQuery] Re: jquery docs - example not working
Both val(val) demos working for me - FF2 on XP. - Richard On Wed, May 7, 2008 at 4:20 PM, JP [EMAIL PROTECTED] wrote: why does this jquery example for val(val) of radio buttons not work ? http://docs.jquery.com/Attributes/val
[jQuery] Checkbox confusion
Hi all, Can't quite get the the following functionality to work: 1. when I click on an un-checked checkbox, I want the box to be checked AND to raise an alert showing the text of the item which has just been checked. 2. Similarly if the user unchecks the box I want to raise an unchecked alert and then have the box unchecked. I have been trying to do this for about an hour but the behavior is: a. I am getting the Checked alert for clicks on both checked and unchecked checkboxes b. Once the user checks a box I get the Checked alert but the box never actually gets checked. The code is: $(#bChecklist li).click(function(event){ var item = $(this).text(); // get the label value if ($(this).not(':checked')){ event.preventDefault(); alert ('Checking = '+ item) this.checked = true; // my attempt to force an unchecked box to be true // after using event.preventDefault } else if ($(this).is(':checked')) { event.preventDefault(); alert ('UnChecking = '+item) } }); form id=myForm name=myForm action=/cm/BaB/create/ method=post . div class=row id=div2 fieldset id=bundleFields !-- Add dynamically -- legend id=bundleLegend Bundle Task/legend ul class=bChecklist id=bChecklist lilabel for=o1input id=o1 name=o1 type=checkbox class=bundleItem /MYTHINGY 1/label/li lilabel for=o2input id=o2 name=o2 type=checkbox class=bundleItem /MYTHINGY 2/label/li lilabel for=o3input id=o3 name=o3 type=checkbox class=bundleItem /MYTHINGY 3/label/li /ul /fieldset /divbr clear=all/ /form Not quite sure what I am doing wrong. .
[jQuery] beginner question on show/hide and reusing functions
I'm new to (writing anything myself with) jQuery, so bear with me if this is a boneheaded question. I'm trying to build a box that starts with six options, then if you click one of them, that content fades out, and is replaced with the content for that option. (You're given a different search box for each one). This is the code I have to show and hide. It sort-of works. It's certainly not optimal. In the actual code I have five more of that second function, each one specific to the div that is revealed. I know there has got to be a way to reuse the code. Based on the HTML below, can you help me optimize the jQuery code so I don't have to repeat things six times? Also, what I have here does work, but it's hella choppy in IE. Is there a better way to fade out and then fade in? script type=text/javascript $(document).ready(function() { // hides the boxes before the page loads $('.searchpanel').hide(); // show and hide $('a.show').click(function() { $('#searchoptions').hide('slow'); $('#musicsearch').show('slow'); return false; }); // // And five more just like the one above // // shows all $('a.showall').click(function() { $('#searchoptions').show('slow'); $('.searchpanel').hide(); return false; }); }); /script Here's the HTML I'm working with. div id=listings div id=searchoptions h3What are you looking for?/h3 ul id=searches lia href=#musicsearch class=showmusicspanMusic/span/ a/li lia href=#eventsearch class=showeventsspanEvents/span/ a/li lia href=#restaurantsearch class=showfoodspanRestaurants/span/a/li lia href=#barsearch class=showbarsspanBars amp; Clubs/ span/a/li lia href=#hotelsearch class=showhotelsspanPlaces to stay/span/a/li lia href=#recreationsearch class=showrecspanAttractions amp; recreation/span/a/li /ul /div div id=searchboxes div id=musicsearch class=searchpanel h3Search for Music/h3 pform goes here/p pa href=#searchbox class=showalllaquo; Start Over/a/p /div -- and five more just like the one above - div /div
[jQuery] Re: Superfish - modified Richard Willis
Hi Drew, If you remove the pathClass option, everything works fine. You don't seem to be using that feature so it should not be in the options object. Remove this line: pathClass : 'active', It looks like you could remove the bgIframe plugin also as you have not included the intialisation code for it to work with Superfish anyway. If you are using it elsewhere on the site then please disregard this comment. One more small thing: for better performance you should change the selector in the Superfish initialisation from '.menu_topmenu' to 'ul.menu_topmenu'. That way jQuery only has to check the ul elements for the class rather than every element in the DOM. Good luck... pretty site! Joel Birch.
[jQuery] Re: Superfish - modified Richard Willis
Just as I hit send I realised that you are indeed wanting to use the pathClass for the second tier of menu. The pathClass feature was only ever tested to work with two tiers unfortunately, so it makes sense that this bug exists. I'll have to have a think about what would be required to make this work correctly and get back to you. Joel Birch.
[jQuery] Re: Superfish - modified Richard Willis
If the 'if' is removed from the out function, the menu almost works perfectly. The only downside is that the current second tier menu is 'refreshed' when you mouseout rather than simply staying revealed. It disappears then animates back in as if it is being restored as it would if you moused out from a sibling non-current second tier menu. It may be an acceptable workaround for you though and it is far better than your current problem. Change the 'out' function to this: out = function(){ var $$ = $(this), menu = getMenu($$); var o = getOpts(menu,true); clearTimeout(menu.sfTimer); menu.sfTimer=setTimeout(function(){ $$.hideSuperfishUl(); if (o.$path.length){over.call(o.$path);} },o.delay); }, All I did there is remove the if statement. It's a hack, but until Superfish officially supports using pathClass with three tiered menus, this may have to suffice. I did try a few things to try and get a perfect result but it eluded me and I don't have as much time to spend on this as I used to unfortunately. I hope this workaround helps you out. Joel Birch.