[jQuery] Re: checking if jquery loaded
Hello zendog74, In your script above you have script.onload = loadPlugins();, the onload event is only usable in the body tag or the frameset tag. Other than that I think your script is ok. On Jan 15, 4:44 pm, zendog74 n8cs...@gmail.com wrote: These just give me undefined errors, as jQuery is not defined if it is not loaded. Again, what I need to do is load jQuery if it is not already loaded and then load all of the required plug-ins once it is loaded. On Jan 14, 4:39 pm, waseem sabjee waseemsab...@gmail.com wrote: if(jQuery) { // jquery is loaded} if($) { // jquery is loaded } or if (jQuery != null) { // jquery is loaded} if ($ != null) { // jquery is loaded } On Thu, Jan 14, 2010 at 11:30 PM, zendog74 n8cs...@gmail.com wrote: I am trying to only load jquery and jqueryui if they do not already exist. If they do exist, then I load a bunch of plug-ins used by the app. However, the below is not working and I have no idea why. Can anyone provide some insight? if (typeof jQuery == 'undefined') { console.log(loading local jquery files); var head = document.getElementsByTagName(head)[0]; var script = document.createElement(script); script.type = text/javascript; script.src = /cml/js/jquery.min.js; script.onload = loadPlugins(); head.appendChild(script); var script2 = document.createElement(script); script2.type = text/javascript; script2.src = /cml/js/jquery-ui.min.js; head.appendChild(script2); } function loadPlugins(){ if(typeof jQuery != 'undefined'){ console.log(jquery is defined); jQuery.noConflict(); //load the plugins if(!jQuery().maxlength){ jQuery(head).append('scr' + 'ipt type=text/javascript src= %=response.encodeURL(cntxPath + /js/jquery.maxlength-min.js)%/ scr' + 'ipt'); console.log(loaded maxlength plugin); } if(!jQuery().address){ jQuery(head).append('scr' + 'ipt type=text/javascript src= %=response.encodeURL(cntxPath + /js/jquery.address-1.1.min.js)%/ scr' + 'ipt'); console.log(loaded address plugin); } if(!jQuery().delay){ jQuery(head).append('scr' + 'ipt type=text/javascript src= %=response.encodeURL(cntxPath + /js/jquery.delay.js)%/scr' + 'ipt'); console.log(loaded delay plugin); } if(!jQuery().ajaxSubmit){ jQuery(head).append('scr' + 'ipt type=text/javascript src= %=response.encodeURL(cntxPath + /js/jquery.form.js)%/scr' + 'ipt'); console.log(loaded form plugin); } Thanks everyone.
[jQuery] Re: Easy way to do this in jQuery?
Hello Nick, I've put up a very basic view of what you're looking for here http://pastebin.com/f4f2a029e Hope this helps you get what you're looking for. If you need more help let me know. Nalum On Jan 10, 11:25 pm, Nick Le Mouton nood...@planetslackers.com wrote: Hi everyone, I've just started using jQuery and so far I'm impressed with the power and simplicity of it. At the moment I'm looking for a better way to do the shape dropdown selector onhttp://www.drugs.com/imprints.php. It's currently done with a bit of ddrive and some custom code, but I'd rather use a jQuery plugin if I can find one. Can anyone point me in the direction of a good plugin that will do this? Thanks Nick
[jQuery] Re: jQuery UI Portlets Cookies
Hello Craig, I've done this before by building up a string e.g. box- id1,collapsed;box-id5,not-collapsed;box-id3,collapsed|box- id4,collapsed;box-id2,not-collapsed;box-id6,collapsed; In the javascript do something like this http://pastebin.com/m90a2af6 Hope this helps, Nalum On Oct 2, 2:35 pm, craigeves craige...@googlemail.com wrote: anyone? On Oct 2, 12:08 am, craigeves craige...@googlemail.com wrote: Please can someone help? I am using the jQuery UI (sortable) Portlets code - but I want to use the jQuery cookies plugin to remember the order of the portlets. I don't know where to start - and searching the net for an answer only brings up sortable ul and li. Please help. Code: script type=text/javascript $(function() { $(.column).sortable({ connectWith: '.column' }); $(.column).disableSelection(); }); /script HTML: div class=column div class=portlet div class=portlet-header ui-state-disabledFeeds/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerNews/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div div class=column div class=portlet div class=portlet-headerShopping/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div div class=column div class=portlet div class=portlet-headerLinks/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerImages/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div
[jQuery] Re: How to disable a form
This is a nice plugin that I've come across that I think would be able to do exactly what you want. http://malsup.com/jquery/block/ Nalum On Oct 2, 2:35 pm, Cecil Westerhof cldwester...@gmail.com wrote: 2009/10/2 brian bally.z...@gmail.com: On Fri, Oct 2, 2009 at 9:11 AM, Cecil Westerhof cldwester...@gmail.com wrote: 2009/10/2 brian bally.z...@gmail.com: I like that idea but another might be to (after the form has submitted) add a new submit handler for the form that simply returned false. The problem with that is that the fields still can be changed. I prefer that this is not possible. A simple method would be to hide the form. But that is not very pleasing to the eyes I am afraid. I suppose it depends on the interface you're working with. Perhaps you could fade the form out and display, in its place, a thank you (or whatever) message. If something goes wrong you could re-display the form. That was what I am thinking about for lack of something better. I would prefer to hide it only after a succesfull submit. But I expect it to be mostly succesfull. So it is acceptable. -- Cecil Westerhof
[jQuery] Re: jQuery UI Portlets Cookies
Is the code in the original post all the code you have? On Oct 2, 3:03 pm, craigeves craige...@googlemail.com wrote: Thanks for this - but I don't understand where it would fit into my script? I'm only just starting in jQuery... Also, will this save the position of the portlet no matter which column it's in? It's just that it looks like it's related to a closed and expanded portlet state. Thanks for your time. Craig On Oct 2, 2:58 pm, Nalum mallon.l...@gmail.com wrote: Hello Craig, I've done this before by building up a string e.g. box- id1,collapsed;box-id5,not-collapsed;box-id3,collapsed|box- id4,collapsed;box-id2,not-collapsed;box-id6,collapsed; In the javascript do something like thishttp://pastebin.com/m90a2af6 Hope this helps, Nalum On Oct 2, 2:35 pm, craigeves craige...@googlemail.com wrote: anyone? On Oct 2, 12:08 am, craigeves craige...@googlemail.com wrote: Please can someone help? I am using the jQuery UI (sortable) Portlets code - but I want to use the jQuery cookies plugin to remember the order of the portlets. I don't know where to start - and searching the net for an answer only brings up sortable ul and li. Please help. Code: script type=text/javascript $(function() { $(.column).sortable({ connectWith: '.column' }); $(.column).disableSelection(); }); /script HTML: div class=column div class=portlet div class=portlet-header ui-state-disabledFeeds/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerNews/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div div class=column div class=portlet div class=portlet-headerShopping/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div div class=column div class=portlet div class=portlet-headerLinks/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerImages/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div
[jQuery] Re: jQuery UI Portlets Cookies
Hello Craig, When you need to show code you should try using a site like http://pastebin.com as it'll make it easier to read and your post wont be so long. You'll need to be able to work with cookies, I would suggest this jquery plugin http://plugins.jquery.com/project/cookie. I've explained how it works in this code here http://pastebin.com/m2c0e0bde. Hope this helps you out. Nalum On Oct 2, 3:15 pm, craigeves craige...@googlemail.com wrote: Here it is - thanks for your help again !doctype html html lang=en head titlejQuery UI Sortable - Portlets/title script type=text/javascript src=jquery-1.3.2.js/script script type=text/javascript src=ui.core.js/script script type=text/javascript src=ui.sortable.js/script style type=text/css .column { width: 300px; float: left; background-color: #ee; margin-right: 25px; padding-top: 10px; padding-right: 10px; padding-bottom: 0px; padding-left: 10px; height: 700px;} .portlet { background-color: #FFF; margin-top: 0; margin-right: 0; margin-bottom: 10; margin-left: 0;} .portlet-header { margin: 0px; font-family: Arial, Helvetica, sans-serif; font-size: 18px; background-color: #333; padding: 10px; color: #FFF;} .portlet-header .ui-icon { float: right; } .portlet-content { padding: 10px; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; color: #333; margin-bottom: 10px;} .ui-sortable-placeholder { border: 1px dotted black; visibility: visible} .ui-sortable-placeholder * { visibility: hidden; } /style script type=text/javascript $(function() { $(.column).sortable({ handle: '.portlet-header', connectWith: '.column' }); $(.column).disableSelection(); }); /script /head body div class=demo div class=column div class=portlet div class=portlet-header ui-state-disabledFeeds/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerNews/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div div class=column div class=portlet div class=portlet-headerShopping/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div psddfds/p /div div class=column div class=portlet div class=portlet-headerLinks/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerImages/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div /div /body /html On Oct 2, 3:09 pm, Nalum mallon.l...@gmail.com wrote: Is the code in the original post all the code you have? On Oct 2, 3:03 pm, craigeves craige...@googlemail.com wrote: Thanks for this - but I don't understand where it would fit into my script? I'm only just starting in jQuery... Also, will this save the position of the portlet no matter which column it's in? It's just that it looks like it's related to a closed and expanded portlet state. Thanks for your time. Craig On Oct 2, 2:58 pm, Nalum mallon.l...@gmail.com wrote: Hello Craig, I've done this before by building up a string e.g. box- id1,collapsed;box-id5,not-collapsed;box-id3,collapsed|box- id4,collapsed;box-id2,not-collapsed;box-id6,collapsed; In the javascript do something like thishttp://pastebin.com/m90a2af6 Hope this helps, Nalum On Oct 2, 2:35 pm, craigeves craige...@googlemail.com wrote: anyone? On Oct 2, 12:08 am, craigeves craige...@googlemail.com wrote: Please can someone help? I am using the jQuery UI
[jQuery] Re: How to disable a form
If you look at the examples you can set it to block just a specified element. On Oct 2, 3:19 pm, Cecil Westerhof cldwester...@gmail.com wrote: 2009/10/2 Nalum mallon.l...@gmail.com: This is a nice plugin that I've come across that I think would be able to do exactly what you want. http://malsup.com/jquery/block/ I think that that is what I need. The only 'problem' is that it blocks the whole page and not only the form. But I can live with that. -- Cecil Westerhof
[jQuery] Re: Block access to the page but unblock certains divs
Have a look at he last posts in this thread. http://groups.google.com/group/jquery-en/browse_thread/thread/a174d8c1fdebad65 On Oct 2, 3:32 pm, samh12 ste...@bluemania.co.uk wrote: Hi, Is it possible to block the entire page but then override certain divs with an unblock command? Basically, I want to implement the block function when someone clicks the submit button on a form but if they have missed a question then unblock just this question div so it's nice and clear that's the one they need to correct? Thanks.
[jQuery] Re: jQuery UI Portlets Cookies
I've updated the javascript here. http://pastebin.com/m4caef476 If you need any help in understanding whats happening here let me know and I'll try to explain it, I'm not the best at explaining things though. Nalum On Oct 2, 4:06 pm, craigeves craige...@googlemail.com wrote: Hi Nalum I have tried and amended the code as you suggested - but still no luck? Thanks for the tip (pastebin). Here is my full code now. Please would you take a quick look and let me know where im going wrong? http://pastebin.com/m4dab8bb2 Thanks for your help in this - it's really appreciated! Craig On Oct 2, 3:40 pm, Nalum mallon.l...@gmail.com wrote: Hello Craig, When you need to show code you should try using a site likehttp://pastebin.com as it'll make it easier to read and your post wont be so long. You'll need to be able to work with cookies, I would suggest this jquery pluginhttp://plugins.jquery.com/project/cookie. I've explained how it works in this code herehttp://pastebin.com/m2c0e0bde. Hope this helps you out. Nalum On Oct 2, 3:15 pm, craigeves craige...@googlemail.com wrote: Here it is - thanks for your help again !doctype html html lang=en head titlejQuery UI Sortable - Portlets/title script type=text/javascript src=jquery-1.3.2.js/script script type=text/javascript src=ui.core.js/script script type=text/javascript src=ui.sortable.js/script style type=text/css .column { width: 300px; float: left; background-color: #ee; margin-right: 25px; padding-top: 10px; padding-right: 10px; padding-bottom: 0px; padding-left: 10px; height: 700px;} .portlet { background-color: #FFF; margin-top: 0; margin-right: 0; margin-bottom: 10; margin-left: 0;} .portlet-header { margin: 0px; font-family: Arial, Helvetica, sans-serif; font-size: 18px; background-color: #333; padding: 10px; color: #FFF;} .portlet-header .ui-icon { float: right; } .portlet-content { padding: 10px; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; color: #333; margin-bottom: 10px;} .ui-sortable-placeholder { border: 1px dotted black; visibility: visible} .ui-sortable-placeholder * { visibility: hidden; } /style script type=text/javascript $(function() { $(.column).sortable({ handle: '.portlet-header', connectWith: '.column' }); $(.column).disableSelection(); }); /script /head body div class=demo div class=column div class=portlet div class=portlet-header ui-state-disabledFeeds/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerNews/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div div class=column div class=portlet div class=portlet-headerShopping/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div psddfds/p /div div class=column div class=portlet div class=portlet-headerLinks/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerImages/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div /div /body /html On Oct 2, 3:09 pm, Nalum mallon.l...@gmail.com wrote: Is the code in the original post all the code you have? On Oct 2, 3:03 pm, craigeves craige...@googlemail.com wrote: Thanks
[jQuery] Re: Block access to the page but unblock certains divs
I think you'll have to do it in such a way that it blocks the different elements individually and then unblock the ones that have errors. e.g. $('.blockMe').blockUI({message: null}); $('.error').unblock(); On Oct 2, 3:51 pm, samh12 ste...@bluemania.co.uk wrote: Hi Nalum, Idon't think that answers my question. I know I can block at page and element level however I want a mixture. I want to block the page but leave the element that's in error alone i.e. $(document).ready(function() { $('#btnSubmit').click(function() { $.blockUI({ message: null }); $('#form_surname').unblock(); //now unblock the surname field as this needs correcting $('.blockOverlay').attr('title','Click to unblock').click($.unblockUI); }); }); Thanks.
[jQuery] Re: Modal Dialog with a datepicker inside, works one time, then never...
Hello Alex, The only reason it would be a problem is if you don't apply the jQuery to the input every time it is loaded or if it is loaded a second time and old input is still on the page then you have two elements with the same id. If you have two elements with the same id jQuery wont do anything as it expects that an id is unique. Nalum On Sep 29, 7:01 pm, Alex Barrios alexba...@gmail.com wrote: 2009/9/29 Nalum mallon.l...@gmail.com: Hello Alex, Is input type=text name=date id=idFIV readonly=true size=10 class=calendario style=border:none loaded in using ajax? If it isn't then you don't need to put the date picker into a function, you could do the following:http://pastebin.com/m4ddcd98b If it is loaded with ajax then you need to call the function every time it is loaded into the page. Hope this helps Nalum Hello Nalum... That's right, that input its loaded with ajax... I use the dateSelector function to unify in one place all the dates that are used in the forms, so if i need to change the format i just do this in one place. Could this be a problem ? Thanks for all your help. -- Alex Barrios
[jQuery] Re: help read code
.mouseup(); takes a function as it's argument. So the user is creating a function while passing it through to .mouseup(); It could also have been done like this. $(document).mouseup(mouseUpFunction); function mouseUpFunction(e) // e is the event { if($(e.target).parent(a.signin).length==0) { $(fieldset#signin_menu).hide(); } } Another way, and I would think a better way, to do it would be $(a.signin).click(function(){ $(fieldset#signin_menu).hide(); }); Hope this helped. On Sep 29, 4:03 pm, runrunforest craigco...@gmail.com wrote: Hi, this code is from a dropdown box, where clicking on the a.signin will open or close the box. So I don't really get how the syntax below work $(document).mouseup(function(e) { if($(e.target).parent(a.signin).length==0) { $(fieldset#signin_menu).hide(); } });
[jQuery] Re: Modal Dialog with a datepicker inside, works one time, then never...
Hello Alex, Is input type=text name=date id=idFIV readonly=true size=10 class=calendario style=border:none loaded in using ajax? If it isn't then you don't need to put the date picker into a function, you could do the following: http://pastebin.com/m4ddcd98b If it is loaded with ajax then you need to call the function every time it is loaded into the page. Hope this helps Nalum On Sep 29, 4:30 pm, Alex Barrios alexba...@gmail.com wrote: 2009/9/28 alexbariv alexba...@gmail.com Hi everybody. Let me introduce myself. I'm a developer located in Venezuela (latin america), and i have like 2 years using Jquery in every project that came to my hands. Its a pleasure to meet you all. For begin, i have a little problem that i hope you can giveme some light here: I have created a modal dialog inside a tab with a simple form that has a datepicker: div id=tabs-3 style=font-size:11px; div style=padding-left:75%; a href=javascript:void(0) onClick=javascript:{modalForm ('idValuation','destiny.php',$(this).text());} Add Valuation /a /div div id=idValuation style=display:none;padding:2px table tr td valign=topComments: /td tdtextarea type=text name=comment_omit style=width:200px;/textarea/td /tr tr tdDate: /td td script type=text/javascript dateSelector('idFIV'); /script input type=text name=date id=idFIV readonly=true size=10 class=calendario style=border:none /td /tr /table /div /div So, as you can see i call a function dateSelector and this function calls the datePicker like this: function dateSelector(id) { $(document).ready(function() { $(#+id).css({'border':'none','background- color':'#E5E5E5','float':'left'}); $(#+id).datepicker( { showOn: 'button', buttonImage: 'images/iconos/calendar.png', dateFormat:'dd-mm-yy', buttonImageOnly: true }, $.datepicker.regional['es']); }); } The dialog its created like this: function modalForm(id, url, tittle) { if ( !$(#+id).dialog( 'isOpen' ) ){ $(#+id).dialog({ bgiframe : true, closeOnEscape : true, resizable : false, width : 500, modal : true, title : tittle, beforeclose: function(event, ui) { $(this).dialog('destroy'); }, buttons : { 'Cancel' : function() { $(this).dialog('close'); }, 'Add Record' : function() { updateView(''+url+'',''+id+''); $(this).dialog('close'); } } }); $(#+id).dialog('open'); } } This works just perfect, the dialog appear, i can select the date, add a record to the database, and then just call again the dialog using the link. The thing is that when i use this the first time, works perfect, when i try to add a second record, the date picker doesnt refresh the field. It shows the calendar, but when i select a value, this doesnt appear in the input, and even more strange, if i close de dialog and then reopen, it appears the value that i tried to select, selected, but the same problem again. What i am doing wrong with this ? Why works only the first time and then breaks? Thanks in advance for all your help! :-D Hi Again. After some testing, still nothing appears to work. I put a simple calendar and nothing. Could be that this modal its inside the tab plugin also ? -- Alex Barrios
[jQuery] Re: How do I stop my div from sliding?
I agree with Jon, you would be better off using css fixed style for this rather than javascript. On Sep 29, 5:12 pm, Jon Banner banali...@googlemail.com wrote: as soon as i scroll your demo, the div disappears off the top of the page in firefox and IE7 From the behaviour you describe i think this might be useful to you http://www.cssplay.co.uk/layouts/fixed.html best. Jon 2009/9/29 jpearson311 jpearson...@hotmail.com Hi all. JQuery noob here. I'm building a site right now that has a left column navigation and the navigation is nested inside a div, which is nested inside a table cell (i.e., td). I'm using JQuery to make it so when the user scrolls down the page, the div slides down with smoothly and always stays at the top of the page. I have this working just fine, but when I change resolutions (i.e., 1024x768), the div scrolls over the bottom of the page, which is what I don't want. How can I calculate in order for the div to know when it hast reached the bottom of the table cell? I tried using outerHeight to calculate the height of the table cell and then subtracting the height of the div from it, but I'm clearly doing it wrong because it's still not working. You can view the page I'm referring to at www.ts24.com/watersedge/overview.cfm. The JS code I'm using is below. If anyone has any pointers, I'd really appreciate it. Thanks! Jesse var name = #scroller; var menu_top_limit = 0; var menu_bottom_limit = $('#holder #scroller').outerHeight() - 560; var menu_top_margin = -15; var menu_shift_duration = 500; var menuYloc = null; /// $(window).scroll(function() { // Calculate the top offset, adding a limit offset = menuYloc + $(document).scrollTop() + menu_top_margin; // Limit the offset to 0 pixels... // This keeps the menu within it's containing TD boundaries if(offset menu_top_limit){ offset = menu_top_limit; // Give it the PX for pixels: offset += px; } /*else if(offset menu_bottom_limit){ offset = menu_bottom_limit; offset += px; }*/ // Animate: $(name).animate({top:offset}, {duration:menu_shift_duration,queue:false}); });
[jQuery] Re: $(form).submit() validation and multiple forms
Try changing within to $('form'). I haven't come across within so I don't know anything about it. On Sep 29, 4:45 pm, Jeremy jeremy.darl...@gmail.com wrote: I have built out a fairly rhobust app using jquery and jquery-ui all was going well until we started to bring different screens together inside a tabbed interface. Seems that now when we execute our validation code on one form its checking the fields of all other forms on the page. All of my forms do have unique ID's and all elements within all forms have unique ID's. My understanding of using this.find inside of the submit event was that it should only find the forms elements am I wrong? Method that performs the actual validation: function validateForm(event){ var allOk = true; $(this).find(*[validation]).each(function(){ var elem = $(this); var val = elem.attr('validation'); var fn = elem.attr('id'); var ok = true; if(val!='') eval('ok = '+val+';'); ok = (ok)?true:false; if(allOk(!ok)) elem.focus(); if(ok) elem.removeClass('error'); else{ elem.change(function(){ var elem = $(this); var fn = elem.attr('id'); var val = elem.attr('validation'); var ok = true; if(val!='') eval('ok = '+val+';'); if(ok) elem.removeClass('error'); }); elem.addClass('error'); } allOk = allOk ok; }); this.valid = allOk; if(!allOk) if(event) event.preventDefault(); return allOk; } Initialized with (inside document.ready): within.find(form).submit(validateForm); Thanks, - Jeremy
[jQuery] Re: $(form).submit() validation and multiple forms
try changing this: within = within ? $('#' + within) : $(document); to this: within = typeof(within) != 'undefined' ? $('#' + within) : $ (document); On Sep 29, 5:33 pm, Jeremy Darling jeremy.darl...@gmail.com wrote: Sorry, guess it would help if I explained within :). The actual full method is: function updateControls(within){ within = within?$('#'+within):$(document); within.submit(validateForm); within.find(.datepicker).datepicker(); within.find(form).submit(validateForm); within.find(.datepicker).datepicker(); within.find('.button').each(function(){ $(this).addClass('ui-state-default'); $(this).addClass('ui-corner-all'); $(this).hover(function(){ $(this).addClass('ui-state-hover'); }, function(){ $(this).removeClass('ui-state-hover'); }); }); within.find(textarea.richtext).each(function(i, o){ CKEDITOR.replace(o.id, {uiColor: '#6F0002'}); $(o).before(a href=\#\ onclick=\toggleEditor('+o.id+'); return false;\Toggle Editor/abr /); }); within.find('.treetable').treeTable(); } So, basically I can pass a dynamic tab into the method or just let it parse the entire document. In this case its parsing the entire document. On Tue, Sep 29, 2009 at 11:29 AM, Nalum mallon.l...@gmail.com wrote: Try changing within to $('form'). I haven't come across within so I don't know anything about it. On Sep 29, 4:45 pm, Jeremy jeremy.darl...@gmail.com wrote: I have built out a fairly rhobust app using jquery and jquery-ui all was going well until we started to bring different screens together inside a tabbed interface. Seems that now when we execute our validation code on one form its checking the fields of all other forms on the page. All of my forms do have unique ID's and all elements within all forms have unique ID's. My understanding of using this.find inside of the submit event was that it should only find the forms elements am I wrong? Method that performs the actual validation: function validateForm(event){ var allOk = true; $(this).find(*[validation]).each(function(){ var elem = $(this); var val = elem.attr('validation'); var fn = elem.attr('id'); var ok = true; if(val!='') eval('ok = '+val+';'); ok = (ok)?true:false; if(allOk(!ok)) elem.focus(); if(ok) elem.removeClass('error'); else{ elem.change(function(){ var elem = $(this); var fn = elem.attr('id'); var val = elem.attr('validation'); var ok = true; if(val!='') eval('ok = '+val+';'); if(ok) elem.removeClass('error'); }); elem.addClass('error'); } allOk = allOk ok; }); this.valid = allOk; if(!allOk) if(event) event.preventDefault(); return allOk; } Initialized with (inside document.ready): within.find(form).submit(validateForm); Thanks, - Jeremy
[jQuery] Re: autocomplete
is return $.map(data, function(row) passing the json variable to data or row? it looks to me like row is an empty variable. On Sep 29, 1:13 pm, Asa Carter asa_car...@hotmail.com wrote: Hi My php is returning via json: a string (name) which is displayed in the text box an int (location_id) When the form is posted I would also like to post 'location_id' as well as / instead of 'name'. My js is below. what do I need to do to be able to post the location_id. $(#quick-search).autocomplete('/includes/search.php', { width: 300, scroll: false, dataType: json, parse: function(data) { return $.map(data, function(row) { return { data: row, value: row.location_id, result: row.name } }); }, formatItem: function(mail) { return mail.name; } }); Thanks Asa
[jQuery] Re: superfish
Goolge tracking code is the cause of that error, I've come across this before and have contacted google about it and they said it was something to do with a script on my page but the only script on my page was the google tacking code. On Sep 29, 12:52 pm, glimbeek gvanlimb...@gmail.com wrote: I may not have to do with the Superfish module, did some testing and it looks like the Google tracking code is causing the errors... not a 100% sure though. On 29 sep, 10:28, glimbeek gvanlimb...@gmail.com wrote: If I refresh my page in IE6 or IE7 I get a javascript error: Error: '_gat' is undifined. The line and the amount of chars differs at times.
[jQuery] Re: table tbody tr:last td
In the code you have pasted there you do not close your tbody tag could this be the case in your actual code? On Sep 29, 7:18 am, Xarem Nightslayer i...@ueli-banholzer.com wrote: hi I've a Problem: I have a table like this: table class=sortable id=res thead tr th123/th th123/th th123/th /tr /thead tbody tr td123/td td123/td td123/td /tr tfoot tr th123/th th123/th th123/th /tr /tfoot /table Now I made this script: $(document).ready(function() { $(table tbody tr:last td).css(border, none); }); But that doesn't work. Does anybody know why? thank you
[jQuery] Re: jQuery plugin help
Hello Karl, Thanks for the reply. I'll give that a shot when I get the chance. The way I currently write my plugin is by doing this. $.fn.extend({ pluginname: function(){ ... } }); I'll find out when I test it but I'll ask anyway, would doing $.extend({ pluginname: function(){ ... } }); be the same as doing $.pluginname = function(){ ... } Again, thanks for your help. On Sep 25, 2:38 pm, Karl Swedberg k...@englishrules.com wrote: Hi Nalum, It's pretty straightforward. Instead of doing this: $.fn.pluginname = function(args) { }; You can do this: $.pluginname = function(args) { }: --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com On Sep 24, 2009, at 10:59 AM, Nalum wrote: Hello All, I'm trying to create a plugin that I want to be able to call like $.pluginname(...) where currently I have to call the plugin like this $ (...).pluginname. Any help would be greatly appreciated. Nalum
[jQuery] jQuery plugin help
Hello All, I'm trying to create a plugin that I want to be able to call like $.pluginname(...) where currently I have to call the plugin like this $ (...).pluginname. Any help would be greatly appreciated. Nalum
[jQuery] jQuery 1.3.2 Not working at all
Hello All, I've just updated my jQuery to the latest and now I'm getting this error in firebug. [Exception... 'Syntax error, unrecognized expression: [...@rel^=collapse-]' when calling method: [nsIDOMEventListener::handleEvent] nsresult: 0x8057001e (NS_ERROR_XPC_JS_THREW_STRING) location: unknown data: no] Anyone know what it happening with this? Thanks for your help.