[jQuery] Re: $(document).ready() vs $(function () {});
you are also using $.fn.ready(function(){ }); this is the most direct way to use it
[jQuery] Re: [validate] Trouble using rules( add, rules ) as well as setting attribute for range validations
Could you file a ticket for this? http://dev.jquery.com/newticket (requires registration) Thanks! Jörn On Mon, Oct 20, 2008 at 8:49 PM, lightglitch [EMAIL PROTECTED] wrote: I have made a patch for my app to the rules function to support custom messages: This is the new function, would be nice to have something similar to this. rules: function(command, argument) { var element = this[0]; if (command) { var staticRules = $.data(element.form, 'validator').settings.rules; var existingRules = $.validator.staticRules(element); switch(command) { case add: $.extend(existingRules, $.validator.normalizeRule(argument)); staticRules[element.name] = existingRules; / PATCH ***/ if (argument.messages) { if ($.data(element.form, 'validator').settings.messages[element.name]) $.extend($.data(element.form, 'validator').settings.messages[element.name],argument.messages); else $.data(element.form, 'validator').settings.messages[element.name] = argument.messages; } / END PATCH ***/ break; case remove: if (!argument) { delete staticRules[element.name]; return existingRules; } var filtered = {}; $.each(argument.split(/\s/), function(index, method) { filtered[method] = existingRules[method]; delete existingRules[method]; }); return filtered; } } var data = $.validator.normalizeRules( $.extend( {}, $.validator.metadataRules(element), $.validator.classRules(element), $.validator.attributeRules(element), $.validator.staticRules(element) ), element); // make sure required is at front if (data.required) { var param = data.required; delete data.required; data = $.extend({required: param}, data); } return data; }, And I use it like this: $(#field).rules(add, {required:true,range:[5,45],messages: {required:The field can\'t be blank.,range:The field must have 5 to 45 characters.}}); Hope it helps. On Oct 9, 11:00 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote: You can use metadata, too. Currently barely documented, and not really recommended either, but works since 1.4. input class={required:true,messages:{required:'required field'}} name=whatever / Jörn On Thu, Oct 9, 2008 at 5:20 PM, Bob Silverberg [EMAIL PROTECTED] wrote: Thanks for the quick response. That fixed my problem. One more question: I'd like to addcustomerror messages to some of my dynamic validations. Is it correct that the only way to add acustomerror messageto a particular rule is either by: 1. using the form.validate() method 2. using $.validator.addMethod to clone an existing method Thanks, Bob On Thu, Oct 9, 2008 at 4:22 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: Forrules(add) to work, the element's form has to be validated, that is, call $(form).validate() first. I've updated the documentation accordingly. Not sure why the attr-approach failed, I'll take a look at that. Jörn On Thu, Oct 9, 2008 at 2:37 AM, BobS [EMAIL PROTECTED] wrote: I'm working on a server-side component that will generate all of my jQuery validationrulesfrom xml metadata, so I'm trying to dynamically addrulesone at a time. My first attempt was to use therules( add,rules) syntax, but I'm getting an error on page load: jQuery.data(element.form, validator) is undefined Here's the syntax I'm using: $(#VerifyPassword).rules('add',{equalTo: '#UserPass'}); which seems to be correct according to the docs. So, I decided to try setting attributes instead, which works fine for the equalTo. For example, this works: $(#VerifyPassword).attr('equalTo','#UserPass'); But when trying to use attr to set a range I cannot figure out what to pass in for the range. I've tried: $(#UserPass).attr('rangelength','[5,10]'); - yeilds themessage Please enter a value between
[jQuery] Re: Help optimising jquery code - there must be a better way
I don't have time to rewrite your whole example, but I can offer a few tips that might help. Selecting by class alone can be pretty slow. Basically every single tag has to be checked for the class every time you do a selection by class. It would help to at least give the HTML tag that the class is being applied to, like $('li.current_page_item'). You do quite a few next/prev/addClass calls on the same elements, but you're reselecting them every time. I suggest you use the end function. Operations that modify what elements are selected work as a stack, and allow you to undo operations, like so: $(.current_page_item).next().addClass('after').end().prev().addClass('before'); $(.current_page_ancestor).next().addClass('after').end().prev().addClass('before'); Calls to the $ function are often expensive, so it can help to cache them in a local variable if you find you're calling $ with the same parameter multiple times. For that repetitive stuff you're doing at the end, I suggest you look into the each function. Hope it helps. --Erik On Mon, Oct 20, 2008 at 8:08 PM, Kent Humphrey [EMAIL PROTECTED]wrote: I am relatively new to jquery, but have managed to muddle my way through a complicated navigation design that has overlapping selected states, eg with menu items 1,2,3,4 and 5, when item 2 is selected, the images for items 1 and 3 also have to change. The code is long and convoluted, and I am sure there is a cleaner way to do what I am doing. If anyone has any ideas, that would be great. Here's the code: // setup before and after classes $(.current_page_item).next().addClass('after'); $(.current_page_item).prev().addClass('before'); $(.current_page_ancestor).next().addClass('after'); $(.current_page_ancestor).prev().addClass('before'); // do overlapping images $(#primary_nav a).hover( function() { if ((!$(this).parent().hasClass('current_page_ancestor')) (!$(this).parent().hasClass('current_page_item'))) { $(.current_page_item).next().removeClass('after'); $(.current_page_item).prev().removeClass('before'); $(.current_page_item).addClass(current_disabled); $(.current_page_ancestor).next().removeClass('after'); $(.current_page_ancestor).prev().removeClass('before'); $(.current_page_ancestor).addClass(current_disabled); } }, function() { $(.current_disabled).next().addClass('after'); $(.current_disabled).prev().addClass('before'); $(.current_disabled).removeClass(current_disabled); } ); $(#page_item_2 a).hover( function() { $(#page_item_5).addClass('after'); }, function() { if (!$(this).parent().hasClass('current_page_item')) { $(#page_item_5).removeClass('after'); } } ); $(#page_item_5 a).hover( function() { $(#page_item_2).addClass('before'); $(#page_item_7).addClass('after'); }, function () { if ((!$(this).parent().hasClass('current_page_ancestor')) (!$(this).parent().hasClass('current_page_item'))) { $(#page_item_2).removeClass('before'); $(#page_item_7).removeClass('after'); } } ); $(#page_item_7 a).hover( function() { $(#page_item_5).addClass('before'); $(#page_item_9).addClass('after'); }, function () { if (!$(this).parent().hasClass('current_page_item')) { $(#page_item_5).removeClass('before'); $(#page_item_9).removeClass('after'); } } ); $(#page_item_9 a).hover( function() { $(#page_item_7).addClass('before'); $(#page_item_11).addClass('after'); }, function () { if (!$(this).parent().hasClass('current_page_item')) { $(#page_item_7).removeClass('before'); $(#page_item_11).removeClass('after'); } } ); $(#page_item_11 a).hover( function() { $(#page_item_9).addClass('before'); }, function () { if (!$(this).parent().hasClass('current_page_item')) { $(#page_item_9).removeClass('before'); } } ); By way of explanation, this is using the css sprites method where I have a single image that is all the different states of the nav. The 'before' and 'after' classes are used to indicate the nav items either side of the selected item. 'current_page_item' and 'current_page_ancestor' are what WordPress uses to indicate the selected item, or the parent of the selected item. I am using 'current_disabled' to disable the 'current_page_item' style, so when you rollover the other nav items
[jQuery] Re: [validate] Trouble using rules( add, rules ) as well as setting attribute for range validations
Done. http://dev.jquery.com/ticket/3503 On Oct 21, 9:53 am, Jörn Zaefferer [EMAIL PROTECTED] wrote: Could you file a ticket for this?http://dev.jquery.com/newticket (requires registration) Thanks! Jörn On Mon, Oct 20, 2008 at 8:49 PM, lightglitch [EMAIL PROTECTED] wrote: I have made a patch for my app to therulesfunction to supportcustom messages: This is the new function, would be nice to have something similar to this. rules: function(command, argument) { var element = this[0]; if (command) { var staticRules = $.data(element.form, 'validator').settings.rules; var existingRules = $.validator.staticRules(element); switch(command) { case add: $.extend(existingRules, $.validator.normalizeRule(argument)); staticRules[element.name] = existingRules; / PATCH ***/ if (argument.messages) { if ($.data(element.form, 'validator').settings.messages[element.name]) $.extend($.data(element.form, 'validator').settings.messages[element.name],argument.messages); else $.data(element.form, 'validator').settings.messages[element.name] = argument.messages; } / END PATCH ***/ break; case remove: if (!argument) { delete staticRules[element.name]; return existingRules; } var filtered = {}; $.each(argument.split(/\s/), function(index, method) { filtered[method] = existingRules[method]; delete existingRules[method]; }); return filtered; } } var data = $.validator.normalizeRules( $.extend( {}, $.validator.metadataRules(element), $.validator.classRules(element), $.validator.attributeRules(element), $.validator.staticRules(element) ), element); // make sure required is at front if (data.required) { var param = data.required; delete data.required; data = $.extend({required: param}, data); } return data; }, And I use it like this: $(#field).rules(add, {required:true,range:[5,45],messages: {required:The field can\'t be blank.,range:The field must have 5 to 45 characters.}}); Hope it helps. On Oct 9, 11:00 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote: You can use metadata, too. Currently barely documented, and not really recommended either, but works since 1.4. input class={required:true,messages:{required:'required field'}} name=whatever / Jörn On Thu, Oct 9, 2008 at 5:20 PM, Bob Silverberg [EMAIL PROTECTED] wrote: Thanks for the quick response. That fixed my problem. One more question: I'd like to addcustomerror messages to some of my dynamic validations. Is it correct that the only way to add acustomerror messageto a particular rule is either by: 1. using the form.validate() method 2. using $.validator.addMethod to clone an existing method Thanks, Bob On Thu, Oct 9, 2008 at 4:22 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: Forrules(add) to work, the element's form has to be validated, that is, call $(form).validate() first. I've updated the documentation accordingly. Not sure why the attr-approach failed, I'll take a look at that. Jörn On Thu, Oct 9, 2008 at 2:37 AM, BobS [EMAIL PROTECTED] wrote: I'm working on a server-side component that will generate all of my jQuery validationrulesfrom xml metadata, so I'm trying to dynamically addrulesone at a time. My first attempt was to use therules( add,rules) syntax, but I'm getting an error on page load: jQuery.data(element.form, validator) is undefined Here's the syntax I'm using: $(#VerifyPassword).rules('add',{equalTo: '#UserPass'}); which seems to be correct according to the docs. So, I decided to try setting attributes instead, which works fine for the equalTo. For example, this works: $(#VerifyPassword).attr('equalTo','#UserPass');
[jQuery] Re: Equal height containers with expand abilities
In an attempt to think through the logic of the goal, here is more written out. Also, I have a much greater understanding of css than jquery at this time. A pass at writing out the logic: Determine the height of div “container” after the content is loaded. • If the height of “container” is greater than 400px Add class “sizer” ß .sizer { overflow:hidden; height:400px; } o Allow the paragraph inside div with class of “tag” to stay displayed (don’t do anything to it). o The link that is in the paragraph that is inside the div with the class of “tag” becomes a show/hide trigger. When clicked, allow “container” to be full size (remove class “sizer” ?) o When class “sizer” is added, there needs to be a way to add something to the where the content gets cut off. It would look/act like a truncate function. ß Perhaps something that counts back 5 characters from where it gets cut off and then add “…” • If the height of “container” is less than 400px o Add class “sizer” ß .sizer { overflow:hidden; height:400px; } ß This should keep a container with little or no content from collapsing down beyond 400px. o Add class to paragraph inside div with class of “tag”. Add “.show- none” ß .show-none {display:none;} Here is the code to work from updated: http://paste.pocoo.org/show/88630/
[jQuery] Re: Close current after delay
Hi Dom, Simply alter the line in the setTimeout function to this: $('ul.sf-menu li.current ul').fadeOut('slow'); Note that I have altered both the method and the selector here. Joel Birch.
[jQuery] Re: making the accordion remain open
I'm working on cookie persistence: When accordion is changed, it stores the active panel in a cookie, and restores that state on page load. Would that solve your problem? Jörn On Tue, Oct 21, 2008 at 12:54 PM, evo [EMAIL PROTECTED] wrote: Hi, I've ran into a problem using the accordion from http://bassistance.de/jquery-plugins/jquery-plugin-accordion/ Currently to keep the accordion open while navigating a site i add p=1 (or whatever number it may need) to the url, which works, but as soon as I need to pass other variables through the url it breaks down and won't remain open. So while http://domain.com/details.aspx?p=2 will work fine, http://domain.com/details.aspx?p=2id=4 doesn't work. Now I'm wondering there must be another way to have the accordion remain open as someone must of come across this before. Any help will be much appreciated
[jQuery] Protecting against multiple loads of jquery.js et.al.
I'm working on a highly asynchronous and compartmentalized component system where components each manage their own list of assets including js and css files. I've recently started using jQuery to implement popup dialogs that use an Ajax callback to populate the dialog with one of my components. This component needs to work in both a full page context and within a div based dialog. I don't want the component itself to have to know whether it's being used in one context or the other. As it turns out, the first component I loaded into my jquery.ui.dialog itself uses jquery and dutifully pulled in the jQuery.js library. It seems the jquery ajax handler handles embedded script tags. This summarily clobbered my first instance of jQuery causing all kinds of .dialog is not a function errors. Adding a conditional around jquery.js to test if it's already been loaded seems to work like a champ in both FF and MSIE: if ( typeof( jQuery ) == 'undefined' ) { ...rest of jquery.js... } The question is, is there some reason this isn't an acceptable safeguard? --- Yermo LamersDTLink, LLC Co-Founder Developer http://www.dtlink.com http://www.collabinvest.net - Instant Social Investing Don't invest alone, Profit Together! ---
[jQuery] accordion query
Hi folks, I'm using the following for an accordion style menu div class=accordion h3Latest news/h3 pLorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi malesuada, ante at feugiat tincidunt, enim massa gravida metus, commodo lacinia massa diam vel eros. Proin eget urna. Nunc fringilla neque vitae odio.br / read more about xxx...br / br / Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi malesuada, ante at feugiat tincidunt, enim massa gravida metus, commodo lacinia massa diam vel eros. Proin eget urna. Nunc fringilla neque vitae odio.br / read more about xxx.../p h3a href=http://www.google.co.uk;Useful contact list/a/h3 h3Email newsletter/h3 pJoin our email newsletter by completing your details below and we'll get you added and keep you updated.br / form id=form1 method=post action= labelName input type=text name=textfield id=textfield / /label br / labelEmail input type=text name=textfield2 id=textfield2 / /label br / label input type=submit name=button id=button value=Subscribe / /label /form/p h3Forum/h3 pLorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi malesuada, ante at feugiat tincidunt, enim massa gravida metus, commodo lacinia massa diam vel eros. Proin eget urna. Nunc fringilla neque vitae odio. Vivamus vitae ligula./p /div and this is the Javascript: script type=text/javascript $(document).ready(function(){ $(.accordion h3:first).addClass(active); $(.accordion p:not(:first)).hide(); $(.accordion h3).click(function(){ $(this).next(p).slideToggle(slow) .siblings(p:visible).slideUp(slow); $(this).toggleClass(active); $(this).siblings(h3).removeClass(active); }); }); /script When I view this in the browser the form is displayed automatically, how can I hide it until the user presses for the drop down? Thanks, S
[jQuery] Advice about Jquery selectors and updating content in DIV
Hello, Here's what I've made. I have a lot of divs on different pages which you can Digg (it's called hit). When I click on hit, I've made a code that send Ajax data to a second page which record everything needed in the database. That's working easily. But then, I need to add something to that and I can't. I need to update the number of diggs and add 1 when task is complete and I need also to add it just in one div. I also have a little message showing up but that's not necessary for now. Here's my JS script $('.hit').each(function(){ $(this).click(function(){ var id=this.id; $.post('../../posts/hit.php', {id:id}, function (responseText){ if (responseText == 1){ $ ('#responseSuccess').slideDown(1000).fadeOut(4000); } }) return false; }) }) And here's my code where the html is a class=hit id=?php echo $id_article ;?Hit/a span style=color:?php echo $link_color;? ?php echo ' (span class=hit_outputspan' . $donnees['hit'] . '/span /span)';?/span I probably put too much span and stuff but I tried several things. THe fact is it never updates just the number of diggs (hits) on the actual div but on all of them. Or when I had a message id=responseText it always shows at the same place even if he updates the good id. Well, I hope I'm clear. I'm not really good at JS so I just try to work things out. Thanks in advance, Ced
[jQuery] what is difference between $(document).height() and $(window).height() ?
what is difference between $(document).height() and $ (window).height() ?
[jQuery] Find index of div with class selected
I'm trying to get the index of a div marked as selected, it's all a bit complicated because I have two levels of selected divs. My mark up looks like this: div id=container div id=kid1 class=kid selected div id=k1w1 class=week selected/div div id=k1w2 class=week/div div id=k1w3 class=week/div div id=k1w4 class=week/div /div div id=kid2 class=kid div id=k2w1 class=week/div div id=k2w2 class=week/div div id=k2w3 class=week/div div id=k2w4 class=week/div /div div id=kid3 class=kid div id=k3w1 class=week/div div id=k3w2 class=week/div div id=k3w3 class=week/div div id=k3w4 class=week/div /div div id=kid4 class=kid div id=k4w1 class=week/div div id=k4w2 class=week/div div id=k4w3 class=week/div div id=k4w4 class=week/div /div /div What would be the correct code to grab the index of the third nested div with the class selected? I've tried things like: var sk = #container div:eq(0); var swi = $(sk + div).index($(.selected)); It's probably pretty obvious I'm stumbling in the dark...
[jQuery] jQuery efficiency with a large DOM.
Hi, I have a web app that is hosted within a .hta wrapper (for some security uses including hosting an ActiveX control) therefore uses ie as its engine. The app rarely, if ever leaves the containing page and all interaction with the server is done using ajax and loading information into various container 'controls' - hidden at times but left in the DOM for easy re-use, rather than reloading every time they want to view. I am finding that the speed of the interface is suffering badly as more stuff is loaded into the DOM. Most selectors are ID based ones where possible, therefore should be as efficient as possible. I cache jQuery objects where possible to avoid re-searching What I am finding is that it can take almost 2 seconds for an event to even be actioned by the browser - e.g a simple onclick on an element in a dynamically loaded chunk of HTML markup can take this time to even start actioning a $.get request. Anyone any thoughts as to why? Apart from it's IE - I get similar delays on FF and Chrome, but nowhere near the same magnitude. I am trying to keep the DOM as clean as possible, but it's hard with such a rich app. Any tips and tricks for efficiency in large DOM pages with jQuery? TIA.
[jQuery] accordion box query
I'm using the Accordion #1 example found on: http://www.webdesignerwall.com/tutorials/jquery-tutorials-for-designers/ Rather than stick with p tags in the accordion, I want to have a form in one of them. I added $(.accordion form:not(:first)).hide(); in the hope it would hide the contents until expanded - this didn't work sadly. Any thoughts on how to fix? Thanks, S
[jQuery] Re: Selecting multiple table rows with jQuery and Tablesorter
First, I'm sorry I have no answers, but I want you to know you are not alone with this issue. I also need users to be able to select multiple rows at once, using a modifier key like shift. Sometimes they will select 20 rows at a time so clicking each one individually would be a usability nightmare. I will be watching this thread with high hopes, I've also seen Grid and Ingrid which are very close, but not quite there. On Oct 8, 1:15 pm, shakerdesigns [EMAIL PROTECTED] wrote: I've been looking around, but have yet to find the right jquery solution for selecting table rows using jQuery and the Tablesorter plugin. I've created a widget to toggle css classes and highlight each selected row, but I'm looking for more functionality than that. I've also seen other plugins like Ingrid andGrid, but they don't have the control I need. Specifically, I'm looking to use 'click' toselecta row, 'ctrl+click' toselectmultiple rows, keyboard shortcuts toselectall rows ('ctrl+a') and the ability to navigate thru the table with the arrow keys. Similar to the functionality found in a desktop spreadsheet program like Numbers or Excel. Does anyone know of a solution or could provide some feedback as to how I might make one? -- View this message in context:http://www.nabble.com/Selecting-multiple-table-rows-with-jQuery-and-T... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] call a php function with onclick
Hi, I would like to know how it is possibile to call a php function inside an onclick=function (), I try to explain me better I have 2 php functions : 1. add_friend($me,$friend) and 2. remove_friend($me, $firend) I would like to have 2 links in this way: a href=# id=add-friend onclick=add_friend($me,$friend)Add Friend/a a href=# id=add-friend onclick=remove_friend($me,$friend)Remove Friend/a when I click on the first link I call the add function when I click on the other the remove It is something similat to the twitter or pownce code I have written it on this page: http://www.jabberout.com/wiki/index.php/Action_buttons please some easy tutorial to solve it :) Ciao Stefano
[jQuery] Re: jquery newbie help please!
Bump. Sorry, I just really need help ... On Oct 20, 3:57 pm, Ben [EMAIL PROTECTED] wrote: Hi, I'm new to jquery and am having a couple issues on a site I've designed. I am using 2 jquery techniques: dd accordian and a animated image load i sorta hacked together. Both have slight glitches that I can's seem to figure out. Can someone please offer some guidance on either of the following issues onhttp://www.elizabethkosichnewyork.com/: 1. DDAccordian: It seems to be mainly an IE6.0 issue, though I've run into it on Safari as well, but there is some overlapping that occurs between the hidden subcats and the other categories as you click thru the menu. It's almost as if they're colliding with each other. There's a chance the problem could be more CSS related than JQuery, but I can't figure it out. 2. Image load: I have a little script on the about pages, the store locator page, and the content page that looks like this: script $(window).bind(load, function() { $('#wrapper').hide(); $('#wrapper').show('slow'); return false; }); /script What I am wanting this to do is, once the image is loaded (I tried DOM Ready before but that was too soon) and then slide in like it does. Right now, the images is flashing ever-so briefly before it hides. Any idea how I can do this better? Thanks so much for your help!
[jQuery] Re: Hover bug with scrollbars
I reckon that this is the same bug as I reported here (see the comments from 21.10.2008). navigation using .hover() does not disappear in FF if the mouse leaves the navigation over a element such input=text. http://www.kriesi.at/archives/create-a-multilevel-dropdown-menu-with-css-and-improve-it-via-jquery#comment-2287 I hope there is a fix for this somewhere ... T. On Oct 16, 8:00 pm, James [EMAIL PROTECTED] wrote: On elements with overflow:auto; set so they have a vertical scrollbar, the on-hover event fires when themousehovers over the element. When themouseleavesthe element by passing over the scrollbar, the off- hover event does not fire. I've tested this on Firefox 3, and it seems to be reproducible. Is this a jQuery bug?
[jQuery] Re: Ajax Request - Success and Failure Events
On Oct 20, 11:42 pm, Mike Alsup [EMAIL PROTECTED] wrote: I was reading the jQuery help docs (in the Ajax Events section), and I came across this statement: you can never have both an error and a success callback with a request Does anyone know why you can't do this? I can think of a number of situations where you would need to cater for both events. That statement should say they will never both be invoked for a single request. You can, and should, declare both a success and error handler. Ah! That makes a lot more sense! Thanks!
[jQuery] Re: Find index of div with class selected
It seems like I've got somewhere - though I am still confused. div id=container div id=kid1 class=kid select div id=k1w1 class=week/div div id=k1w2 class=week selected/div div id=k1w3 class=week/div div id=k1w4 class=week/div /div div id=kid2 class=kid div id=k2w1 class=week/div div id=k2w2 class=week/div div id=k2w3 class=week/div div id=k2w4 class=week selected/div /div div id=kid3 class=kid div id=k3w1 class=week selected/div div id=k3w2 class=week/div div id=k3w3 class=week/div div id=k3w4 class=week/div /div div id=kid4 class=kid div id=k4w1 class=week/div div id=k4w2 class=week selected/div div id=k4w3 class=week/div div id=k4w4 class=week/div /div /div Now I have changed #kid1 to have a class select instead of selected and this code brings up the correct index for the div with class selected in the first group of weeks (was there some kind of conflict before because the parent had the class I was looking for?): var spoon = $(#container div:eq(0) div).index($(.selected)); If i change the :eq to (1) or (2) or (3) to theoretically grab hold of the other 3 divs inside #container, it returns -1. Am I totally missing something with index?
[jQuery] making the accordion remain open
Hi, I've ran into a problem using the accordion from http://bassistance.de/jquery-plugins/jquery-plugin-accordion/ Currently to keep the accordion open while navigating a site i add p=1 (or whatever number it may need) to the url, which works, but as soon as I need to pass other variables through the url it breaks down and won't remain open. So while http://domain.com/details.aspx?p=2 will work fine, http://domain.com/details.aspx?p=2id=4 doesn't work. Now I'm wondering there must be another way to have the accordion remain open as someone must of come across this before. Any help will be much appreciated
[jQuery] jQuery Documentation in PDF
Hi: I made a program for create a PDF of the jQuery and jQueryUI from the xml. There's also the source code of the program (made in VS2005/C#). I hope someone find the docs in PDF usefull as me :) You can download from: Docs in pdf: http://www.puntoequis.com.ar/aktive/soft/jQueryDocumentation.7z Program to create: http://www.puntoequis.com.ar/aktive/soft/jQueryDocs-Creator.7z I will post updates in my page (in spanish) http://www.puntoequis.com.ar/npx/default.aspx?VIEWENTRY050057 Jonatan
[jQuery] Vallidation Problem
Hai, I am using Jquery for checking textboxes is entered or not.If the text entered is correct then i want to show a message success using jquery.How is it possible. I will attach the code below: table class=style8 id=myTable tr td class=style11 dxe:ASPxTextBox ID=tbCustomerName CssClass=large required email runat=server Width=170px / dxe:ASPxTextBox /td td asp:RequiredFieldValidator ID=rfvCustomerName runat=server Display=Dynamic ControlToValidate=tbCustomerName ErrorMessage=Customer Name is required span id=myCustomer class=errorCustomer Name is required/span/ asp:RequiredFieldValidator /td /tr /table Also is it possible to show the same message in a popup window and if the text entered the popup will be disappear.Please help me to sort out this error.
[jQuery] Re: making the accordion remain open
Hi Jörn, I was wondering if you had anything in a workable state for me to use? Thanks, Liam evo wrote: This sounds like something which could definitely work. Thanks Jörn On Oct 21, 12:09 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote: I'm working on cookie persistence: When accordion is changed, it stores the active panel in a cookie, and restores that state on page load. Would that solve your problem? Jörn On Tue, Oct 21, 2008 at 12:54 PM, evo [EMAIL PROTECTED] wrote: Hi, I've ran into a problem using the accordion from http://bassistance.de/jquery-plugins/jquery-plugin-accordion/ Currently to keep the accordion open while navigating a site i add p=1 (or whatever number it may need) to the url, which works, but as soon as I need to pass other variables through the url it breaks down and won't remain open. So whilehttp://domain.com/details.aspx?p=2will work fine, http://domain.com/details.aspx?p=2id=4doesn't work. Now I'm wondering there must be another way to have the accordion remain open as someone must of come across this before. Any help will be much appreciated
[jQuery] Re: making the accordion remain open
var accordion = $(#accordion); var index = $.cookie(accordion); var active; if (index !== null) { active = accordion.find(h3:eq( + index + )); } else { active = 0 } accordion.accordion({ header: h3, active: active, change: function(event, ui) { var index = $(this).find(h3).index ( ui.newHeader[0] ); $.cookie(accordion, index, { path: / }); } }); Jörn On Tue, Oct 21, 2008 at 2:24 PM, Liam Potter [EMAIL PROTECTED] wrote: Hi Jörn, I was wondering if you had anything in a workable state for me to use? Thanks, Liam evo wrote: This sounds like something which could definitely work. Thanks Jörn On Oct 21, 12:09 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote: I'm working on cookie persistence: When accordion is changed, it stores the active panel in a cookie, and restores that state on page load. Would that solve your problem? Jörn On Tue, Oct 21, 2008 at 12:54 PM, evo [EMAIL PROTECTED] wrote: Hi, I've ran into a problem using the accordion from http://bassistance.de/jquery-plugins/jquery-plugin-accordion/ Currently to keep the accordion open while navigating a site i add p=1 (or whatever number it may need) to the url, which works, but as soon as I need to pass other variables through the url it breaks down and won't remain open. So whilehttp://domain.com/details.aspx?p=2will work fine, http://domain.com/details.aspx?p=2id=4doesn't work. Now I'm wondering there must be another way to have the accordion remain open as someone must of come across this before. Any help will be much appreciated
[jQuery] Re: making the accordion remain open
This sounds like something which could definitely work. Thanks Jörn On Oct 21, 12:09 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote: I'm working on cookie persistence: When accordion is changed, it stores the active panel in a cookie, and restores that state on page load. Would that solve your problem? Jörn On Tue, Oct 21, 2008 at 12:54 PM, evo [EMAIL PROTECTED] wrote: Hi, I've ran into a problem using the accordion from http://bassistance.de/jquery-plugins/jquery-plugin-accordion/ Currently to keep the accordion open while navigating a site i add p=1 (or whatever number it may need) to the url, which works, but as soon as I need to pass other variables through the url it breaks down and won't remain open. So whilehttp://domain.com/details.aspx?p=2will work fine, http://domain.com/details.aspx?p=2id=4doesn't work. Now I'm wondering there must be another way to have the accordion remain open as someone must of come across this before. Any help will be much appreciated
[jQuery] Re: making the accordion remain open
Hi Jörn, I was wondering how this sets and uses the cookie. I also assume I can still use a class rather then a html tag to find the header so h3 could be come .head ? thanks again On Oct 21, 1:27 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote: var accordion = $(#accordion); var index = $.cookie(accordion); var active; if (index !== null) { active = accordion.find(h3:eq( + index + ));} else { active = 0 } accordion.accordion({ header: h3, active: active, change: function(event, ui) { var index = $(this).find(h3).index ( ui.newHeader[0] ); $.cookie(accordion, index, { path: / }); } }); Jörn On Tue, Oct 21, 2008 at 2:24 PM, Liam Potter [EMAIL PROTECTED] wrote: Hi Jörn, I was wondering if you had anything in a workable state for me to use? Thanks, Liam evo wrote: This sounds like something which could definitely work. Thanks Jörn On Oct 21, 12:09 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote: I'm working on cookie persistence: When accordion is changed, it stores the active panel in a cookie, and restores that state on page load. Would that solve your problem? Jörn On Tue, Oct 21, 2008 at 12:54 PM, evo [EMAIL PROTECTED] wrote: Hi, I've ran into a problem using the accordion from http://bassistance.de/jquery-plugins/jquery-plugin-accordion/ Currently to keep the accordion open while navigating a site i add p=1 (or whatever number it may need) to the url, which works, but as soon as I need to pass other variables through the url it breaks down and won't remain open. So whilehttp://domain.com/details.aspx?p=2willwork fine, http://domain.com/details.aspx?p=2id=4doesn'twork. Now I'm wondering there must be another way to have the accordion remain open as someone must of come across this before. Any help will be much appreciated
[jQuery] Re: Close current after delay
Thx a lot! So simple and power full with jquery. Damned... :o) Dom On Oct 21, 12:11 pm, Joel Birch [EMAIL PROTECTED] wrote: Hi Dom, Simply alter the line in the setTimeout function to this: $('ul.sf-menu li.current ul').fadeOut('slow'); Note that I have altered both the method and the selector here. Joel Birch.
[jQuery] Re: making the accordion remain open
Yes, just modify the code I provided accordingly. A solution integrated into the plugin will take some time. Jörn On Tue, Oct 21, 2008 at 2:31 PM, evo [EMAIL PROTECTED] wrote: Hi Jörn, I was wondering how this sets and uses the cookie. I also assume I can still use a class rather then a html tag to find the header so h3 could be come .head ? thanks again On Oct 21, 1:27 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote: var accordion = $(#accordion); var index = $.cookie(accordion); var active; if (index !== null) { active = accordion.find(h3:eq( + index + ));} else { active = 0 } accordion.accordion({ header: h3, active: active, change: function(event, ui) { var index = $(this).find(h3).index ( ui.newHeader[0] ); $.cookie(accordion, index, { path: / }); } }); Jörn On Tue, Oct 21, 2008 at 2:24 PM, Liam Potter [EMAIL PROTECTED] wrote: Hi Jörn, I was wondering if you had anything in a workable state for me to use? Thanks, Liam evo wrote: This sounds like something which could definitely work. Thanks Jörn On Oct 21, 12:09 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote: I'm working on cookie persistence: When accordion is changed, it stores the active panel in a cookie, and restores that state on page load. Would that solve your problem? Jörn On Tue, Oct 21, 2008 at 12:54 PM, evo [EMAIL PROTECTED] wrote: Hi, I've ran into a problem using the accordion from http://bassistance.de/jquery-plugins/jquery-plugin-accordion/ Currently to keep the accordion open while navigating a site i add p=1 (or whatever number it may need) to the url, which works, but as soon as I need to pass other variables through the url it breaks down and won't remain open. So whilehttp://domain.com/details.aspx?p=2willwork fine, http://domain.com/details.aspx?p=2id=4doesn'twork. Now I'm wondering there must be another way to have the accordion remain open as someone must of come across this before. Any help will be much appreciated
[jQuery] can someone please help with dynamic links problem?
Hello, I an quite new to jquery and hope someone can help with my problem. I am trying to load dynamic content in to a div(myobj)... the code i have so far is more or less as follows. it creates a box with 2 links, that it gets from 'name_ctg'. the links, are category names and when clicked should load products.php, with the right product, as was determined by the link that was clicked. I hope that make sense... now the problem is that only the first link works, the second link does nothing. I hope someone can help. script src=jquery.js/script script $(document).ready(function(){ $(#generate2).click(function(){ $(#myobj).fadeOut(fast); $(#myobj).slideToggle(slow); $(#myobj).load(products.php?idctg_ctg=?php echo $row_categorys['idctg_ctg']; ?); }); }); /script style type=text/css !-- #myobj { background-color: #CC; height: 300px; width: 500px; } -- /style /head body div id=myobj align=center ?php do { ? a href=# id=generate2 ?php echo $row_categorys['name_ctg']; ? br ?php } while ($row_categorys = mysql_fetch_assoc($categorys)); ? /div /body /html ?php mysql_free_result($categorys); ? -- View this message in context: http://www.nabble.com/can-someone-please-help-with-dynamic-links-problem--tp20090838s27240p20090838.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: History Plugin
I've Problem with it, when I do Ajax Call and and I filter the links in the New Page the History will not Include the Previous Links . consider this is the Page : !---Page A --- div a href='#1' id='1'/a a href='#2' id='2'/a a href='#3' id='3'/a a href='#4' id='4'/a div id=''load Ajax Contenct Comes here/div /div !---Page B --- div a href='#5' id='5' /a a href='#6' id='6' /a a href='#7' id='7' /a a href='#8' id='8' /a /div !-Script - // Don't worry for Live Event it is supported by LiveQuery $(#1,#2,#3,#4,#5,#6,#7,#8).history(function() { alert($ (this).attr(''id)); }); $.ajaxHistory.initialize(); the problem is when you are in the A page links 1 ,2 ,3 ,4 works But when you Click on Link number 5 which is loaded by Ajax it doesn't support 1 ,2 ,3 ,4 LInks , It only works with 6 ,7 ,8 so .. how could I import the BookMarkable system to the AJAX system ... and even I could not Book mark #5 page because it is not indexed in the first Page ... so does any one has an answere for me thanks Regards Pedram On Oct 18, 6:04 am, Rey Bango [EMAIL PROTECTED] wrote: You have a couple of options available: http://stilbuero.de/jquery/history/http://plugins.jquery.com/project/jHistory One suggestion to help you out in the future is to be sure to check out the plugin repo. It has a ton of extensions for many different use cases. http://plugins.jquery.com/ Rey Pedram wrote: Dear Folks , I need to make my webpages bookMarkable and do remember some history . does any one has a link for us .. thanks .
[jQuery] problem with click event-IE needs to click where FF needs only one:
script type=text/javascript $(document).ready(function(){ $(#pac).click(function(){ $(#pac).animate({marginTop: 17px, paddingBottom: 17px, borderBottom: 2px solid white}, 2500 ); $.post(rpc.php, {u:genia}, function(data){ if(data.length 0) { $(#pac_c).append(data); }else{ $(#pac_c).css({overflow: none, display: none}); } $(#pac_c).css({overflow: auto, display: block}); })}); }); /script In FF the div animates and do the Post with only one click(like i want) on IE i need to click twice for it to the POST too/ any help?
[jQuery] BlockUI Plugin - FadeIn?
Is there a way to get the 'Modal Dialog' feature of this plugin to fade in? It already fade outs by default when the dialog is canceled. -Thx
[jQuery] Setting select menu option value with onClick event
Hi All, I'm trying to manually change the value of a select menu to a certain option by referencing it's value. I've got the three instances I've tried (below) which aren't changing the select menu option correctly, in which am having trouble getting the correct syntax as to how to SET the value on an onClick event. + lia href=# onClick=$(#select_9).attr('value','23')); return false;one/a/li +lia href=# onClick=$ (select[id='select_9']).attr('value','23')); return false;/a/ li +lia href=# onClick=$(select_9).val(23); return false;/ a/li Can someone help me find the correct syntax? Thanks!
[jQuery] Fading out the CONTENTS of a form field (ie: the value)
Hiya guys, I've put together a basic handler for clicking on a field. It simply empties the field for you when selected, and if you don't enter anything it puts the default text back in: $(#field_154038).focus(function () { if ( $(this).val() == Please enter your postcode ) { $(this).val(); } }); $(#field_154038).blur(function () { if ( $(this).val() == ) { $(this).val(Please enter your postcode); } }); This works fine, but an additional nicety I tried to add was a fade in/ out. I've given it a stab but have been unable to work out how to simply grab hold of the text contents of the field so it can be manipulated. If this is possible, could you please tell me how? :)
[jQuery] validate plugin and CodeIgniter
hi i'm giving a go at codeIgniter using jquery for the js side. So i got a form which i validate with the validate plugin but in CI when i submit the form the js starts a loop and i must shut down the browser. I read somewhere that it could be because the validate plugin use the GET method by default which CI refuse to accept. Is this true? Anyone has used this two togheter? Thanks Vitto
[jQuery] Re: validate plugin and CodeIgniter
A testpage would help. Does CI use any javascript to handle the form submit? Its possible that CI submits the form via JavaScript, triggering the validation again. Not very likely though. Jörn On Tue, Oct 21, 2008 at 5:21 PM, hcvitto [EMAIL PROTECTED] wrote: hi i'm giving a go at codeIgniter using jquery for the js side. So i got a form which i validate with the validate plugin but in CI when i submit the form the js starts a loop and i must shut down the browser. I read somewhere that it could be because the validate plugin use the GET method by default which CI refuse to accept. Is this true? Anyone has used this two togheter? Thanks Vitto
[jQuery] Re: Advice about Jquery selectors and updating content in DIV
You should wrap all your HTML for a single 'hit' inside a tag so you can refer to it easily, like: div class=hit id=id_article a href=#Hit/a span class=hits484/span /div Then your script could look like this (you can assign click handlers to multiple elements at the same time): $('.hit').click(function(){ var id=this.id var hit = this; $.post('../../posts/hit.php', {id:id}, function (data){ if (data == 1){ $(hit).children('hit_output').text(newvalue); $('#responseSuccess').slideDown(1000).fadeOut(4000); }; }); return false; }); For the response message you could append it to the current hit and use CSS relative positioning. - ricardo On Oct 21, 7:53 am, Brandnew [EMAIL PROTECTED] wrote: Hello, Here's what I've made. I have a lot of divs on different pages which you can Digg (it's called hit). When I click on hit, I've made a code that send Ajax data to a second page which record everything needed in the database. That's working easily. But then, I need to add something to that and I can't. I need to update the number of diggs and add 1 when task is complete and I need also to add it just in one div. I also have a little message showing up but that's not necessary for now. Here's my JS script $('.hit').each(function(){ $(this).click(function(){ var id=this.id; $.post('../../posts/hit.php', {id:id}, function (responseText){ if (responseText == 1){ $ ('#responseSuccess').slideDown(1000).fadeOut(4000); } }) return false; }) }) And here's my code where the html is a class=hit id=?php echo $id_article ;?Hit/a span style=color:?php echo $link_color;? ?php echo ' (span class=hit_outputspan' . $donnees['hit'] . '/span /span)';?/span I probably put too much span and stuff but I tried several things. THe fact is it never updates just the number of diggs (hits) on the actual div but on all of them. Or when I had a message id=responseText it always shows at the same place even if he updates the good id. Well, I hope I'm clear. I'm not really good at JS so I just try to work things out. Thanks in advance, Ced
[jQuery] Re: Setting select menu option value with onClick event
Try: $(select[id='select_9']).val('23'); http://docs.jquery.com/Attributes/val#val Mauricio -Mensagem Original- De: lt [EMAIL PROTECTED] Para: jQuery (English) jquery-en@googlegroups.com Cc: [EMAIL PROTECTED] Enviada em: terça-feira, 21 de outubro de 2008 11:48 Assunto: [jQuery] Setting select menu option value with onClick event Hi All, I'm trying to manually change the value of a select menu to a certain option by referencing it's value. I've got the three instances I've tried (below) which aren't changing the select menu option correctly, in which am having trouble getting the correct syntax as to how to SET the value on an onClick event. + lia href=# onClick=$(#select_9).attr('value','23')); return false;one/a/li +lia href=# onClick=$ (select[id='select_9']).attr('value','23')); return false;/a/ li +lia href=# onClick=$(select_9).val(23); return false;/ a/li Can someone help me find the correct syntax? Thanks!
[jQuery] Re: Help with Superfish
Hello Joel, Thanks for the response! I managed to figure it out... you were right i had been applying the style to the anchor elements. It works exactly perfect now! The only thing I would like to do, and I am not sure how to implement it at this time: add a different background image for the last item (or an empty item) in a menu list. I am using an image for the background currently. Basically I am wishing to create an image with rounded corners for the end of the menu (and the moz border radius didnt create a good result). Any brief suggestions would be appreciated. I really enjoy superfish. Many Thanks. On Oct 20, 6:28 pm, Joel Birch [EMAIL PROTECTED] wrote: Hello, From a scan of your CSS it seems that you are applying the images to the anchor elements. However, when you are hovering within a submenu, the associated parent anchor is no longer being hovered, so the hover image is lost. Try applying the images to the li elements and leave the anchor backgrounds transparent. The parent li element is still being hovered when the cursor is within the associated submenu, hence the hover image will remain. Replace this type of declaration: #nav-aboutus a:hover { background-image: ... With this kind of thing: #nav-aboutus:hover, #nav-aboutus.sfHover { background-image: ... Notice that you will need to add the .sfHover selector in addition to each :hover selector in order to support IE6. It also has the added bonus of applying your desired affect when using the keyboard to tab through the menu. Joel Birch.
[jQuery] Change code based on link clicked
I'm new to jQuery and JS I want to change a snippet of code based on which link the user clicked. So if the user clicked this link on the page: # click me I would like to hide a particular snippet of code inside a script tag. But I'm not really sure how to write the JS/jQuery Example: script $(#vclick2).click(function(){ if the above link (#vclick2) is clicked hide part of the script }); /script I'm having trouble getting it to work. -- View this message in context: http://www.nabble.com/Change-code-based-on-link-clicked-tp20091922s27240p20091922.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] drag drop not working under IE and Safari
Hi, I'm working on this drag drop script: http://www.lesperimento.netsons.org/various/jquery-mousemove/ It works on Firefox and Opera but not at all on IE and Safari. The events seemed not to start at all... Any idea how to solve it? I tried to put some alert as well but they don't start, like if javascript were disabled. But it's not because in some other pages it works. Thank you in advance
[jQuery] Re: Find index of div with class selected
index() returns -1 when the element is not found. It fails because the object array passed contains elements that are not children of your first object. In your case you need to store a reference to the parent element and pass only it's children to the index() function: var kid = $('#container .kid:eq(0)'); // to access an arbitrary 'kid' $('.week',kid).index($('.week.selected',kid)); or // to get the selected one var kid = $('#container .kid.selected'); $('.week',kid).index($('.week.selected',kid)); - ricardo On Oct 21, 9:27 am, jimster [EMAIL PROTECTED] wrote: It seems like I've got somewhere - though I am still confused. div id=container div id=kid1 class=kid select div id=k1w1 class=week/div div id=k1w2 class=week selected/div div id=k1w3 class=week/div div id=k1w4 class=week/div /div div id=kid2 class=kid div id=k2w1 class=week/div div id=k2w2 class=week/div div id=k2w3 class=week/div div id=k2w4 class=week selected/div /div div id=kid3 class=kid div id=k3w1 class=week selected/div div id=k3w2 class=week/div div id=k3w3 class=week/div div id=k3w4 class=week/div /div div id=kid4 class=kid div id=k4w1 class=week/div div id=k4w2 class=week selected/div div id=k4w3 class=week/div div id=k4w4 class=week/div /div /div Now I have changed #kid1 to have a class select instead of selected and this code brings up the correct index for the div with class selected in the first group of weeks (was there some kind of conflict before because the parent had the class I was looking for?): var spoon = $(#container div:eq(0) div).index($(.selected)); If i change the :eq to (1) or (2) or (3) to theoretically grab hold of the other 3 divs inside #container, it returns -1. Am I totally missing something with index?
[jQuery] Re: jQuery efficiency with a large DOM.
How many event handlers do you have registered? IE starts to slow down at some point. It seems that the obvious performance improvements have been taken care of (id selectors, tag names for class selectors), anything else would be implementation specific. Are you using livequery? On Oct 21, 7:48 am, mrmoosehead [EMAIL PROTECTED] wrote: Hi, I have a web app that is hosted within a .hta wrapper (for some security uses including hosting an ActiveX control) therefore uses ie as its engine. The app rarely, if ever leaves the containing page and all interaction with the server is done using ajax and loading information into various container 'controls' - hidden at times but left in the DOM for easy re-use, rather than reloading every time they want to view. I am finding that the speed of the interface is suffering badly as more stuff is loaded into the DOM. Most selectors are ID based ones where possible, therefore should be as efficient as possible. I cache jQuery objects where possible to avoid re-searching What I am finding is that it can take almost 2 seconds for an event to even be actioned by the browser - e.g a simple onclick on an element in a dynamically loaded chunk of HTML markup can take this time to even start actioning a $.get request. Anyone any thoughts as to why? Apart from it's IE - I get similar delays on FF and Chrome, but nowhere near the same magnitude. I am trying to keep the DOM as clean as possible, but it's hard with such a rich app. Any tips and tricks for efficiency in large DOM pages with jQuery? TIA.
[jQuery] Re: Linkselect Plug-in Released...
Thanks for sharing. Really useful stuff.
[jQuery] Re: Atribute selector with squared brackets
Brackets are an invalid character in attributes, for XHTML served as text/html, which I guess accounts for most of jQuery usage anyway. Looks like someone already updated the docs. - ricardo On Oct 20, 11:36 pm, Ariel Flesler [EMAIL PROTECTED] wrote: We got a ticket about how to select elements by an attribute with brackets. I replied with the common link to the FAQ and the reporter replied that the example in the docs doesn't work. I tried that myself, and indeed, that didn't work. http://dev.jquery.com/ticket/3443 $('[name=foo[bar]]'); // Doesn't work $('[name=foo\\[bar\\]]'); // Should work, but doesn't $('[name=foo[bar]]'); // Does work Now... I think the last option is good enough. But we need to update the docs. Anything to add ? Anyone volunteers to update the docs ? Cheers -- Ariel Fleslerhttp://flesler.blogspot.com/
[jQuery] Re: call a php function with onclick
What I did for having php executed at onClick event is using Ajax. You must store your functions into an external php file. Then use the jquery ajax methods to load, execute and receive back the result of your php code without leaving the caller page. Process will be invisible to users (the page won't reload or anything like that). You can pass variables or input values to your php page as you would with a 'normal' form submission or link (POST/GET). There are a lot of tut concerning ajax and jquery. http://docs.jquery.com/Ajax for docs. Here's a sample code i just wrote. I have not parsed the friend inputs (to avoid XSS ...) but here's the way it works. [HTML PAGE] !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=iso-8859-1 / meta http-equiv=cache-control content=no-cache meta http-equiv=pragma content=no-cache meta http-equiv=expires content=mon, 22 jul 2002 11:12:01 gmt titleadd / delete friends/title script type=text/javascript src=scripts/jquery.js/script script type=text/javascript $(document).ready ( function() { //add action to each input with type=button, action to execute is based on the id of each one $([EMAIL PROTECTED]'button']).each ( function () { $( this ).bind ( click, function(){ $.ajax({ type: POST, url: test-ajax-simple.php, data: action=+$(this).attr(id)+friend=+$ (#friend).val(), success: function(reponse){ alert(reponse); },//function success error: function (){ alert('something wrong with ajax!') } });//$.ajax }//function );//bind }//function );//each }); /script /head body form id=form1 name=form1 method=post action= onsubmit=return false p id=buttons input type=text name=friend id=friend value=jQueryFriends input type=button name=add_friend value=add_friend id=add_friend / input type=button name=delete_friend value=delete_friend id=delete_friend/ /p /form /body /html [PHP PAGE] ?php header(Cache-Control: no-cache); header(Pragma: nocache); switch($_REQUEST['action']) { case 'add_friend' : add_friend($_REQUEST['friend']); break; case 'delete_friend' : delete_friend($_REQUEST['friend']); break; default: echo unknow action!\n; } function add_friend($fname) { //sql here echo Friend .$fname. added!\n;//output will be send to jquery ajax object in response return true; } function delete_friend($fname) { //sql here echo Friend .$fname. deleted!\n; return true; } ?
[jQuery] Re: load dynamic content into myobj
http://docs.jquery.com/Ajax/load Just use the file name as an argument. You can pass data either as a string (name=Jecasur=Tatu) or as an object, and a callback function to be executed when it's done: $(#myobj).load(Page2.php,{id:1325,name:'something'}, function(data) { alert('I've just loaded: '+ data) }); - ricardo On Oct 20, 8:32 pm, Flavio333 [EMAIL PROTECTED] wrote: Hello, what I am trying to do is this... I have a link on a page when i click the link i want it to load Page2.php?+... into myobj. here is some of the code i was working with... hope someone can help... Thank you. script $(document).ready(function(){ $(#generate2).click(function(){ $(#myobj).fadeOut(fast); $(#myobj).slideToggle(slow); $(#myobj).load( what goes here ); $(this).toggleClass(active); }); }); /script * div id=myobj align=center ?php do { ? Page2.php?idctg_ctg=?php echo $row_categorys['idctg_ctg']; ? ?php echo $row_categorys['name_ctg']; ? br ?php } while ($row_categorys = mysql_fetch_assoc($categorys)); ? /div -- View this message in context:http://www.nabble.com/load-dynamic-content-into-myobj-tp20080199s2724... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Way to use a Multi-Line Example Prompt in a Single-line Text Input Field
Yeah, that might work. I'm experimenting with making it suitable for my use, where I would need 2 labels, I guess. But, that would let me wrap text and do whatever I want without putting any text in the actual field. Thanks for the find. -Wayne On Oct 20, 10:55 am, Dan Switzer [EMAIL PROTECTED] wrote: Wayne: I'm trying to prompt for input within the field using the Example plugin (http://plugins.jquery.com/project/example). The idea is that I'm styling my input field to be unsually large when the user types (it will be no more than a 4 or 5 digits), so I can use closer to normal size text as the prompt. I know I can do this with a textarea, but it's semantically incorrect, and using the return key creates a new line. I don't want to shoehorn the simple input into a textarea, but I want the prompt to be meaningful, like Enter a measurement for this baseline, instead of type here or whatever short message I could use. I also like the amount of space that it takes up visually with two lines. What is a better way of doing this? Should I just use a jEditable element and style it to look like a form input? Why not just use an input / element? Use CSS to give it a transparent background and other styles you want and then place a div / with a lower z-index underneath with the label. I think maybe this plug-in does that: http://plugins.jquery.com/project/overlabel (But it might just be replacing the text in the field--the site is down at the moment.) If you do something like the following, then you can position the label underneath: div style=position: relative; input type=text style=font-size: 32px; background-color: transparent; z-index: 2; / div id=underlabel style=position: absolute; z-index; 1;Your label here.../div /div You'll need to set the underlabel div / to the dimensions of the input / element, but then you should be able to use CSS to control everything else about the layer. You can then just show/hide the underlabel based upon whether or not the field has focus. -Dan
[jQuery] Re: BlockUI Plugin - FadeIn?
Around line 199 in the js file is where the block layers show... play around with those options and you should be able to get the effect you are after although i will note that your idea doesn't make much sense, as you'll be giving your end user that much time to be able to click something else.. rendering the functionality of the block useless On Oct 21, 10:52 am, Kilik [EMAIL PROTECTED] wrote: Is there a way to get the 'Modal Dialog' feature of this plugin to fade in? It already fade outs by default when the dialog is canceled. -Thx
[jQuery] Re: validate plugin and CodeIgniter
h Jorn thank for the quick reply..it was my mistake :(.. but, if i'm not annoying, i got another issue which i solved with a twik but was wonder if there's a better solution.. i got 5 couples of radio button: input name=name1 type=radio value=si class=className / input name=name1 type=radio value=no class=className / input name=name2 type=radio value=si class=className / input name=name2 type=radio value=no class=className / input name=name3 type=radio value=si class=className / input name=name3 type=radio value=no class=className / input name=name4 type=radio value=si class=className / input name=name4 type=radio value=no class=className / input name=name5 type=radio value=si class=className / input name=name5 type=radio value=no class=className / The validation rule against them must be: - at least one radiobutton with value 'si' must be checked. I added a classRule but apparently this doesn't work for radiobuttons. $.validator.addClassRules({ className: { required: function(element){ var id ; var chk; var val; $ (element).each(function(){ id = $ (this).attr('id'); chk = $ (this).attr('checked'); val = $ (this).val(); alert (id + ' ' + chk + ' ' + val) if ((val == 'si') (chk == true)){ return true; } }); } } I put the alert to show that the plugin in its cycle takes into consderation only the radiobutton with value 'si' (twice) and no the seconds one with value no! Is this possible or is just a mistake of mine? Thanks Vitto
[jQuery] Jquery load not getting updated pages.....
Hello, I spent about an hour trying to figure out why a form I was loading to a web page was not updating. In my web page I have a navigation button tool, when I click I want to load a form into the #display div. $(document).ready(function(){ .. a bunch of code. $('#menu li.tool').click(function() { $('#display #product').remove(); $('#menu li[device=device]').removeAttr('clicked'); $('#display').load('../forms/test_form_1.html'); }); .. remaining code }; I call up the page and click the tool button and the form displays no problem. However, later I made changes to the form (test_form_1.html) and they were not included, even after refreshing the page. I even removed the html file and it still loads! Apparently this file is saved in the cache, how do I make sure everytime I click on the tool button I get the latest page? Steve
[jQuery] Re: call a php function with onclick
Here's a something based on links class name, the php code is in your hand ;) [HTML PAGE] [JQUERY CODE] //add an action to each A with class=friends, //the action is based on the id of each A and passed as variable (see DATA: ) $(a.friends).each ( function () { $( this ).bind ( click, function(){ $.ajax({ type: POST, url: test-ajax-simple.php, data: action=+$(this).attr(id)+friend=+$ (#friend).val(), success: function(reponse){ alert(reponse); },//function success error: function (){ alert('something wrong with ajax!') } });//$.ajax }//function );//bind }//function );//each [ADD THIS BETWEEN BODY/BODY OF THE HTML PAGE] p a href=#add class=friends id=add_friendAdd friend/a - a href=#del class=friends id=delete_friendDel friend/a /p
[jQuery] Re: BlockUI Plugin - FadeIn?
Shouldn't the effect still block immediately though the opacity is being modified as an animation? On Tue, Oct 21, 2008 at 12:22 PM, MorningZ [EMAIL PROTECTED] wrote: Around line 199 in the js file is where the block layers show... play around with those options and you should be able to get the effect you are after although i will note that your idea doesn't make much sense, as you'll be giving your end user that much time to be able to click something else.. rendering the functionality of the block useless On Oct 21, 10:52 am, Kilik [EMAIL PROTECTED] wrote: Is there a way to get the 'Modal Dialog' feature of this plugin to fade in? It already fade outs by default when the dialog is canceled. -Thx -- Christopher Thatcher
[jQuery] Re: jQuery efficiency with a large DOM.
I obviously don't know your scale, specifically, but the site I've put together I don't consider to be all that deep, however, I see some apparent slowness with the AJAX actions having to wait for responses from my server scripts as well as short animations that seem to stack on each other waiting for things to happen in the order they're executed. If you'd like a better view into the timing of things, make sure you watch the page's performance in the Firebug extension (http:// getfirebug.com/) with the YSlow add-on (http://developer.yahoo.com/ yslow/), as well. Chrome has a similarly handy time charting mechanism, but I don't have it handy on my machine to see what it's called. You might also want to debug with BlackBird (http:// www.gscottolson.com/blackbirdjs/) as it makes it mindlessly easy to do time-profiling on the various components, to help you zero in on the slowness, some more. -Wayne On Oct 21, 11:49 am, ricardobeat [EMAIL PROTECTED] wrote: How many event handlers do you have registered? IE starts to slow down at some point. It seems that the obvious performance improvements have been taken care of (id selectors, tag names for class selectors), anything else would be implementation specific. Are you using livequery? On Oct 21, 7:48 am, mrmoosehead [EMAIL PROTECTED] wrote: Hi, I have a web app that is hosted within a .hta wrapper (for some security uses including hosting an ActiveX control) therefore uses ie as its engine. The app rarely, if ever leaves the containing page and all interaction with the server is done using ajax and loading information into various container 'controls' - hidden at times but left in the DOM for easy re-use, rather than reloading every time they want to view. I am finding that the speed of the interface is suffering badly as more stuff is loaded into the DOM. Most selectors are ID based ones where possible, therefore should be as efficient as possible. I cache jQuery objects where possible to avoid re-searching What I am finding is that it can take almost 2 seconds for an event to even be actioned by the browser - e.g a simple onclick on an element in a dynamically loaded chunk of HTML markup can take this time to even start actioning a $.get request. Anyone any thoughts as to why? Apart from it's IE - I get similar delays on FF and Chrome, but nowhere near the same magnitude. I am trying to keep the DOM as clean as possible, but it's hard with such a rich app. Any tips and tricks for efficiency in large DOM pages with jQuery? TIA.
[jQuery] Re: can someone please help with dynamic links problem?
the problem is quite simple i think, all your links have the same id (generate2) And the jquery function is attached to a link with this id (generate2) So only 1 link will be responding to the function. You need to use each() to attach an event to each links. Like $(#generate2).each ( function () { $( this ).bind ( click, function(){ //dosomething your stuff here }//function );//bind }//function );//each This should normally work. But note that only one unique ID per page is acceptable (see W3C recommandations). Better to use class name filtering instead (there could be more than 1 time the same class on the page but only 1 unique id). It will only change the first line: $(.generate2).each ( ... And the HTML will looks like a href=# id=uniqueID class=generate2.../a On Oct 21, 3:56 pm, Flavio333 [EMAIL PROTECTED] wrote: Hello, I an quite new to jquery and hope someone can help with my problem. I am trying to load dynamic content in to a div(myobj)... the code i have so far is more or less as follows. it creates a box with 2 links, that it gets from 'name_ctg'. the links, are category names and when clicked should load products.php, with the right product, as was determined by the link that was clicked. I hope that make sense... now the problem is that only the first link works, the second link does nothing. I hope someone can help. script src=jquery.js/script script $(document).ready(function(){ $(#generate2).click(function(){ $(#myobj).fadeOut(fast); $(#myobj).slideToggle(slow); $(#myobj).load(products.php?idctg_ctg=?php echo $row_categorys['idctg_ctg']; ?); }); }); /script style type=text/css !-- #myobj { background-color: #CC; height: 300px; width: 500px;} -- /style /head body div id=myobj align=center ?php do { ? a href=# id=generate2 ?php echo $row_categorys['name_ctg']; ? br ?php } while ($row_categorys = mysql_fetch_assoc($categorys)); ? /div /body /html ?php mysql_free_result($categorys); ? -- View this message in context:http://www.nabble.com/can-someone-please-help-with-dynamic-links-prob... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: validate plugin and CodeIgniter
Can you provide a simple testpage where I can see that code running? Jörn On Tue, Oct 21, 2008 at 6:13 PM, hcvitto [EMAIL PROTECTED] wrote: h Jorn thank for the quick reply..it was my mistake :(.. but, if i'm not annoying, i got another issue which i solved with a twik but was wonder if there's a better solution.. i got 5 couples of radio button: input name=name1 type=radio value=si class=className / input name=name1 type=radio value=no class=className / input name=name2 type=radio value=si class=className / input name=name2 type=radio value=no class=className / input name=name3 type=radio value=si class=className / input name=name3 type=radio value=no class=className / input name=name4 type=radio value=si class=className / input name=name4 type=radio value=no class=className / input name=name5 type=radio value=si class=className / input name=name5 type=radio value=no class=className / The validation rule against them must be: - at least one radiobutton with value 'si' must be checked. I added a classRule but apparently this doesn't work for radiobuttons. $.validator.addClassRules({ className: { required: function(element){ var id ; var chk; var val; $ (element).each(function(){ id = $ (this).attr('id'); chk = $ (this).attr('checked'); val = $ (this).val(); alert (id + ' ' + chk + ' ' + val) if ((val == 'si') (chk == true)){ return true; } }); } } I put the alert to show that the plugin in its cycle takes into consderation only the radiobutton with value 'si' (twice) and no the seconds one with value no! Is this possible or is just a mistake of mine? Thanks Vitto
[jQuery] Re: BUG: oversized overlay in IE web browsers ( demo included )
(bump) Any takers? On Oct 20, 7:47 pm, tallvanilla [EMAIL PROTECTED] wrote: Thanks for the reply, Josh... but that isn't the problem. To demonstrate, I updated my demo according to your suggestion: http://74.205.76.81/blockuitest/ Even if that WAS the solution, it would force people to zero out their body padding and margins. Not a problem for most, but inconvenient for many. If you consider IE important, it's a blockUI bug. Any other takers? Here's how Boxy's author fixed it (in his own words): I've added a separate sizing method specifically for IE6 which uses the viewport dimensions instead of the document, and repositions on scroll as well as on resize. I tried using this approach for all browsers but Firefox was having none of it. JR On Oct 20, 4:09 pm, Josh Nathanson [EMAIL PROTECTED] wrote: This happens where there is some padding or margin on the body. If you set them to 0 via css it should take care of the problem. /* css */ body { padding: 0; margin: 0; } -- Josh - Original Message - From: tallvanilla [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Monday, October 20, 2008 2:27 PM Subject: [jQuery] BUG: oversized overlay in IE web browsers ( demo included ) Hello. I found a minor bug that affects overlay in IE web browsers (at least in IE6). Please take a look at this very simple demo: http://74.205.76.81/blockuitest/ In IE(6), the overlay is a bit taller than the browser window, so a scrollbar appears on the right whenever the overlay is present. In other web browsers, this doesn't happen. I found a similar bug with the Boxy plug-in a couple of weeks ago, and its author was able to fix it pretty easily. I'm a jQuery/javascript novice, so I'm not sure how the fix was implemented. Would this be worthwhile and easy fix for blockUI as well? JR
[jQuery] Re: Trouble using rules( add, rules ) as well as setting attribute for range validations
I would love to have this feature. It would save me a bunch of extra lines of code. Any idea if and when this might be implemented into the plugin? On Oct 21, 5:55 am, lightglitch [EMAIL PROTECTED] wrote: Done. http://dev.jquery.com/ticket/3503 On Oct 21, 9:53 am, Jörn Zaefferer [EMAIL PROTECTED] wrote: Could you file a ticket for this?http://dev.jquery.com/newticket (requires registration) Thanks! Jörn On Mon, Oct 20, 2008 at 8:49 PM, lightglitch [EMAIL PROTECTED] wrote: I have made a patch for my app to therulesfunction to supportcustom messages: This is the new function, would be nice to have something similar to this. rules: function(command, argument) { var element = this[0]; if (command) { var staticRules = $.data(element.form, 'validator').settings.rules; var existingRules = $.validator.staticRules(element); switch(command) { case add: $.extend(existingRules, $.validator.normalizeRule(argument)); staticRules[element.name] = existingRules; / PATCH ***/ if (argument.messages) { if ($.data(element.form, 'validator').settings.messages[element.name]) $.extend($.data(element.form, 'validator').settings.messages[element.name],argument.messages); else $.data(element.form, 'validator').settings.messages[element.name] = argument.messages; } / END PATCH ***/ break; case remove: if (!argument) { delete staticRules[element.name]; return existingRules; } var filtered = {}; $.each(argument.split(/\s/), function(index, method) { filtered[method] = existingRules[method]; delete existingRules[method]; }); return filtered; } } var data = $.validator.normalizeRules( $.extend( {}, $.validator.metadataRules(element), $.validator.classRules(element), $.validator.attributeRules(element), $.validator.staticRules(element) ), element); // make sure required is at front if (data.required) { var param = data.required; delete data.required; data = $.extend({required: param}, data); } return data; }, And I use it like this: $(#field).rules(add, {required:true,range:[5,45],messages: {required:The field can\'t be blank.,range:The field must have 5 to 45 characters.}}); Hope it helps. On Oct 9, 11:00 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote: You can use metadata, too. Currently barely documented, and not really recommended either, but works since 1.4. input class={required:true,messages:{required:'required field'}} name=whatever / Jörn On Thu, Oct 9, 2008 at 5:20 PM, Bob Silverberg [EMAIL PROTECTED] wrote: Thanks for the quick response. That fixed my problem. One more question: I'd like to addcustomerror messages to some of my dynamic validations. Is it correct that the only way to add acustomerror messageto a particular rule is either by: 1. using the form.validate() method 2. using $.validator.addMethod to clone an existing method Thanks, Bob On Thu, Oct 9, 2008 at 4:22 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: Forrules(add) to work, the element's form has to be validated, that is, call $(form).validate() first. I've updated the documentation accordingly. Not sure why the attr-approach failed, I'll take a look at that. Jörn On Thu, Oct 9, 2008 at 2:37 AM, BobS [EMAIL PROTECTED] wrote: I'm working on a server-side component that will generate all of my jQuery validationrulesfrom xml metadata, so I'm trying to dynamically addrulesone at a time. My first attempt was to use therules( add,rules) syntax, but I'm getting an error on page load: jQuery.data(element.form, validator) is undefined
[jQuery] Re: BUG: oversized overlay in IE web browsers ( demo included )
Is this why ThickBox sets all paddings and margins to 0? I agree, it's annoying. I switched to John's Greybox Redux (http://jquery.com/blog/2006/02/10/ greybox-redux/) for my modal, and I don't see problems on IE6. It also was more semantically correct than Thickbox's iFrame implementation of putting the sizes in the href. -Wayne On Oct 21, 1:04 pm, tallvanilla [EMAIL PROTECTED] wrote: (bump) Any takers? On Oct 20, 7:47 pm, tallvanilla [EMAIL PROTECTED] wrote: Thanks for the reply, Josh... but that isn't the problem. To demonstrate, I updated my demo according to your suggestion: http://74.205.76.81/blockuitest/ Even if that WAS the solution, it would force people to zero out their body padding and margins. Not a problem for most, but inconvenient for many. If you consider IE important, it's a blockUI bug. Any other takers? Here's how Boxy's author fixed it (in his own words): I've added a separate sizing method specifically for IE6 which uses the viewport dimensions instead of the document, and repositions on scroll as well as on resize. I tried using this approach for all browsers but Firefox was having none of it. JR On Oct 20, 4:09 pm, Josh Nathanson [EMAIL PROTECTED] wrote: This happens where there is some padding or margin on the body. If you set them to 0 via css it should take care of the problem. /* css */ body { padding: 0; margin: 0; } -- Josh - Original Message - From: tallvanilla [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Monday, October 20, 2008 2:27 PM Subject: [jQuery] BUG: oversized overlay in IE web browsers ( demo included ) Hello. I found a minor bug that affects overlay in IE web browsers (at least in IE6). Please take a look at this very simple demo: http://74.205.76.81/blockuitest/ In IE(6), the overlay is a bit taller than the browser window, so a scrollbar appears on the right whenever the overlay is present. In other web browsers, this doesn't happen. I found a similar bug with the Boxy plug-in a couple of weeks ago, and its author was able to fix it pretty easily. I'm a jQuery/javascript novice, so I'm not sure how the fix was implemented. Would this be worthwhile and easy fix for blockUI as well? JR
[jQuery] Re: what is difference between $(document).height() and $(window).height() ?
Good question. No difference. Both should give you the exact same result every time. JR On Oct 21, 1:38 am, jey jey [EMAIL PROTECTED] wrote: what is difference between $(document).height() and $ (window).height() ?
[jQuery] Re: BUG: oversized overlay in IE web browsers ( demo included )
You might want to give jqModal a shot. BlockUI is better for blocking specific parts of a document, during an ajax call or the like. jqModal is more of a modal window solution that might be better suited to what you're trying to do. There's also SimpleModal which I personally haven't used. -- Josh - Original Message - From: tallvanilla [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Tuesday, October 21, 2008 10:04 AM Subject: [jQuery] Re: BUG: oversized overlay in IE web browsers ( demo included ) (bump) Any takers? On Oct 20, 7:47 pm, tallvanilla [EMAIL PROTECTED] wrote: Thanks for the reply, Josh... but that isn't the problem. To demonstrate, I updated my demo according to your suggestion: http://74.205.76.81/blockuitest/ Even if that WAS the solution, it would force people to zero out their body padding and margins. Not a problem for most, but inconvenient for many. If you consider IE important, it's a blockUI bug. Any other takers? Here's how Boxy's author fixed it (in his own words): I've added a separate sizing method specifically for IE6 which uses the viewport dimensions instead of the document, and repositions on scroll as well as on resize. I tried using this approach for all browsers but Firefox was having none of it. JR On Oct 20, 4:09 pm, Josh Nathanson [EMAIL PROTECTED] wrote: This happens where there is some padding or margin on the body. If you set them to 0 via css it should take care of the problem. /* css */ body { padding: 0; margin: 0; } -- Josh - Original Message - From: tallvanilla [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Monday, October 20, 2008 2:27 PM Subject: [jQuery] BUG: oversized overlay in IE web browsers ( demo included ) Hello. I found a minor bug that affects overlay in IE web browsers (at least in IE6). Please take a look at this very simple demo: http://74.205.76.81/blockuitest/ In IE(6), the overlay is a bit taller than the browser window, so a scrollbar appears on the right whenever the overlay is present. In other web browsers, this doesn't happen. I found a similar bug with the Boxy plug-in a couple of weeks ago, and its author was able to fix it pretty easily. I'm a jQuery/javascript novice, so I'm not sure how the fix was implemented. Would this be worthwhile and easy fix for blockUI as well? JR
[jQuery] Re: Combining jQuery and jQuery UI
Are you making sure that the jquery core file is at the top of that concatenated file? that's the only other thing I can think of that would produce the error. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Oct 20, 2008, at 4:26 PM, c.barr wrote: They already have the semicolons straight from jQuery, so no changes were needed. Any other suggestions? On Oct 16, 5:16 pm, Mike Alsup [EMAIL PROTECTED] wrote: I'd like to combine and compress my jQuery and jQuery UI files into a single minified file, but I've noticed that every time I do this It just breaks and gives me $ is not defined. If I do a copy/paste of the two uncompressed files together, it works fine but it's a 100kb file! When I got to minify or pack this file, that's when it always breaks. I've tried Dean Edwards packer, JSmin, and YUI all with the same results. The same goes for any jQuery plugins I've downloaded. I'm using a several that I need avalible on all pages, and I'd like to combine them - these also break when I do this. Am I missing something here? Make sure each file has a leading and a trailing semicolon.
[jQuery] Re: BUG: oversized overlay in IE web browsers ( demo included )
Thanks for all the suggestions guys, but I've kind of narrowed my preference down to blockUI for the job at hand. Believe me, I've tried them all, and they all have their share of quirks. Does anyone have a suggestion for fixing the blockUI bug? If not, do know how I can contact it's author directly? Thanks again for your help so far! JR On Oct 21, 10:12 am, Josh Nathanson [EMAIL PROTECTED] wrote: You might want to give jqModal a shot. BlockUI is better for blocking specific parts of a document, during an ajax call or the like. jqModal is more of a modal window solution that might be better suited to what you're trying to do. There's also SimpleModal which I personally haven't used. -- Josh - Original Message - From: tallvanilla [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Tuesday, October 21, 2008 10:04 AM Subject: [jQuery] Re: BUG: oversized overlay in IE web browsers ( demo included ) (bump) Any takers? On Oct 20, 7:47 pm, tallvanilla [EMAIL PROTECTED] wrote: Thanks for the reply, Josh... but that isn't the problem. To demonstrate, I updated my demo according to your suggestion: http://74.205.76.81/blockuitest/ Even if that WAS the solution, it would force people to zero out their body padding and margins. Not a problem for most, but inconvenient for many. If you consider IE important, it's a blockUI bug. Any other takers? Here's how Boxy's author fixed it (in his own words): I've added a separate sizing method specifically for IE6 which uses the viewport dimensions instead of the document, and repositions on scroll as well as on resize. I tried using this approach for all browsers but Firefox was having none of it. JR On Oct 20, 4:09 pm, Josh Nathanson [EMAIL PROTECTED] wrote: This happens where there is some padding or margin on the body. If you set them to 0 via css it should take care of the problem. /* css */ body { padding: 0; margin: 0; } -- Josh - Original Message - From: tallvanilla [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Monday, October 20, 2008 2:27 PM Subject: [jQuery] BUG: oversized overlay in IE web browsers ( demo included ) Hello. I found a minor bug that affects overlay in IE web browsers (at least in IE6). Please take a look at this very simple demo: http://74.205.76.81/blockuitest/ In IE(6), the overlay is a bit taller than the browser window, so a scrollbar appears on the right whenever the overlay is present. In other web browsers, this doesn't happen. I found a similar bug with the Boxy plug-in a couple of weeks ago, and its author was able to fix it pretty easily. I'm a jQuery/javascript novice, so I'm not sure how the fix was implemented. Would this be worthwhile and easy fix for blockUI as well? JR
[jQuery] Re: Jquery load not getting updated pages.....
Stever wrote on 10/21/2008 11:34 AM: Apparently this file is saved in the cache, how do I make sure everytime I click on the tool button I get the latest page? Via the headers, have the page expire in the past and set the cache-control headers to no-cache: Expires: Thu, 11 Jun 1998 13:17:30 GMT Cache-Control: no-store, no-cache, must-revalidate, no-transform, max-age=0, post-check=0, pre-check=0 Pragma: no-cache Some people instead choose to make the URL dynamic by appending a random query string using the current milliseconds (or something similar). I don't use that method, so maybe someone who does it that way can respond. - Bil
[jQuery] Re: Trouble using rules( add, rules ) as well as setting attribute for range validations
Done! You can find the latest revision here: http://jqueryjs.googlecode.com/svn/trunk/plugins/validate/ Jörn On Tue, Oct 21, 2008 at 7:08 PM, BobS [EMAIL PROTECTED] wrote: I would love to have this feature. It would save me a bunch of extra lines of code. Any idea if and when this might be implemented into the plugin? On Oct 21, 5:55 am, lightglitch [EMAIL PROTECTED] wrote: Done. http://dev.jquery.com/ticket/3503 On Oct 21, 9:53 am, Jörn Zaefferer [EMAIL PROTECTED] wrote: Could you file a ticket for this?http://dev.jquery.com/newticket (requires registration) Thanks! Jörn On Mon, Oct 20, 2008 at 8:49 PM, lightglitch [EMAIL PROTECTED] wrote: I have made a patch for my app to therulesfunction to supportcustom messages: This is the new function, would be nice to have something similar to this. rules: function(command, argument) { var element = this[0]; if (command) { var staticRules = $.data(element.form, 'validator').settings.rules; var existingRules = $.validator.staticRules(element); switch(command) { case add: $.extend(existingRules, $.validator.normalizeRule(argument)); staticRules[element.name] = existingRules; / PATCH ***/ if (argument.messages) { if ($.data(element.form, 'validator').settings.messages[element.name]) $.extend($.data(element.form, 'validator').settings.messages[element.name],argument.messages); else $.data(element.form, 'validator').settings.messages[element.name] = argument.messages; } / END PATCH ***/ break; case remove: if (!argument) { delete staticRules[element.name]; return existingRules; } var filtered = {}; $.each(argument.split(/\s/), function(index, method) { filtered[method] = existingRules[method]; delete existingRules[method]; }); return filtered; } } var data = $.validator.normalizeRules( $.extend( {}, $.validator.metadataRules(element), $.validator.classRules(element), $.validator.attributeRules(element), $.validator.staticRules(element) ), element); // make sure required is at front if (data.required) { var param = data.required; delete data.required; data = $.extend({required: param}, data); } return data; }, And I use it like this: $(#field).rules(add, {required:true,range:[5,45],messages: {required:The field can\'t be blank.,range:The field must have 5 to 45 characters.}}); Hope it helps. On Oct 9, 11:00 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote: You can use metadata, too. Currently barely documented, and not really recommended either, but works since 1.4. input class={required:true,messages:{required:'required field'}} name=whatever / Jörn On Thu, Oct 9, 2008 at 5:20 PM, Bob Silverberg [EMAIL PROTECTED] wrote: Thanks for the quick response. That fixed my problem. One more question: I'd like to addcustomerror messages to some of my dynamic validations. Is it correct that the only way to add acustomerror messageto a particular rule is either by: 1. using the form.validate() method 2. using $.validator.addMethod to clone an existing method Thanks, Bob On Thu, Oct 9, 2008 at 4:22 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: Forrules(add) to work, the element's form has to be validated, that is, call $(form).validate() first. I've updated the documentation accordingly. Not sure why the attr-approach failed, I'll take a look at that. Jörn On Thu, Oct 9, 2008 at 2:37 AM, BobS [EMAIL PROTECTED] wrote: I'm working on a server-side component that will generate all of my jQuery validationrulesfrom xml metadata, so I'm trying to dynamically
[jQuery] Re: what is difference between $(document).height() and $(window).height() ?
Actually, it seems that the document's height is the entire page's height, while the window height is only the viewing height(ie: what you see at that given time). On Oct 21, 1:00 pm, tallvanilla [EMAIL PROTECTED] wrote: Good question. No difference. Both should give you the exact same result every time. JR On Oct 21, 1:38 am, jey jey [EMAIL PROTECTED] wrote: what is difference between $(document).height() and $ (window).height() ?
[jQuery] Re: jQuery Documentation in PDF
Hey Jonatan, This is EXTREMELY useful and I'm sure more think the same way, this solves the problems most are having with the documentation page. Thanks a bunch :-)! On Tue, Oct 21, 2008 at 1:45 PM, Jonatan [EMAIL PROTECTED] wrote: Hi: I made a program for create a PDF of the jQuery and jQueryUI from the xml. There's also the source code of the program (made in VS2005/C#). I hope someone find the docs in PDF usefull as me :) You can download from: Docs in pdf: http://www.puntoequis.com.ar/aktive/soft/jQueryDocumentation.7z Program to create: http://www.puntoequis.com.ar/aktive/soft/jQueryDocs-Creator.7z I will post updates in my page (in spanish) http://www.puntoequis.com.ar/npx/default.aspx?VIEWENTRY050057 Jonatan -- Isaak Malik Web Developer
[jQuery] Re: Atribute selector with squared brackets
In XHTML, the name attribute on input (and textarea and select) elements is defined as CDATA not NMTOKEN thus, brackets are legal in name attributes on input elements. It is NOT backwards compatible with HTML, where the character restriction is [a-z][A-Z]-_ and . Further note, the id attribute has it's own separate set of restrictions that are a subset of all HTML attributes. http://www.w3.org/TR/xhtml1/dtds.html#dtdentry_xhtml1-transitional.dtd_input http://www.w3.org/TR/xhtml1/dtds.html#dtdentry_xhtml1-transitional.dtd_select http://www.w3.org/TR/xhtml1/dtds.html#dtdentry_xhtml1-transitional.dtd_textarea ~Jason On Oct 21, 12:07 pm, ricardobeat [EMAIL PROTECTED] wrote: Brackets are an invalid character in attributes, for XHTML served as text/html, which I guess accounts for most of jQuery usage anyway. Looks like someone already updated the docs. - ricardo On Oct 20, 11:36 pm, Ariel Flesler [EMAIL PROTECTED] wrote: We got a ticket about how to select elements by an attribute with brackets. I replied with the common link to the FAQ and the reporter replied that the example in the docs doesn't work. I tried that myself, and indeed, that didn't work. http://dev.jquery.com/ticket/3443 $('[name=foo[bar]]'); // Doesn't work $('[name=foo\\[bar\\]]'); // Should work, but doesn't $('[name=foo[bar]]'); // Does work Now... I think the last option is good enough. But we need to update the docs. Anything to add ? Anyone volunteers to update the docs ? Cheers -- Ariel Fleslerhttp://flesler.blogspot.com/
[jQuery] Check if an element DOESN'T have a class
Hey all, I understand how hasClass() works, but I'm trying to figure out how to use it to see if an element DOESN'T have a class. I want to check if the class doesn't exist, and if not then I'll add it. Do I use the older is() method? Just looking for the best way. Thanks!
[jQuery] Re: Trouble using rules( add, rules ) as well as setting attribute for range validations
Further testing is welcome, I plan to release 1.5 on Friday. Jörn On Tue, Oct 21, 2008 at 8:16 PM, Jörn Zaefferer [EMAIL PROTECTED] wrote: Done! You can find the latest revision here: http://jqueryjs.googlecode.com/svn/trunk/plugins/validate/ Jörn On Tue, Oct 21, 2008 at 7:08 PM, BobS [EMAIL PROTECTED] wrote: I would love to have this feature. It would save me a bunch of extra lines of code. Any idea if and when this might be implemented into the plugin? On Oct 21, 5:55 am, lightglitch [EMAIL PROTECTED] wrote: Done. http://dev.jquery.com/ticket/3503 On Oct 21, 9:53 am, Jörn Zaefferer [EMAIL PROTECTED] wrote: Could you file a ticket for this?http://dev.jquery.com/newticket (requires registration) Thanks! Jörn On Mon, Oct 20, 2008 at 8:49 PM, lightglitch [EMAIL PROTECTED] wrote: I have made a patch for my app to therulesfunction to supportcustom messages: This is the new function, would be nice to have something similar to this. rules: function(command, argument) { var element = this[0]; if (command) { var staticRules = $.data(element.form, 'validator').settings.rules; var existingRules = $.validator.staticRules(element); switch(command) { case add: $.extend(existingRules, $.validator.normalizeRule(argument)); staticRules[element.name] = existingRules; / PATCH ***/ if (argument.messages) { if ($.data(element.form, 'validator').settings.messages[element.name]) $.extend($.data(element.form, 'validator').settings.messages[element.name],argument.messages); else $.data(element.form, 'validator').settings.messages[element.name] = argument.messages; } / END PATCH ***/ break; case remove: if (!argument) { delete staticRules[element.name]; return existingRules; } var filtered = {}; $.each(argument.split(/\s/), function(index, method) { filtered[method] = existingRules[method]; delete existingRules[method]; }); return filtered; } } var data = $.validator.normalizeRules( $.extend( {}, $.validator.metadataRules(element), $.validator.classRules(element), $.validator.attributeRules(element), $.validator.staticRules(element) ), element); // make sure required is at front if (data.required) { var param = data.required; delete data.required; data = $.extend({required: param}, data); } return data; }, And I use it like this: $(#field).rules(add, {required:true,range:[5,45],messages: {required:The field can\'t be blank.,range:The field must have 5 to 45 characters.}}); Hope it helps. On Oct 9, 11:00 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote: You can use metadata, too. Currently barely documented, and not really recommended either, but works since 1.4. input class={required:true,messages:{required:'required field'}} name=whatever / Jörn On Thu, Oct 9, 2008 at 5:20 PM, Bob Silverberg [EMAIL PROTECTED] wrote: Thanks for the quick response. That fixed my problem. One more question: I'd like to addcustomerror messages to some of my dynamic validations. Is it correct that the only way to add acustomerror messageto a particular rule is either by: 1. using the form.validate() method 2. using $.validator.addMethod to clone an existing method Thanks, Bob On Thu, Oct 9, 2008 at 4:22 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: Forrules(add) to work, the element's form has to be validated, that is, call $(form).validate() first. I've updated the documentation accordingly. Not sure why the attr-approach failed, I'll take a look at that. Jörn On Thu, Oct 9, 2008 at 2:37 AM, BobS [EMAIL PROTECTED] wrote:
[jQuery] Dragging Google Widget results in page refresh...
In the application I am writing, I have a div box that needs to be draggable. Inside the box is an iframe containing a google widget. For some reason, as soon as I try the drag, the entire page refreshes and only the google widget shows. Has anyone else experienced this and if so, were you able to create a work around? Thanks -j
[jQuery] help with rotating css file using a setinterval, problem with ie
I'm a complete javascript newbie and I know it's not exactly wise to jump into jquery as such, but I did so anyway because I needed something done fairly quickly and in a simple manner. So, forgive me if this is not the most efficient way to get this done. Anyway, the idea behind the script is to swap out the existing linked css file with another random one after a set amount of time. As such, I have the following in the head section: Code: link href=styles/style1.css type=text/css rel=stylesheet id=stylesheet / script type=text/javascript src=scripts/jquery.js/script script type=text/javascript var interval $(document).ready(function() { interval = setInterval(getCSS(), 5000);// 5 secs between requests }); function getCSS() { // randomize the stylesheet to be loaded var r = Math.floor(Math.random()*3+1); // set stylesheet to new stylesheet + randomized number $(#stylesheet).attr({href : styles/style+r+.css}); } /script Everything works nicely in all browsers I've tested (FF, Safari, and Opera) except (of course) IE. Mainly, it swaps out the css (in this case, I'm just changing the background and some text colors for testing purposes). The problem is that only the area that has content receives an update in the background color. Anywhere else, the background remains the same as before. I'm not sure what the problem is, maybe IE renders too slowly, but if you minimize the browser, then maximize again, the background colors display correctly. The problem only shows up if the screen is in view when the css swap happens. Anyone know a way to fix this problem? Any help is much appreciated.
[jQuery] Polygon
Maybe it's a stupid question but I was wondering if there is a way to generate a polygon with 4 points, so that the user can himself drag each point to create it's own (mainly for selecting a portion of an image). Is it possible with a specific jQuery plugin. I can't seem to find anything after a few hours of my time. Thank you!! Sébastien Lachance
[jQuery] Re: jQuery Uploader Flash player 10 fix
Update: Most of the callbacks have been implemented; Actionscript (Flash) work seems to be done; yet i did all my work without debugging. Tomorrow i have to add maybe 3 or 4 events / log messages and then i can start building ;) -- Gilles On Oct 20, 7:52 pm, Gilles (Webunity) [EMAIL PROTECTED] wrote: Guys; A lot (8) people have allready asked me if i was going to fix the mess Adobe made and my answer is yes, i am working on it. This post is to assure you that the jQuery Flash based uploader i wrote in 2006 has been revived. The project will no longer be based on swfupload, since i added way to much code of my own into it. The new version is (looseley) based upon YUI uploader component, and off course i've taken a peek to see what FancyUpload does in their code. To be honest; they are both very good products and both have their pro's and con's. I am hoping to create a project which will be the best of both worlds and more (currently, approx. 80% code is my own work) I've allready put about 10 hours of work in the new jQuery upload plugin (which was originally hosted onhttp://uploader.webunity.nl/) but unfortunately it is not finished yet. Since i based the startcode (e.g. how to create an AS3 movieclip) on YUI, I must abide by their license, which is BSD. The uploader plugin (Javascript) is going to be included as full source, but the Actionscript file is going to be precompiled. This is due to the fact that i simply put to much work in it. Some stuff that i added; - A lot more and consistant event handlers - A lot more and better logging - Multiple simultanous (!!) uploads And, ported from my old version: - Queue managemen - Max file size - Max queue size - Max queue count The idea is to even make it possible to add files while you are allready uploading; sort of background file transfer so to say. Anyway; i'll hope to finish the Actionscript code tomorrow evening (it is now 20:00 here) and the demo's the day after that. Basically; by the end of the week you should have some working examples. Thank you for al your wonderfull feedback -- Gilleshttp://www.webunity.nl/
[jQuery] Re: can someone please help with dynamic links problem?
I tried what you said but it does not work... now both links go to the same page when clicked... RotinPain wrote: the problem is quite simple i think, all your links have the same id (generate2) And the jquery function is attached to a link with this id (generate2) So only 1 link will be responding to the function. You need to use each() to attach an event to each links. Like $(#generate2).each ( function () { $( this ).bind ( click, function(){ //dosomething your stuff here }//function );//bind }//function );//each This should normally work. But note that only one unique ID per page is acceptable (see W3C recommandations). Better to use class name filtering instead (there could be more than 1 time the same class on the page but only 1 unique id). It will only change the first line: $(.generate2).each ( ... And the HTML will looks like # ... On Oct 21, 3:56 pm, Flavio333 [EMAIL PROTECTED] wrote: Hello, I an quite new to jquery and hope someone can help with my problem. I am trying to load dynamic content in to a div(myobj)... the code i have so far is more or less as follows. it creates a box with 2 links, that it gets from 'name_ctg'. the links, are category names and when clicked should load products.php, with the right product, as was determined by the link that was clicked. I hope that make sense... now the problem is that only the first link works, the second link does nothing. I hope someone can help. script src=jquery.js/script script $(document).ready(function(){ $(#generate2).click(function(){ $(#myobj).fadeOut(fast); $(#myobj).slideToggle(slow); $(#myobj).load(products.php?idctg_ctg=?php echo $row_categorys['idctg_ctg']; ?); }); }); /script style type=text/css !-- #myobj { background-color: #CC; height: 300px; width: 500px;} -- /style /head body div id=myobj align=center ?php do { ? a href=# id=generate2 ?php echo $row_categorys['name_ctg']; ? br ?php } while ($row_categorys = mysql_fetch_assoc($categorys)); ? /div /body /html ?php mysql_free_result($categorys); ? -- View this message in context:http://www.nabble.com/can-someone-please-help-with-dynamic-links-prob... Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/can-someone-please-help-with-dynamic-links-problem--tp20090838s27240p20097081.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Check if an element DOESN'T have a class
Right from the docs http://docs.jquery.com/Attributes/hasClass#class --- Returns true if the specified class is present on at least one of the set of matched elements --- So say you have an element, let's say: div id=SomeDiv/div and you we wondering if it has SomeClass, then: $(#SomeDiv).hasClass(SomeClass) would be false with that said though, if you are just going to say: $(#SomeDiv).addClass(SomeClass); then there's no need to check if it has the class already or not, it's not going to be applied twice On Oct 21, 2:49 pm, kgosser [EMAIL PROTECTED] wrote: Hey all, I understand how hasClass() works, but I'm trying to figure out how to use it to see if an element DOESN'T have a class. I want to check if the class doesn't exist, and if not then I'll add it. Do I use the older is() method? Just looking for the best way. Thanks!
[jQuery] Re: Group validation - validate per page in one form.
Anyone? On Oct 20, 12:32 pm, ovalsquare [EMAIL PROTECTED] wrote: I am attempting to paginate a form, and validate for each page (page navigation via accordion or simply .show()/.hide()). However, the only sample I've seen of this appears to be the Help me Buy and Sell a House demo athttp://jquery.bassistance.de/validate/demo/multipart/. This sample requires that a pageRequired method be added as follows: $.validator.addMethod(pageRequired, function(value, element) { var $element = $(element) function match(index) { return current == index $(element).parents(#sf + (index + 1)).length; } if (match(0) || match(1) || match(2)) { return !this.optional(element); } return dependency-mismatch; }, $.validator.messages.required) var v = $(#cmaForm).validate({ errorClass: warning, onkeyup: false, onblur: false, submitHandler: function() { alert(Submitted, thanks!); } }); I would much prefer to take my existing setup with customvalidation messages for each field, as well as the ability to use per field specificvalidation(i.e. email, maxLength, custom addMethods, etc.), as in the following: //Validation var container = $(#myForm div.validationSuggestion); $('#myForm').validate({ errorContainer: container, errorLabelContainer: $(ul,container), rules: { someField: { required: true }, someOtherField: {required: true, maxLength:20 } //many other fields. }, messages: { someField: 'Error message for someField.', someOtherField: 'Another specific error message.' // many other fields. }, highlight: function(element, errorClass) { $(element).addClass(errorClass); $(element.form).find(label[for= + element.id + ]).addClass(errorClass); $(element.form).find(label[for= + element.id + ]).removeClass(valid); }, unhighlight: function(element, errorClass) { $(element).removeClass(errorClass); $(element.form).find(label[for= + element.id + ]).removeClass(errorClass); $(element.form).find(label[for= + element.id + ]).addClass(valid); }, wrapper: 'li' }); I cannot have multiple forms (I only want to submit on the last page). Am I missing something obvious?
[jQuery] Re: help with rotating css file using a setinterval, problem with ie
Okay, I managed to solve this with some help. Basically the problem was in the treatment of dimensions to the body and html by IE. Sticking the following in both fixed it: height: 100%; overflow: auto; margin: 0; Just passing it along in case anyone else ran into a similar problem. On Oct 21, 10:57 am, isyjack [EMAIL PROTECTED] wrote: I'm a complete javascript newbie and I know it's not exactly wise to jump into jquery as such, but I did so anyway because I needed something done fairly quickly and in a simple manner. So, forgive me if this is not the most efficient way to get this done. Anyway, the idea behind the script is to swap out the existing linked css file with another random one after a set amount of time. As such, I have the following in the head section: Code: link href=styles/style1.css type=text/css rel=stylesheet id=stylesheet / script type=text/javascript src=scripts/jquery.js/script script type=text/javascript var interval $(document).ready(function() { interval = setInterval(getCSS(), 5000);// 5 secs between requests }); function getCSS() { // randomize the stylesheet to be loaded var r = Math.floor(Math.random()*3+1); // set stylesheet to new stylesheet + randomized number $(#stylesheet).attr({href : styles/style+r+.css}); } /script Everything works nicely in all browsers I've tested (FF, Safari, and Opera) except (of course) IE. Mainly, it swaps out the css (in this case, I'm just changing the background and some text colors for testing purposes). The problem is that only the area that has content receives an update in the background color. Anywhere else, the background remains the same as before. I'm not sure what the problem is, maybe IE renders too slowly, but if you minimize the browser, then maximize again, the background colors display correctly. The problem only shows up if the screen is in view when the css swap happens. Anyone know a way to fix this problem? Any help is much appreciated.
[jQuery] Re: How do i use JQuery ?
Are you using Safari? That's just a temporary file extension it uses until it finishes downloading. Just wait for it to finish. On Oct 18, 4:27 pm, nadavten [EMAIL PROTECTED] wrote: Im trying to download JQuery but its downloading a .download file ... what should i do ?
[jQuery] Re: scrollTo jScrollPane using each()
No ideas on this? On Oct 16, 2:53 pm, dcasey [EMAIL PROTECTED] wrote: I can't figure out how to scroll ALL my panes to the top. Here is the pertinent code: // dynamically assign ids and jScrollPane, I would rather not assign any IDs... $('.scrollpane').each(function(n) { $(this).attr('id', 'scrollpane'+n); $(this).jScrollPane({showArrows:true, scrollbarWidth: 11});}); etc... function scrollAllToTop() { $('#scrollpane1')[0].scrollTo(0); // will scroll that one id to the top, just as described // but, why doesn't this work? I keep getting $(this)[0].scrollTo is not a function $('.scrollpane').each(function() { //alert($('#scrollpane1')[0] == $(this)[0]); // yup it finds one same object in the list... $(this)[0].scrollTo(0); }); }
[jQuery] Re: $(document).ready() vs $(function () {});
Hi Shawn, They're functionally equivalent. The only difference is that $ (function() {}); is shorter and $(document).ready(function() {}); is, at least to me, more intuitive. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Oct 21, 2008, at 12:56 AM, Shawn wrote: I am seeing more and more references to using the $(function() {}); format for the ready method. Is there a compelling reason for this? Or will $(document).ready() perform as well? Or perhaps I'm mis-understanding what the newer format is being used for? Thanks for any tips. Shawn
[jQuery] Simple AJAX call is not loading?
I'm trying to do what should be a fairly simple AJAX call. However it's not playing nicely. Here is the code I have so far. $(document).ready(function() { $('loading').ajaxStart(function() { $(this).show(); }).ajaxStop(function() { $(this).hide(); }); $('#menu li a').click(function() { $('page').load($(this).attr(href) + '.php', function() { $(this).fadeIn(); }); return false; }); }); I've been trying to debug this for the last hour but am coming up with zilch. Please help me figure out what's wrong with this. A big thanks is in order if you do!
[jQuery] mcDropDown: any click event fire the drop down animation
Like the topic says, any click, right or left, fires the animation for the mcDropdown. It disappears right after. Has anyone encountered this bug? Any fixes/workarounds?
[jQuery] Examples of JQuery Ecommerce: Draggable Cart, Enhance Product Images...
Here's an article showing JQuery UI to make a draggable cart, an enhanced product image display and an animated menu. I hope to see JQuery become a staple of ecommerce websites (if it isn't already). http://www.searchfit.com/blog/ecommerce/ecommerce-user-interface-using-jquery-with-searchfit.htm
[jQuery] Re: History Plugin
Does any one has an Idea!!!? On Oct 21, 5:46 pm, Pedram [EMAIL PROTECTED] wrote: I've Problem with it, when I do Ajax Call and and I filter the links in the New Page the History will not Include the Previous Links . consider this is the Page : !---Page A --- div a href='#1' id='1'/a a href='#2' id='2'/a a href='#3' id='3'/a a href='#4' id='4'/a div id=''load Ajax Contenct Comes here/div /div !---Page B --- div a href='#5' id='5' /a a href='#6' id='6' /a a href='#7' id='7' /a a href='#8' id='8' /a /div !-Script - // Don't worry for Live Event it is supported by LiveQuery $(#1,#2,#3,#4,#5,#6,#7,#8).history(function() { alert($ (this).attr(''id)); }); $.ajaxHistory.initialize(); the problem is when you are in the A page links 1 ,2 ,3 ,4 works But when you Click on Link number 5 which is loaded by Ajax it doesn't support 1 ,2 ,3 ,4 LInks , It only works with 6 ,7 ,8 so .. how could I import the BookMarkable system to the AJAX system ... and even I could not Book mark #5 page because it is not indexed in the first Page ... so does any one has an answere for me thanks Regards Pedram On Oct 18, 6:04 am, Rey Bango [EMAIL PROTECTED] wrote: You have a couple of options available: http://stilbuero.de/jquery/history/http://plugins.jquery.com/project/... One suggestion to help you out in the future is to be sure to check out the plugin repo. It has a ton of extensions for many different use cases. http://plugins.jquery.com/ Rey Pedram wrote: Dear Folks , I need to make my webpages bookMarkable and do remember some history . does any one has a link for us .. thanks .
[jQuery] Re: Trouble using rules( add, rules ) as well as setting attribute for range validations
That's great Jörn. It will make things much cleaner for my generated validation JS. In case you're interested, I'm working on a framework that will generate both client-side and server-side validations from a simple xml file using ColdFusion. I've written about it at: http://www.silverwareconsulting.com/index.cfm/2008/10/6/ValidateThis--An-Object-Oriented-Approach-to-Validations And there's a demo available at: http://www.validatethis.org/ Looking at the source of the latter will show you the hoops I had to jump through to create custom validation messages on the fly. Now it will be so much easier. Thanks again, Bob On Oct 21, 2:16 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote: Done! You can find the latest revision here:http://jqueryjs.googlecode.com/svn/trunk/plugins/validate/ Jörn On Tue, Oct 21, 2008 at 7:08 PM, BobS [EMAIL PROTECTED] wrote: I would love to have this feature. It would save me a bunch of extra lines of code. Any idea if and when this might be implemented into the plugin? On Oct 21, 5:55 am, lightglitch [EMAIL PROTECTED] wrote: Done. http://dev.jquery.com/ticket/3503 On Oct 21, 9:53 am, Jörn Zaefferer [EMAIL PROTECTED] wrote: Could you file a ticket for this?http://dev.jquery.com/newticket (requires registration) Thanks! Jörn On Mon, Oct 20, 2008 at 8:49 PM, lightglitch [EMAIL PROTECTED] wrote: I have made a patch for my app to therulesfunction to supportcustom messages: This is the new function, would be nice to have something similar to this. rules: function(command, argument) { var element = this[0]; if (command) { var staticRules = $.data(element.form, 'validator').settings.rules; var existingRules = $.validator.staticRules(element); switch(command) { case add: $.extend(existingRules, $.validator.normalizeRule(argument)); staticRules[element.name] = existingRules; / PATCH ***/ if (argument.messages) { if ($.data(element.form, 'validator').settings.messages[element.name]) $.extend($.data(element.form, 'validator').settings.messages[element.name],argument.messages); else $.data(element.form, 'validator').settings.messages[element.name] = argument.messages; } / END PATCH ***/ break; case remove: if (!argument) { delete staticRules[element.name]; return existingRules; } var filtered = {}; $.each(argument.split(/\s/), function(index, method) { filtered[method] = existingRules[method]; delete existingRules[method]; }); return filtered; } } var data = $.validator.normalizeRules( $.extend( {}, $.validator.metadataRules(element), $.validator.classRules(element), $.validator.attributeRules(element), $.validator.staticRules(element) ), element); // make sure required is at front if (data.required) { var param = data.required; delete data.required; data = $.extend({required: param}, data); } return data; }, And I use it like this: $(#field).rules(add, {required:true,range:[5,45],messages: {required:The field can\'t be blank.,range:The field must have 5 to 45 characters.}}); Hope it helps. On Oct 9, 11:00 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote: You can use metadata, too. Currently barely documented, and not really recommended either, but works since 1.4. input class={required:true,messages:{required:'required field'}} name=whatever / Jörn On Thu, Oct 9, 2008 at 5:20 PM, Bob Silverberg [EMAIL PROTECTED] wrote: Thanks for the quick response. That fixed my problem. One more question: I'd like to addcustomerror messages to some
[jQuery] Re: accordion query
Hi, Your HTML is not valid as you can't have a form inside a p tag. As you have a mix of element types in your accordian I suggest you use an extra div as a wrapper and adjust the jQuery code to operate on the div instead of the p. Something like this: div class=accordion h3Latest news/h3 div pLorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi malesuada, ante at feugiat tincidunt, enim massa gravida metus, commodo lacinia massa diam vel eros. Proin eget urna. Nunc fringilla neque vitae odio.br / read more about xxx...br / br / Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi malesuada, ante at feugiat tincidunt, enim massa gravida metus, commodo lacinia massa diam vel eros. Proin eget urna. Nunc fringilla neque vitae odio.br / read more about xxx.../p /div h3Email newsletter/h3 div pJoin our email newsletter by completing your details below and we'll get you added and keep you updated./p form id=form1 method=post action= labelName input type=text name=textfield id=textfield / /label br / labelEmail input type=text name=textfield2 id=textfield2 / /label br / label input type=submit name=button id=button value=Subscribe / /label /form /div h3Forum/h3 div pLorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi malesuada, ante at feugiat tincidunt, enim massa gravida metus, commodo lacinia massa diam vel eros. Proin eget urna. Nunc fringilla neque vitae odio. Vivamus vitae ligula./p /div /div and JavaScript like this: $(.accordion h3:first).addClass(active); $(.accordion div:not(:first)).hide(); $(.accordion h3).click(function(){ $(this).next(div).slideToggle(slow) .siblings(div:visible).slideUp(slow); $(this).toggleClass(active); $(this).siblings(h3).removeClass(active); }); Paul On Oct 21, 11:11 am, Steven Grant [EMAIL PROTECTED] wrote: Hi folks, I'm using the following for an accordion style menu div class=accordion h3Latest news/h3 pLorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi malesuada, ante at feugiat tincidunt, enim massa gravida metus, commodo lacinia massa diam vel eros. Proin eget urna. Nunc fringilla neque vitae odio.br / read more about xxx...br / br / Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi malesuada, ante at feugiat tincidunt, enim massa gravida metus, commodo lacinia massa diam vel eros. Proin eget urna. Nunc fringilla neque vitae odio.br / read more about xxx.../p h3a href=http://www.google.co.uk;Useful contact list/a/h3 h3Email newsletter/h3 pJoin our email newsletter by completing your details below and we'll get you added and keep you updated.br / form id=form1 method=post action= labelName input type=text name=textfield id=textfield / /label br / labelEmail input type=text name=textfield2 id=textfield2 / /label br / label input type=submit name=button id=button value=Subscribe / /label /form/p h3Forum/h3 pLorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi malesuada, ante at feugiat tincidunt, enim massa gravida metus, commodo lacinia massa diam vel eros. Proin eget urna. Nunc fringilla neque vitae odio. Vivamus vitae ligula./p /div and this is the Javascript: script type=text/javascript $(document).ready(function(){ $(.accordion h3:first).addClass(active); $(.accordion p:not(:first)).hide(); $(.accordion h3).click(function(){ $(this).next(p).slideToggle(slow) .siblings(p:visible).slideUp(slow); $(this).toggleClass(active); $(this).siblings(h3).removeClass(active); }); }); /script When I view this in the browser the form is displayed automatically, how can I hide it until the user presses for the drop down? Thanks, S
[jQuery] Simple AJAX call does not load
I'm trying to do what should be a fairly simple AJAX call. However it's not playing nicely. Here is the code I have so far. $(document).ready(function() { $('loading').ajaxStart(function() { $(this).show(); }).ajaxStop(function() { $(this).hide(); }); $('#menu li a').click(function() { $('page').load($ (this).attr(href) + '.php', function() { $(this).fadeIn(); }); return false; }); }); I've been trying to debug this for the last hour but am coming up with zilch. Please help me figure out what's wrong with this. A big thanks is in order if you do!
[jQuery] Re: jQuery Uploader Flash player 10 fix
hi Gilles, i was about to take the same path: convert YUI uploader into jquery for the new version of jquploader, because it's simply the best implementation i've seen so far (kuddos to yahoo). i'll be very interested with what you come up with. There is one issue i still lack for a good answer, i'd be interested in your opinion: say you want to control the uploaded file 's name, for example so that it does not erase an existing file with the same name: then the serverside script woudl produce a unique file name, according to a given logic (timestamp appended, etc), or simply to avoid empty spaces or quote characters in the name. Is it actually possible that the flash file returns the serverside-generated file name ? thanks, Alexandre On Tue, Oct 21, 2008 at 8:55 PM, Gilles (Webunity) [EMAIL PROTECTED]wrote: Update: Most of the callbacks have been implemented; Actionscript (Flash) work seems to be done; yet i did all my work without debugging. Tomorrow i have to add maybe 3 or 4 events / log messages and then i can start building ;) -- Gilles On Oct 20, 7:52 pm, Gilles (Webunity) [EMAIL PROTECTED] wrote: Guys; A lot (8) people have allready asked me if i was going to fix the mess Adobe made and my answer is yes, i am working on it. This post is to assure you that the jQuery Flash based uploader i wrote in 2006 has been revived. The project will no longer be based on swfupload, since i added way to much code of my own into it. The new version is (looseley) based upon YUI uploader component, and off course i've taken a peek to see what FancyUpload does in their code. To be honest; they are both very good products and both have their pro's and con's. I am hoping to create a project which will be the best of both worlds and more (currently, approx. 80% code is my own work) I've allready put about 10 hours of work in the new jQuery upload plugin (which was originally hosted onhttp://uploader.webunity.nl/) but unfortunately it is not finished yet. Since i based the startcode (e.g. how to create an AS3 movieclip) on YUI, I must abide by their license, which is BSD. The uploader plugin (Javascript) is going to be included as full source, but the Actionscript file is going to be precompiled. This is due to the fact that i simply put to much work in it. Some stuff that i added; - A lot more and consistant event handlers - A lot more and better logging - Multiple simultanous (!!) uploads And, ported from my old version: - Queue managemen - Max file size - Max queue size - Max queue count The idea is to even make it possible to add files while you are allready uploading; sort of background file transfer so to say. Anyway; i'll hope to finish the Actionscript code tomorrow evening (it is now 20:00 here) and the demo's the day after that. Basically; by the end of the week you should have some working examples. Thank you for al your wonderfull feedback -- Gilleshttp://www.webunity.nl/
[jQuery] Re: mcDropDown: any click event fire the drop down animation
Like the topic says, any click, right or left, fires the animation for the mcDropdown. It disappears right after. Has anyone encountered this bug? Any fixes/workarounds? Are you seeing the problem on the example page? http://www.givainc.com/labs/mcdropdown_jquery_plugin.htm What version are you using? Is there a live example of the problem you're having? -Dan
[jQuery] Re: History Plugin
I don't understand what the problem is. Could you put up a demo? --Klaus On 21 Okt., 22:35, Pedram [EMAIL PROTECTED] wrote: Does any one has an Idea!!!? On Oct 21, 5:46 pm, Pedram [EMAIL PROTECTED] wrote: I've Problem with it, when I do Ajax Call and and I filter the links in the New Page the History will not Include the Previous Links . consider this is the Page : !---Page A --- div a href='#1' id='1'/a a href='#2' id='2'/a a href='#3' id='3'/a a href='#4' id='4'/a div id=''load Ajax Contenct Comes here/div /div !---Page B --- div a href='#5' id='5' /a a href='#6' id='6' /a a href='#7' id='7' /a a href='#8' id='8' /a /div !-Script - // Don't worry for Live Event it is supported by LiveQuery $(#1,#2,#3,#4,#5,#6,#7,#8).history(function() { alert($ (this).attr(''id)); }); $.ajaxHistory.initialize(); the problem is when you are in the A page links 1 ,2 ,3 ,4 works But when you Click on Link number 5 which is loaded by Ajax it doesn't support 1 ,2 ,3 ,4 LInks , It only works with 6 ,7 ,8 so .. how could I import the BookMarkable system to the AJAX system ... and even I could not Book mark #5 page because it is not indexed in the first Page ... so does any one has an answere for me thanks Regards Pedram On Oct 18, 6:04 am, Rey Bango [EMAIL PROTECTED] wrote: You have a couple of options available: http://stilbuero.de/jquery/history/http://plugins.jquery.com/project/... One suggestion to help you out in the future is to be sure to check out the plugin repo. It has a ton of extensions for many different use cases. http://plugins.jquery.com/ Rey Pedram wrote: Dear Folks , I need to make my webpages bookMarkable and do remember some history . does any one has a link for us .. thanks .
[jQuery] Re: Faceted navigation Solution Ideas
Thanks for that - I had seen it but it is not immediately obvious how that will be the solution. It seems the menu elements are hardcoded whereas in the solution I need the menu elements will vary/be filtered continually depending on the initial search and then by subsequent selections. Can accordion do this?
[jQuery] Re: Jquery load not getting updated pages.....
That's not jQuery's fault, check the headers as Bil said or use the query string trick if you need to avoid cacheing. If you use jQuery.ajax() you can also set cache: false as an option. For testing purposes, if you access the loaded page directly the browser will update the cache. IE7 is specially nasty with this, I haven't had this problem with FF. cheers, - ricardo On Oct 21, 2:34 pm, Stever [EMAIL PROTECTED] wrote: Hello, I spent about an hour trying to figure out why a form I was loading to a web page was not updating. In my web page I have a navigation button tool, when I click I want to load a form into the #display div. $(document).ready(function(){ .. a bunch of code. $('#menu li.tool').click(function() { $('#display #product').remove(); $('#menu li[device=device]').removeAttr('clicked'); $('#display').load('../forms/test_form_1.html'); }); .. remaining code }; I call up the page and click the tool button and the form displays no problem. However, later I made changes to the form (test_form_1.html) and they were not included, even after refreshing the page. I even removed the html file and it still loads! Apparently this file is saved in the cache, how do I make sure everytime I click on the tool button I get the latest page? Steve
[jQuery] Re: Atribute selector with squared brackets
That's kind of what I meant to say. From my understanding, the CDATA rules apply if you are serving XHTML as application/xhtml+xml. If you are serving as text/html it is implied you are being backwards compatible, so you should go by the HTML4 rules where only A-z,0-9,._- characters are allowed. Anyway I was just being picky. Everybody uses { in class attributes for metadata already, and most browsers (even the ones that don't support XHTML as application/xml) don't have a problem with that, I don't know how far down the chain that becomes a problem (IE5?). http://www.w3.org/TR/xhtml1/#C_8 What I really wanted to say is 'why are these lunatics putting brackets in IDs/names? there are plenty of unused/unmeaningful characters to choose' ;) - ricardo On Oct 21, 4:34 pm, jasonkarns [EMAIL PROTECTED] wrote: In XHTML, the name attribute on input (and textarea and select) elements is defined as CDATA not NMTOKEN thus, brackets are legal in name attributes on input elements. It is NOT backwards compatible with HTML, where the character restriction is [a-z][A-Z]-_ and . Further note, the id attribute has it's own separate set of restrictions that are a subset of all HTML attributes. http://www.w3.org/TR/xhtml1/dtds.html#dtdentry_xhtml1-transitional.dt...http://www.w3.org/TR/xhtml1/dtds.html#dtdentry_xhtml1-transitional.dt...http://www.w3.org/TR/xhtml1/dtds.html#dtdentry_xhtml1-transitional.dt... ~Jason On Oct 21, 12:07 pm, ricardobeat [EMAIL PROTECTED] wrote: Brackets are an invalid character in attributes, for XHTML served as text/html, which I guess accounts for most of jQuery usage anyway. Looks like someone already updated the docs. - ricardo On Oct 20, 11:36 pm, Ariel Flesler [EMAIL PROTECTED] wrote: We got a ticket about how to select elements by an attribute with brackets. I replied with the common link to the FAQ and the reporter replied that the example in the docs doesn't work. I tried that myself, and indeed, that didn't work. http://dev.jquery.com/ticket/3443 $('[name=foo[bar]]'); // Doesn't work $('[name=foo\\[bar\\]]'); // Should work, but doesn't $('[name=foo[bar]]'); // Does work Now... I think the last option is good enough. But we need to update the docs. Anything to add ? Anyone volunteers to update the docs ? Cheers -- Ariel Fleslerhttp://flesler.blogspot.com/
[jQuery] [TUTORIAL] Create a professional interface for your web applications using jQuery
In this tut we will create a professional interface for your web applications using the killer javascript library jQuery :) I hope you can use it for your personal projects guys. Feedback is welcome! http://yensdesign.com/2008/10/create-a-professional-interface-for-your-web-applications-using-jquery/
[jQuery] Re: Polygon
There is the jCrop plugin, though it's just a rectangle. For a polygon you would need an image map or canvas element, a bit more complicated and no ready-made solution. http://deepliquid.com/content/Jcrop.html - ricardo On Oct 21, 2:32 pm, Sébastien Lachance [EMAIL PROTECTED] wrote: Maybe it's a stupid question but I was wondering if there is a way to generate a polygon with 4 points, so that the user can himself drag each point to create it's own (mainly for selecting a portion of an image). Is it possible with a specific jQuery plugin. I can't seem to find anything after a few hours of my time. Thank you!! Sébastien Lachance
[jQuery] Re: Polygon
Doh @ me, a rectangle *is* a polygon (and it would be stupid to crop an image with any other shape). Sorry about that! On Oct 21, 8:03 pm, ricardobeat [EMAIL PROTECTED] wrote: There is the jCrop plugin, though it's just a rectangle. For a polygon you would need an image map or canvas element, a bit more complicated and no ready-made solution. http://deepliquid.com/content/Jcrop.html - ricardo On Oct 21, 2:32 pm, Sébastien Lachance [EMAIL PROTECTED] wrote: Maybe it's a stupid question but I was wondering if there is a way to generate a polygon with 4 points, so that the user can himself drag each point to create it's own (mainly for selecting a portion of an image). Is it possible with a specific jQuery plugin. I can't seem to find anything after a few hours of my time. Thank you!! Sébastien Lachance
[jQuery] Re: Find index of div with class selected
Much appreciated! Works wonderfully. I guess I don't quite understand the use of variables and commas inside element declarations. So much to learn!
[jQuery] Re: Simple AJAX call does not load
do you really have loading and page elements? Seems you're missing some '#'s there. Use Firebug on Firefox for debugging, you'd spot the problem in 10 seconds. - ricardo On Oct 21, 5:29 pm, scheda [EMAIL PROTECTED] wrote: I'm trying to do what should be a fairly simple AJAX call. However it's not playing nicely. Here is the code I have so far. $(document).ready(function() { $('loading').ajaxStart(function() { $(this).show(); }).ajaxStop(function() { $(this).hide(); }); $('#menu li a').click(function() { $('page').load($ (this).attr(href) + '.php', function() { $(this).fadeIn(); }); return false; }); }); I've been trying to debug this for the last hour but am coming up with zilch. Please help me figure out what's wrong with this. A big thanks is in order if you do!