[jQuery] Simple Modal Height and Width
Question: Simple Modal has default height and width values of 200 and 300 pixels respectively. Is there a way to the modal conform to whatever content is present. In other words I want the modal to have height and width equal to the HxW of image modal is applied to ... automatically. Thoughts?
[jQuery] Re: Validation and Facebox
In case anyone else stumbles upon this, I will give my solution to the problem (hours later, of course). So the issue is that Facebox is using the clone() method to move the DOM elements around in $.facebox.fillFaceboxFromHref. Now a fix that worked on some of my pages was to simply using the other form of the clone() method - clone(true). Giving the boolean true tells JQuery to copy the event handlers as well as the DOM stuff. Like I said, this only worked on a couple of my pages. The final solution I came upon was to completely change how it sends the DOM element to the reveal method of Facebox. This involved changing the following things: $.extend($.facebox, { settings: { dom_data: null, dom: null, ... *add in the variables dom and dom_data in the main declaration of facebox if (href.match(/#/)) { var url= window.location.href.split('#')[0] var target = href.replace(url,'') $.facebox.settings.dom = target; $.facebox.settings.dom_data = $(target).children(); $.facebox.reveal($(target).children().show(), klass) ... *this is in fillFaceboxFromHref finally, $(document).bind('close.facebox', function() { if($.facebox.settings.dom){ $($.facebox.settings.dom).append($.facebox.settings.dom_data); $.facebox.settings.dom = null; $.facebox.settings.dom_data = null; } ... * this is at the end of the file The changes here are avoiding the cloning process entirely. Instead we are moving the elements to the Facebox and then moving them back when we close the thing. This seems to work. It looks like it is a little slower, or maybe it is just me. Hopefully this helps someone. On Feb 24, 1:57 pm, Bob O sngndn...@gmail.com wrote: Hello, Ive been using the Validation plugin on my site and it works fantastic. i have run into an issue with trying to get it to perform validation on a form that resides in a facebox. I setup the validation the same as any other form in the site. what could i be missing?
[jQuery] redirect response via ajax call
I currently wrote a quick workaround for what i want done, but i would like to see how other people would go about doing this. It is simply an ajax login form, but there is a caveat. There can be two http responses from the server: 200 OK and 302 Redirect. The 200 codes are just notifications that either the login was invalid or the user account has been deactivated, so i simply apply a javascript alert. My problem is the redirect.. ideally i would like the $.ajax object to recognize the status is 302 and then redirect to the appropriate location: This is what i have currently, as one can see i simply see if the returned data string begins with a / and then redirects otherwise do an alert(). Does anyone have a more elegant way of doing this? Also, not it is probably relevant, but i am using the django HttpResponse and HttpResponseRedirect objects. $().ready(function() { $(#login_form).submit(function(event) { event.preventDefault() var data = {} data.username = $(input[name='username'], this).val() data.password = $(input[name='password'], this).val() $.ajax({ type: POST, url: /user/login/, data: data, success: function(data, status) { s = data.substr(0,1) if (s == '/') { document.location = data } else { alert(data) } }, error: function(xhr, status, error) { alert(error) } }) }) })
[jQuery] Re: Simple click event
That worked well. Thank you. So in pseudocode this essentially says.. when document is ready: bind the event 'click' to '#thelink' invoke the href when a 'click' occurs trigger a 'click' correct? This is more for my own understanding.
[jQuery] Re: Simple click event
cool. thanks. On Sep 4, 3:03 pm, Karl Swedberg [EMAIL PROTECTED] wrote: yep. you got it. :) --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com On Sep 4, 2008, at 8:46 AM, byron wrote: That worked well. Thank you. So in pseudocode this essentially says.. when document is ready: bind the event 'click' to '#thelink' invoke the href when a 'click' occurs trigger a 'click' correct? This is more for my own understanding.
[jQuery] Simple click event
I created an email link, that I want invoked (clicked) on page load. I thought I could simply do: $().ready(function() { $(#thelink).click() }) Do I need to do something else? Thanks.
[jQuery] Re: $(document).ready(function() { giving error $ is not a function - what am I doing wrong?
You are using jQuery.noConflict() which unbinds the jquery object from the $ namespace so jQuery('a') still works on your site just $('a') does not from a cursory glace i cant see any reason for using the noConflict function, remove that and your code will work. On May 9, 12:11 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Test page here -http://www.justice.net.nz/static.html Jquery is definitely being loaded - I'm currently pulling it from jquery.com, and Firebug is showing that it has loaded. Any ideas? This is my first attempt at jquery and I'm falling at the first hurdle :
[jQuery] Re: Determining if a jQuery object is attached to an existing DOM
Hi Eric, it appears mike changed the topic Discussion subject changed to Collecting id attributes for checked input? by Mike Schinkel i think you can use the offsetParent property to check if a node is a attached to the document. $('div id=\'test\' /')[0].offsetParent === null; --Byron
[jQuery] Re: general unique id for new append element
you could use $.data() to get a unique id, something like: $.extend($.fn, { id : function () { return this.each(function () { $(this).attr(id, jQuery_ + $.data(this)); }); } }); example usage : $('div /div /div /').id().appendTo('body'); result : div id=jQuery_1/div id=jQuery_2/div id=jQuery_3/ hope this helps :)
[jQuery] Re: Help Test jQuery 1.2.2 (beta 2)
So many bug fixes! keep up the great work guys, would be nice to get these (http://dev.jquery.com/ticket/2079) fixed up though :D Merry xmas to all jQuery team/community! Byron
[jQuery] Re: Binding this inside anonymous functions
Just to clarify apply is a native javascript function implemented in 1.3 the second parameter isnt actually needed (its for defining arguments) anyway i decided to jquerify it and ended with this: (function ($) { $.extend($.fn, { apply :function (fn, args) { return this.each(function () { fn.apply(this, args); }); } }); })(jQuery); now it can be called like so: $('#example').apply(function () { alert(this.id); }); $('#example').apply(function (a, b) { alert(a + : + b); // foo : bar }, ['foo', 'bar']);
[jQuery] Re: Stupid little game :)
I won $50! xD
[jQuery] Re: Binding this inside anonymous functions
you can use apply() example : var el = $('#myDiv')[0]; var myFunc = function () { console.log(this); }; myFunc.apply(el, [{type : , target : el}]); i stumbled on this when looking through the trigger function. probably not the best use of it, however i though it might be usefull. -Byron
[jQuery] Re: jQuery Logging (to firebug)
yep, use typeof: (function($){ // block scope $.fn.log = function(msg){ if ( typeof window.console !== 'undefined' typeof console.firebug !== 'undefined'){ msg = msg || ''; if(msg !== '') msg += ': '; console.log(%s%o, msg, this); } return this; }; })(jQuery);
[jQuery] Re: JSS - New Plug-in
Yay! child selectors in ie! thank you :-)
[jQuery] Re: Creating DOM elements on the fly
I guess this is probably just a bit late (and will be even later due google not posting my replies until after 24-48 hours ) but if your interested i wrote a plugin for creating dom elements from json templates have a look at it here : http://jquery.com/plugins/project/appendDom --Byron
[jQuery] Re: Creating plugins
you probably want somthing like, jQuery.ajax_request = { ajax_options : function () { test: 'test' }, test : function() { alert(this.test); } } im guessing...
[jQuery] Re: problem using with jQuery.noConflict();
Hi John, Thanks for the interest, I followed your advice and with the help of some the friendly people on #jquery filed a ticket which you can find here: http://dev.jquery.com/ticket/1393 Thanks Byron On Jul 13, 1:52 am, John Resig [EMAIL PROTECTED] wrote: You'll have to use a separate namespace - jQuery, internally, expects the 'this' object to refer to itself - and if it's within the context of another object, it'll probably get confused. (I've never tried this personally.) That being said, I like that idea, and it would be cool if jQuery could do that. If you'd like, you can file a ticket and I can look into it.http://dev.jquery.com/ Thanks! --John On 7/11/07, Byron [EMAIL PROTECTED] wrote: Hi all, I've started using jquery in the development of a firefox extension. it works pretty well, aside from a few effects not working properly but that i can deal with (only effects i'll want will be toggle, hide etc...) anyway to the point. generally when developing extensions i like to keep all my properties and functions etc in one global namespace, im not sure if this is the best approach but its worked pretty well in the past when it comes to avoiding namespace collisions. example : var myObject = { config : { debug : true }, init : function () {..} } ; now after a bit of thought, i realised someone else might decide to use jquery in their extension or use $ for somthing else.. then i thought No Problem jQuery.noConflict() to the rescue! so off I went to try it out; myObject.$ = jQuery.noConflict(); didnt work... so then i tried some differnt combinations.. myObject.foo = jQuery.noConflict(); myObject.prototype.$ = jQuery.noConflict(); var jBuf = jQuery.noConflict(); myObject.$ = jBuf; by now i was getting frustrated (as is probably evident in this post...) So is there any way to do it like this or will i have to use a seperate namespace for jquery? TIA Byron
[jQuery] problem using with jQuery.noConflict();
Hi all, I've started using jquery in the development of a firefox extension. it works pretty well, aside from a few effects not working properly but that i can deal with (only effects i'll want will be toggle, hide etc...) anyway to the point. generally when developing extensions i like to keep all my properties and functions etc in one global namespace, im not sure if this is the best approach but its worked pretty well in the past when it comes to avoiding namespace collisions. example : var myObject = { config : { debug : true }, init : function () {..} } ; now after a bit of thought, i realised someone else might decide to use jquery in their extension or use $ for somthing else.. then i thought No Problem jQuery.noConflict() to the rescue! so off I went to try it out; myObject.$ = jQuery.noConflict(); didnt work... so then i tried some differnt combinations.. myObject.foo = jQuery.noConflict(); myObject.prototype.$ = jQuery.noConflict(); var jBuf = jQuery.noConflict(); myObject.$ = jBuf; by now i was getting frustrated (as is probably evident in this post...) So is there any way to do it like this or will i have to use a seperate namespace for jquery? TIA Byron
[jQuery] Re: problem with animate()...
hi John, worked like a treat, is there a compressed version available? On Jun 18, 5:29 pm, John Resig [EMAIL PROTECTED] wrote: Byron - You should give jQuery 1.1.3a a try. This was one of the nasty bugs that we were able to resolve in it:http://code.jquery.com/jquery-1.1.3a.js Let me know if that code helps to solve your problem. --John On 6/17/07, Byron [EMAIL PROTECTED] wrote: Thanks, I tried setting it in the call bak like so.. ... $(#imageBoxInside).animate({left: sLeft}, 'slow', function() { wait = 0; var left = parseInt($(#imageBoxInside).css(left)); if (left 0 left -(imageSize * transitionSize)) { $(#imageBoxInside).css(left, 0px); } }); ... and that works great :) But it would be nice to not have to use the hack... im still not really sure if its my code or jquery thats causing rounding error... On Jun 18, 2:28 pm, Erik Beeson [EMAIL PROTECTED] wrote: Having no actual idea and just venturing a guess, I'd say maybe there's a compounding rounding error or something? Maybe try setting the correct value after the animation has completed (via a callback)?
[jQuery] Re: problem with animate()...
Hi john, That worked great, when can we expect a compressed release? XD Byron
[jQuery] Re: problem with animate()...
Thanks, I tried setting it in the call bak like so.. ... $(#imageBoxInside).animate({left: sLeft}, 'slow', function() { wait = 0; var left = parseInt($(#imageBoxInside).css(left)); if (left 0 left -(imageSize * transitionSize)) { $(#imageBoxInside).css(left, 0px); } }); ... and that works great :) But it would be nice to not have to use the hack... im still not really sure if its my code or jquery thats causing rounding error... On Jun 18, 2:28 pm, Erik Beeson [EMAIL PROTECTED] wrote: Having no actual idea and just venturing a guess, I'd say maybe there's a compounding rounding error or something? Maybe try setting the correct value after the animation has completed (via a callback)?