[jQuery] Why does show(0,callback) not run the callback function?

2007-03-30 Thread George Adamson

Why does show(0,callback) not run the callback function?

(Looking in the jQuery 1.1 code I see that is the way it is coded)

I ran into this issue because my code chooses an animation speed of zero
when the element contains too many items to animate smoothly. I found that
the callback only fired when a speed of more than zero was chosen.

I suppose that when 0 is specified, no animation is required, so there's no
timer animation and in a way there's no need for the callback because it
could just be called by by the next command instead. This does seem
inconsistent however.

Is this feature by design? Is it here to stay?

Many thanks,

George
-- 
View this message in context: 
http://www.nabble.com/Why-does-show%280%2Ccallback%29-not-run-the-callback-function--tf3491309.html#a9750419
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] hoverIntent = my first plug-in

2007-03-22 Thread George Adamson


An excellent idea that works very elegantly. Well done Brian.

Might I suggest one more simple config setting... To optionally skip the
following check in your handleHover function: "if (p == this){return
false;}"

Why? Because I'm using hoverIntent in a hierarchical menu built with
*nested* ... elements. Without the check for "p==this" I only need
to apply hoverIntent to the top level menu (instead of all the submenus too,
and I'm working on a page with many submenus- don't ask!).

So an extra config option could be something like ignoreSubElements:true by
default then you just need to change the line in handleHover() to "if
(cfg.ignoreSubElements && p == this){return false;}"

Kind regards,
George


Brian Cherne wrote:
> 
> WHAT?
> hoverIntent is a function that attempts to determine the user's intent...
> like a crystal ball, only with mouse movement! It works like (and was
> derived from) jQuery's built-in hover. However, instead of immediately
> calling the onMouseOver function, it waits until the user's mouse slows
> down
> enough before calling the function.
> 
> WHERE?
> My sorely out-dated web site.
> 
> 
> WHY?
> To delay or prevent the accidental firing of animations or ajax calls.
> Simple timers work for small areas, but if your target area is large it
> may
> execute regardless of intent. Also, because jQuery animations cannot be
> stopped once they've started it's best not to start them prematurely. ...
> and I wanted something that was easy to swap in/out with hover (so
> hoverIntent returns the same "this" and event objects as hover).
> 
> WHAT'S NEXT?
> Your feedback! Tear it shreds! Tell me what you think. I would like to
> keep
> the script as small as possible, but if I could make this more useful (and
> more likely to be used) I'm happy to make some enhancements... like...
> - more compelling/verbose demo/documentation
> - ability to override default settings (sensitivity, polling interval,
> etc)
> - option of a simple onMouseOut timer
> - make it more jQuery $-friendly (first few attempts have failed)
> - suggestions for code style/commenting/optimization
> 
> 
> Thanks in advance,
> Brian.
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/hoverIntent-%3D-my-first-plug-in-tf3394660.html#a9610472
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] json status returns ajax

2007-03-21 Thread George Adamson

I'd recommend setting up your success handler by using 
http://docs.jquery.com/Ajax#.24.ajaxSetup.28_settings_.29 $.ajaxSetup()  I'm
not sure what effect $().ajaxSuccess will have without a selector in the $()
to work with.


George


amircx wrote:
> 
> why when i get error (status 0) its print out : "done" ?
> 
>  http://pastebin.ca/404952
> 
> i want to make if status = 0 then show errors on div, if its 1 then
> redirect to diffrent page, and if its 0 then alert somthing and stop
> script from execute...
> 
> idaes how to do it?
> 

-- 
View this message in context: 
http://www.nabble.com/json-status-returns-ajax-tf3440225.html#a9601677
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Find and Remove Elements

2007-03-21 Thread George Adamson

Hi Alex, this is easy with JQuery's filter method because these days it can
take a custom function to decide how to filter your elements:

Try something like this... (I'd also recommend a simple check to ensure
value is numeric before comparing it)

// To hide all "searchResult" DIVs containing resultPrice > 7:

$("DIV.searchResult").filter(function(){

return $("DIV.resultPrice",this).val() > 7

}).hide()

Cheers,
George


Alex Ezell-2 wrote:
> 
> I am working a page which will filter search results based on user
> input via checkboxes or sliders. The question I have is what is the
> best way to identify and remove elements based on a value. Take this
> HTML structure as an example (produced via PHP).
> 
> 
>   Turkey
>   6.95
> 
> 
> 
>   Roast Beef
>   7.95
> 
> 
> Then the user uses a slider to send the maximum price as 7.00. How
> would I, using jQuery obviously, find the elements whose resultPrice
> is higher than 7.00 and remove it from display, not totally remove it
> from the DOM, just hide it?
> 
> Essentially, I am looking at a client side filter, but I just am not
> sure how to approach it.
> 
> /alex
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Find-and-Remove-Elements-tf3441142.html#a9601469
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Set Id attribute

2007-03-12 Thread George Adamson

Hi Blitze,

In your first example you'd need to wrap 'this' like $(this) in order to use
the .attr() method. I'm surprised the second example does not work.
By the way do you really want all the matched elements to be given the same
id? Typically the id of each element should be unique. For a common sort of
identifier one might use a classname instead.

Is your code snippit running within a jQuery ready() function? Eg:
$(function(){ ...your code... })

I'd have thought the following would work...

$(function(){

// Put all your jQuery code in this $.ready() handler.

$('.shadow').attr("id", 'foo');

})

George

PS: I have to ask...is $('.shadow') actually returning any matches?!


Blitze wrote:
> 
> Hello,
> 
> I'm trying to dynamically set the id of all block elements found with
> class="shadow"  just like you can add a class dynamically using
> .addClass() but I've had no success. I've tried using:
> 
>   $('.shadow').each(function(){ this.attr("id", 'foo');});
> and
> 
>   $('.shadow').each(function(){ this.id = 'foo';});
> 
> but without any success. Would anyone be so kind to lend me a hand?
> 
> Thanks
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Set-Id-attribute-tf3384033.html#a9430078
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] wrapText plugin (to wrap html around text nodes)

2007-03-07 Thread George Adamson


wrap() and innerWrap() are available for adding html around elements but
this little plugin wraps html around text nodes:

For example:
 jQuery code: $("LI INPUT").wrapText("")
 Before: "some text"
 After:   "some text"

Note: This ignores empty text nodes or those containing just white space.
Also ignores text in any child elements.

I hope it is useful for some of you!
Cheers,
George

(Tested in IE6, FF2.0.0.1, Opera9.10)

// Plugin to wrap html around all non-empty text nodes within an element:
(ignores text in child elements)
// By George Adamson, SoftwareUnity.com, March 2007.
jQuery.fn.wrapText = function(html){
  return this.each(function(){

$(this.childNodes).filter("[EMAIL PROTECTED]").each(function(){
if($.trim(this.nodeValue).length > 0)
$(this).wrap(html)
})

  });
};

-- 
View this message in context: 
http://www.nabble.com/wrapText-plugin-%28to-wrap-html-around-text-nodes%29-tf3363574.html#a9357658
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How to add event handler to XMLHttpRequest.onreadystatechange?

2007-02-26 Thread George Adamson


Turns out that xmlhttp.onreadystatechange is *write-only* in IE6, so
attempting to read it was causing the code to barf. (Probably ok in other
browsers but this particular work is in an IE6-only intranet)

Is there any other way to set up a custom handler for the onreadystatechange
event?
Would there be any harm in overwriting JQuery's onreadystatechange handler
with my own and going from there?

Cheers,

George


Klaus Hartl wrote:
> 
> George Adamson schrieb:
>> Thanks for the code Klaus. Nice idea...
>> 
>> When I tried this, the ajax call worked but the xhr.onreadystatechange is
>> 'undefined' so I cannot do anything with it. (I got the samer error when
>> trying to use a function in the 'beforeSend' ajax argument.)
>> 
>> Does Jquery definitely return the XMLHTTP object? Or something else?
>> 
>> Cheers,
>> 
>> George
> 
> It should be the XmlHttpRequest object. This tip worked for someone else 
> if I remember correctly. What does your code look like?
> 
> 
> -- Klaus
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Can-you-add-event-handler-to-XMLHttpRequest.onreadystatechange--tf3270003.html#a9150100
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How to add event handler to XMLHttpRequest.onreadystatechange?

2007-02-22 Thread George Adamson

Thanks for the code Klaus. Nice idea...

When I tried this, the ajax call worked but the xhr.onreadystatechange is
'undefined' so I cannot do anything with it. (I got the samer error when
trying to use a function in the 'beforeSend' ajax argument.)

Does Jquery definitely return the XMLHTTP object? Or something else?

Cheers,

George


Klaus Hartl wrote:
> 
> George Adamson schrieb:
>> Hi folks,
>> 
>> Anyone know if it is possible to add a custom event handler for the
>> onreadystatechange events of JQuery AJAX calls?
>> 
>> I'm accessing a url that is slow to complete but does add to its output
>> as
>> it progresses.
>> It would be nice to be able to catch each new fragment to inform the user
>> of
>> progress.
>> 
>> I've experimented with the 'beforeSend' ajax argument to fiddle with the
>> XMLHttpRequest object's properties before making the ajax call but had no
>> luck.
>> 
>> Many thanks,
>> 
>> George
> 
> $.ajax returns the XmlHttpRequest object, thus you can do:
> 
> var xhr = $.ajax({ ... });
> xhr._cachedOnreadystatechange = xhr.onreadystatechange;
> xhr.onreadystatechange = function() {
>  xhr._cachedOnreadystatechange();
>  // do something else
> };
> 
> 
> -- Klaus
> 
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Can-you-add-event-handler-to-XMLHttpRequest.onreadystatechange--tf3270003.html#a9107770
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] How to add event handler to XMLHttpRequest.onreadystatechange?

2007-02-21 Thread George Adamson

Hi folks,

Anyone know if it is possible to add a custom event handler for the
onreadystatechange events of JQuery AJAX calls?

I'm accessing a url that is slow to complete but does add to its output as
it progresses.
It would be nice to be able to catch each new fragment to inform the user of
progress.

I've experimented with the 'beforeSend' ajax argument to fiddle with the
XMLHttpRequest object's properties before making the ajax call but had no
luck.

Many thanks,

George
-- 
View this message in context: 
http://www.nabble.com/How-to-add-event-handler-to-XMLHttpRequest.onreadystatechange--tf3270003.html#a9091489
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Enabling wildcards in .className selector

2007-02-13 Thread George Adamson

Oh silly me, thanks Klaus, excellent suggestion. That should cover most
situations.
Much simpler than fiddling with regex, and easier for others to follow!
Cheers,
George



Klaus Hartl wrote:
> 
> George Adamson schrieb:
>> Just discovered that simple wildcards can be used *without* modifying
>> jquery
>> code (phew), by using \\S* in the selector syntax...
>> 
>> Can be done like this:  $("INPUT.myClass\\S*")  will match .myClass1 and
>> .myClassHello etc.
>> 
>> This only works where selector searches in the jquery code rely on a
>> regex,
>> but it may be ok for some people.
>> 
>> Just another 2cents worth...
>> George
> 
> 
> George, couldn't you use the CSS 3 substring selector?
> 
> var $$ = $("[EMAIL PROTECTED]"myClass");
> 
> If the class name always starts with "myClass" you could also use
> 
> var $$ = $("[EMAIL PROTECTED]"myClass");
> 
> 
> -- Klaus
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Enabling-wildcards-in-.className-selector-tf3220488.html#a8945182
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Enabling wildcards in .className selector

2007-02-13 Thread George Adamson

I recently had a need for a simple wildcard in the class selector syntax.

eg: $("INPUT.myClass*") would match .myClass1 and .myClassHello etc.

As an experiment to make this work I made a small change to JQuery's code
but that is decidedly poor practice! I'd like to apply the change as a small
plugin but the section of code in question is quite long and I presume the
plugin would have to include all of it in order to replace the existing code
on the fly.

So...
- Is there an easier way to apply this small change as a plugin?
- My mod is shown below. It changes regex syntax that looks for matches in
className, the same regex appears more than once in the code so my solution
is by no means complete - it just suited my needs. A more efficient fix
would be change them all, perhaps have them generated and returned by a
small function
- Don't go thinking I suggest everyone should start modifying their copy of
the jquery code! It's just an experiment!

The code-line in question is half way through the source under the comment
"// Pre-compile a regular expression to handle class searches":
- Change from: var rec = new RegExp("(^|\\s)" + m[2] + "(\\s|$)");
- to: var rec = new RegExp("(^|\\s)" + m[2].replace('*','[a-zA-Z0-9_-]*') +
"(\\s|$)");

Cheers,
George
-- 
View this message in context: 
http://www.nabble.com/Enabling-wildcards-in-.className-selector-tf3220488.html#a8943907
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Enabling wildcards in .className selector

2007-02-13 Thread George Adamson

Just discovered that simple wildcards can be used *without* modifying jquery
code (phew), by using \\S* in the selector syntax...

Can be done like this:  $("INPUT.myClass\\S*")  will match .myClass1 and
.myClassHello etc.

This only works where selector searches in the jquery code rely on a regex,
but it may be ok for some people.

Just another 2cents worth...
George
-- 
View this message in context: 
http://www.nabble.com/Enabling-wildcards-in-.className-selector-tf3220488.html#a8943990
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] What is the best way to replace an element using JQuery?

2007-01-31 Thread George Adamson

Thanks for all your replies. Looks like everyone settled on a similar
solution using before() or after() in combination with remove().

Yep, a replace() function would be nice.
Shane - Just in case you don't already know about it, wrapInner() is
available as a plugin at http://motherrussia.polyester.se/jquery/wrapinner/  
- Perhaps you are already using it.
I agree, these two would be good in the core.

Cheers all,
George


Shane Graber - jQuery wrote:
> 
> You might try:
> 
> $("#myElement").remove().after("new element<\/div>");
> 
> It would be nice to have a replaceWith method and a wrapInner method
> in the core as I've found I need to be able to do this on a regular
> basis.
> 
> FWIW,
> 
> Shane
> 
> 
> On 1/31/07, George Adamson <[EMAIL PROTECTED]> wrote:
>>
>> Despite having used JQuery for some time and also written plugins, I've
>> never
>> discovered a good way to replace one element with another.
>>
>> Just need something like: $("#myElement").replaceWith("new
>> element")
>>
>> Depending on the circumstances I usually find I have to resort to DOM
>> methods or if myElement has no siblings then I can use
>> .parent().html("...").
>>
>> Any thoughts? Am I missing something?!
>>
>> Cheers
>>
>> George
>> --
>> View this message in context:
>> http://www.nabble.com/What-is-the-best-way-to-replace-an-element-using-JQuery--tf3148907.html#a8729470
>> Sent from the JQuery mailing list archive at Nabble.com.
>>
>>
>> ___
>> jQuery mailing list
>> discuss@jquery.com
>> http://jquery.com/discuss/
>>
> 
> 
> -- 
> -
> Bender: "Amy, you like cute things so I baked you a pony."
> -
> 
> http://www.reefs.org - Where reefkeeping begins on the internet.
> http://www.advancedaquarist.com - High quality, free monthly publication
> for
> the reef keeping hobbyist.
> http://www.aquaristcourses.org - Distance learning courses for the
> marine aquarist.
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/What-is-the-best-way-to-replace-an-element-using-JQuery--tf3148907.html#a8732952
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] What is the best way to replace an element using JQuery?

2007-01-31 Thread George Adamson

Despite having used JQuery for some time and also written plugins, I've never
discovered a good way to replace one element with another.

Just need something like: $("#myElement").replaceWith("new
element")

Depending on the circumstances I usually find I have to resort to DOM
methods or if myElement has no siblings then I can use
.parent().html("...").

Any thoughts? Am I missing something?!

Cheers

George
-- 
View this message in context: 
http://www.nabble.com/What-is-the-best-way-to-replace-an-element-using-JQuery--tf3148907.html#a8729470
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] remove in-page links with plain text

2007-01-27 Thread George Adamson

Removing self-links from a page is good plan though it will only work for
js-enabled users. Standard readers will still see the full links so this is
not a very accessible solution. Best to do it server-side if possible.

Anyway, regarding your specific questions:
> 1) "I need a way to not to add the span tag for any links under who's
> parent node is a H1."
Not sure what you mean about the span tag, sorry. Can you use .filter() or
.not() to do this?

> 2) "in need of tiding up..." 
Here's some code to simplify things a bit:

var url = document.location.href;

$("[EMAIL PROTECTED]'" + url + "']").each(function(){

var $this = $(this);
var txtEl = document.createTextNode( $this.text() );
$this.parent()[0].replaceChild(txtEl, this);

})

A word of caution: When reading A.href from code code you may find it varies
depending on the browser. It may or may not include the full url path. This
will cause it not match the document.location.href. Perhaps you could
experiment with "$=" instead of "=" in the selector syntax (see jquery
selector docs)

George


ProDevStudio wrote:
> 
> Hello everyone,
> 
> Just started using jquery. I have a situation where I have solution but
> need your help in making it do what I want.
> 
> I have a page which has many links and I want to remove the links to
> current page (i.e links to the page itself).
> 
> This is what I am after:
> ---
> before:
> .< a href="page.html">thispage ..
> ...< a href="page.html">thispage ...
> 
> after:
> .thispage..
> ...thispage...
> ---
> 
> This is what I have so far:
> 
> $(document).ready(function(){
>// if the location is same as href then remove it
> ($('[EMAIL PROTECTED]' + window.location.href + ']').size()>1)?($('[EMAIL 
> PROTECTED]' +
> window.location.href + ']').not($('[EMAIL PROTECTED]' + window.location.href +
> ']')[0]).after(''+$('[EMAIL PROTECTED]' + window.location.href +
> ']').text()+'').remove()):($('[EMAIL PROTECTED]' + window.location.href +
> ']').after(''+$('[EMAIL PROTECTED]' + window.location.href +
> ']').text()+'').remove());
> });
> 
> It works excepts 2 things:
> 
> 1) I need a way to not to add the span tag for any links under who's
> parent node is a H1. I can avoid this if I can filter all the links to
> ul>li>a items.
> 
> 2) the above code itself is looks very ugly and in need of tiding up. (I
> can tidy this easily only If I know how I can load the object into a
> variable in jquery way and use that in places instead of repeating the
> same same code over and over)
> 
> Any help is welcomed.
> 
> Thanks in advanced.
> 
> ProDevStudio
> 

-- 
View this message in context: 
http://www.nabble.com/remove-in-page-links-with-plain-text-tf3123240.html#a8666262
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Getting the optgroup for a select option

2007-01-17 Thread George Adamson

Hi Philip,

Perhaps the MoreSelectors plugin will help you:
http://www.softwareunity.com/sandbox/JQueryMoreSelectors/
The ":option-def" selector may be what you need to find option elements that
were selected by default (when page loaded).

Does that help?

George


GreyCells wrote:
> 
> Thanks George
> 
> I think the '@selected' is looking for the option that was set when the
> form was initially rendered (although, obviously, I'm not that well
> aquainted with JQuery yet). I'm after the optgroup label for the option
> selected after the user has picked a new value: As an example:
> 
> OptGroup 1
>  - Option1.1
>  - Option1.2
> OptGroup2
>  - Option2.1
>  - Option2.2
> 
> If Option1.1 is selected when the form is rendered, then I'd like to get
> '(OptGroup1)' displayed to the right of the select list. If the user then
> changes the selection to Option2.2, I'd like to display ('(OptGroup2)' to
> the right of the select list.
> 
> ~Philip
> 
> 
> George Adamson wrote:
>> 
>> I hope I've understood this correctly.
>> Perhaps try something along the lines of this in the function (not
>> tested)...
>> 
>>var myOptGrpLabel =
>> $(this).find("[EMAIL PROTECTED]").parents("OPTGROUP").attr("label");
>>/* ... do something with myOptGrpLabel... */
>> 
>> The parents("OPTGROUP") could be overkill, maybe just .parent() is enough
>> if you're sure the option elements are in an optgroup.
>> 
>> George
>> 
>> 
>> 
>> GreyCells wrote:
>>> 
>>> I'd like to be able to display the optgroup label attribute value after
>>> a select list is changed. This is what I have so far, but I think I'm
>>> heading down the wrong track, because a) I want the optgroup label
>>> value, not the selected option value and b) I don't want to keep
>>> appending if the user changes the selection more than once...
>>> 
>>> $(document).ready(function() {
>>>   $('#MySelect').change( function() { 
>>> $('#MySelect').after('('+$('#MySelect').val()+')'); 
>>>   } ) ;
>>> });
>>> 
>>> Any help would be appreciated :)
>>> 
>>> ~Philip
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Getting-the-optgroup-for-a-select-option-tf3023854.html#a8407347
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Getting the optgroup for a select option

2007-01-16 Thread George Adamson

I hope I've understood this correctly.
Perhaps try something along the lines of this in the function (not
tested)...

   var myOptGrpLabel =
$(this).find("[EMAIL PROTECTED]").parents("OPTGROUP").attr("label");
   /* ... do something with myOptGrpLabel... */

The parents("OPTGROUP") could be overkill, maybe just .parent() is enough if
you're sure the option elements are in an optgroup.

George



GreyCells wrote:
> 
> I'd like to be able to display the optgroup label attribute value after a
> select list is changed. This is what I have so far, but I think I'm
> heading down the wrong track, because a) I want the optgroup label value,
> not the selected option value and b) I don't want to keep appending if the
> user changes the selection more than once...
> 
> $(document).ready(function() {
>   $('#MySelect').change( function() { 
>   $('#MySelect').after('('+$('#MySelect').val()+')'); 
>   } ) ;
> });
> 
> Any help would be appreciated :)
> 
> ~Philip
> 

-- 
View this message in context: 
http://www.nabble.com/Getting-the-optgroup-for-a-select-option-tf3023854.html#a8400512
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] IE 7 fadeIn, fadeOut problem

2007-01-16 Thread George Adamson

Yep, Ben's right try the plugin. In some cases I found the standard JQuery
height() and width() methods adequate, but the dimensions plugin tends to be
more reliable.

Something like this should do it: (Maybe someone else can offer a shorter
technique)

$("select-my-elements").each(function(){

var $myEl = $(this);
$myEl.css({ width:$myEl.height(), height:$myEl.height() });

})

George



bmsterling wrote:
> 
> Lukas,
> Check out the demensions pluging, this should help you get the actual
> height and width real easy.
> 
> Ben
> 

-- 
View this message in context: 
http://www.nabble.com/IE-7-fadeIn%2C-fadeOut-problem-tf3018206.html#a8390355
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] IE 7 fadeIn, fadeOut problem

2007-01-16 Thread George Adamson

Hi Lukas,

I've got around problems like this in the past by ensuring you have
explicitly specified height and width on the elements before you fade them*.
Also, Show() in IE is affected when ClearType is enabled in Windows, but you
can get around this by specifying element background color (other than
transparent or blank).

If you're experiencing either of these problems then they're just mad IE/JS
quirks rather than JQuery faults.

Cheers,

George

* You can use JQuery to measure and set the width and/or height for you
before the first fade or hide.


Lukas Pitschl wrote:
> 
> hi list,
> 
> i'm terribly sorry to litter this list with all IE7 problems, but  
> unfortunately i have to have my sites working in that s browser  
> too, so i can't hesitate to ask.
> 
> fadeOut doesn't seem to work on divs if triggered twice or more  
> times. it works if only triggered once, but it seems that opacity is  
> not restored, or the opacity filter is not removed after fading out  
> and then reactivating the div with $('#some_mane').show().
> 
> is there any workaround?
> 
> thx for help
> 
> lukas
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/IE-7-fadeIn%2C-fadeOut-problem-tf3018206.html#a8386649
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How to get element when it's ID contains bank space.

2007-01-11 Thread George Adamson

Klaus is absolutely right.

If you really really really cannot get around this invalid html then seeking
the id as an @attribute seems to work, for
example: $("[EMAIL PROTECTED]'']")
Note: the inner quotes in the example are two single quotes right next to
eachother to represent an empty string. You just need to pop your ElementId
variable into the single quotes so you'll end up with something like this:
$("[EMAIL PROTECTED]'" + ElementId + "']")

Tip: Include the tag name in the query if you can (I used a DIV in my
example) for better performance, hence not like this if possible:
$("[EMAIL PROTECTED]'']")

George


Klaus Hartl wrote:
> 
> Ashish Agrawal schrieb:
>> First, Thanks for such a great library. It damn good and fast - and most 
>> of all life saver for new bees like me.
>> 
>> Recently I fall in trouble. I had an element in my HTML that may 
>> contains blank space in its ID. The thing is I am having one asp.net 
>>  based portal system where IDs are given by user on 
>> runtime that may contain spaces. Here if I use plain $("#" + ElementId) 
>> things will not work because ElementId may have "blank space" that means 
>> for jQuery engine those are 2 items passed for search.
>> 
>> Right now I have fixed it using $(document.getElementById(ElementId)) 
>> but I am really not feeling comfortable with it. Is there any other 
>> possible solution to resolve the issue?
>> 
>> Thanks,
>> Ashish Agrawal
> 
> Element ids must not have white space in it:
> http://www.w3.org/TR/html401/types.html#type-name
> 
> Scripting on top of an invalid HTML document won't make your life easier 
>   (obviously). I'd try to replace spaces given by the user to "_" in the 
> backend.
> 
> 
> -- Klaus
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-get-element-when-it%27s-ID-contains-bank-space.-tf2958527.html#a8286927
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] List of jQuery-Powered Sites

2007-01-10 Thread George Adamson

Just a little one...

We're introducing JQuery into parts of an existing bespoke travel site, for
example http://www.steppestravel.co.uk/hot-for-2007-page11.aspx where we
dynamically 'pin' postcards to a map.

Uses 'Interface' for deducing element positions and 'Metadata' for reading
pin coordinates from each destination defined in the html.

Each postcard and its coordinates are extracted from the existing static
html so the webmaster can add and change destinations as will. (Coding was
very restricted by being trapped in a clunky old CMS so the result could be
better, but does show what can be done in just a few hours.)

George


Rey Bango-2 wrote:
> 
> ...
> With the release jQuery v1.1 eminent, I'd like to begin compiling a list 
> of jQuery powered sites for posting on the jQuery site.
> ...
> 

-- 
View this message in context: 
http://www.nabble.com/List-of-jQuery-Powered-Sites-tf2947146.html#a8264876
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Need help with get()

2006-11-24 Thread George Adamson

Yes of course, silly me, I did not spot that, your second update is correct!

.get(0)  (or just [0] for short)  returns the actual dom element instead of
a jqueryised element.

So any one of these should work for you:
 - $("#my li").eq(2).text()
 - $("#my li:eq(2)").text()
 - $($("#my li")[2]).text()

As it happens, I have a thread running on 
http://www.nabble.com/Correct-way-to-get-the-nth-item--tf2694862.html#a7515463
this very topic . Doh!

George




Alexey Grischenko wrote:
> 
> George, thank you for your help but 
> I run my $("#my li").get(2).text()
> after all loaded.
> 
> I use it in one "callback" function when i have to change some data on
> page after some user actions...
> 
> so  if i try something like 
> 
> alert ($("#my li").get(2))  - i see correct  alert  "HTMLLiobject" but
> when i try 
> alert ($("#my li").get(2).text()) or   alert ($("#my li").get(2).html())
> i see just javascript error like  "text is not function"
> 
> 
> UPDATE NUMBER TWO :)
> 
> Searching save the world :
> 
> I think i found solution in 
> http://www.nabble.com/Get-attribute-form-%24%28%29-tf2336155.html#a657
> this topic 
> 
> If i understand it correct,  Jquery $(...).get(..)  return real DOM object
> but not Jquery object.  Of course in this case I can't use some Jquery
> methods right to DOM object.
> 
> 
> Is it true guys? :)
> 
> John. where are you... tell me true... :)))
> 
> PS Sorry, I just in really funny mood this morning :)
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Need-help-with-get%28%29-tf2693047.html#a7519660
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Correct way to get the nth item?

2006-11-23 Thread George Adamson

If your jquery results array is in a variable (to reuse it instead of
re-querying over and over again) then what is the best way to get the nth
item from it *without modifying the array* ?

For instance the following would cause the myElements variable to end up
containing only one item!
  var myElements = $("DIV");
  var nthElement = myElements.eq(n);

If it wasn't for the variable the options might be:
 - $("DIV").eq(n)
 - $("DIV:eq(n)")
 - $("DIV")[n]   (this one is ok if you want the html element, but I need it
wrapped as a jquery object)

These seem to be the possible solutions: (but which is most efficeient? The
third one looks simplest)
 - myElements.eq(n).each(function(){ ...do something with the nth item
here...}).end()
 - $(":eq(n)", myElements)
 - $(myElements[n])

Many thanks. George
-- 
View this message in context: 
http://www.nabble.com/Correct-way-to-get-the-nth-item--tf2694862.html#a7515463
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] :last-visible :nth-visible-child, etc.

2006-11-23 Thread George Adamson

That would be good.

I'll be interested to learn about doing selectors other than the :standard
way.
(I've always fancied a way to do axes such as parent:: in the query syntax
itself. Might that become possible?)

George


wycats wrote:
> 
> Sorry... something went wrong with my gmail. We should combine your great
> selectors with the select-by-css plugin I wrote. I'm waiting for 1.1 to
> make
> my plugin official because it requires some slight modifications to Core
> without which it's extremely difficult to add selectors other than the
> standard :whatever.
> 
> -- Yehuda
> 
> On 11/23/06, George Adamson <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>> > Perhaps you could integrate it into the other selector plugin.
>> > Blair
>>
>> Sure, I could add them to the selectors plugin if the general opinion is
>> 'yes'.
>>
>> The selectors plugin lives at
>> http://www.softwareunity.com/sandbox/JQueryMoreSelectors/
>>
>> (Probably about time I made a page for it on the jquery site!)
>>
>> George
>>
>> --
>> View this message in context:
>> http://www.nabble.com/%3Alast-visible-%3Anth-visible-child%2C-etc.-tf2690321.html#a7513623
>> Sent from the JQuery mailing list archive at Nabble.com.
>>
>>
>> ___
>> jQuery mailing list
>> discuss@jquery.com
>> http://jquery.com/discuss/
>>
> 
> 
> 
> -- 
> Yehuda Katz
> Web Developer | Wycats Designs
> (ph)  718.877.1325
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/%3Alast-visible-%3Anth-visible-child%2C-etc.-tf2690321.html#a7515199
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] :last-visible :nth-visible-child, etc.

2006-11-23 Thread George Adamson


> Perhaps you could integrate it into the other selector plugin.
> Blair

Sure, I could add them to the selectors plugin if the general opinion is
'yes'.

The selectors plugin lives at
http://www.softwareunity.com/sandbox/JQueryMoreSelectors/

(Probably about time I made a page for it on the jquery site!)

George

-- 
View this message in context: 
http://www.nabble.com/%3Alast-visible-%3Anth-visible-child%2C-etc.-tf2690321.html#a7513623
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Need help with get()

2006-11-23 Thread George Adamson

My hunch is that your code is running before the html elements have loaded.

Your 'update' to this post is the right direction to go in. Typically one
would use Jquery's cunning ready() event to tell us when the dom has loaded
enough to get going. The ready() method takes a function as a param so that
is probably why your updated code worked.

So your code would look like this:

  $(document).ready(function(){

   // Do everything inside this ready function.

alert( $("#my li").get(2).text() );

  });

You can use the shorthand syntax to make this slightly simpler:

  $(function(){

alert( $("#my li").get(2).text() );

  });

The solution you stumbled on is kind of right. Slightly less readable but
you'll soon realise the benefits
Hope this helps!

George


Alexey Grischenko wrote:
> 
> Hi!
> 
> Please  I need some help with .get method
> 
> i have some html like 
> 
> 
>  text1 
>  text2 
>  text3 
> 
> 
> I need to change "text3"
> but when i try something like 
> 
> alert ( $("#my li").get(2).html() )
> I have a error - why?
> the same thing if i try to get 
> alert ( $("#my li").get(2).text() )  and etc
> 
> it seems like the get(2)  really didn't get a the third A element
> 
> How can i  change my "text3"??
> 
> UPDATE
> 
> As i found - $($("#my li").get(2))  will work
> but..   it seems really unreadable and strange is it correct or i
> do something wrong?
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Need-help-with-get%28%29-tf2693047.html#a7513490
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Can someone please explain $() ?

2006-11-14 Thread George Adamson


As you quite rightly say, the $() 'doohickey' returns a jquery object that
is a bit like an array of zero or more html elements.
Without some help, regular javascript won't know what to do with the
doohickey, so if you need the element itself you extract it using the
.get(0) method (where 0 means you want the first item in the jquery
'array').

So you need to change you example to look like this:

  iframe = $("#editorpane") ; // Fetch a jquery array containing one
element.
  iframe.get(0).contentWindow.document.designMode = "on";

  Note: You may also see different syntax in some examples, they mean the
same thing: iframe[0] & iframe.get(0)

I hope this is what you're after

George



theteep wrote:
> 
> Hi there,
> 
> Currently writing a simple Rich Text Editor using jQuery to replace a
> . Am new to jQuery so have been learning as I go :)
> 
> In the old days, to activate an iframe for editing, one would do:
> 
> iframe = document.getElementById('editorpane') ;
> iframe.contentWindow.document.designMode = "on";
> 
> is it possible for me to replace this code and avoid using getElementById
> with
> 
> iframe = $("#editorpane) ;
> iframe.contentWindow.document.designMode = "on";
> 
> I guess my question is really what *exactly* does the $() doohickey
> return?  know that if you wrap the returned variable in $(...) then you
> can access it as a jQuery object, but if you don't do this, then can you
> use it as a normal javascript object? 
> 
> Hope this makes sense!
> 
> Mike
> 

-- 
View this message in context: 
http://www.nabble.com/Can-someone-please-explain-%24%28%29---tf2630444.html#a7345154
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] What is the best way to show() many items in sequence, one after the other?

2006-11-14 Thread George Adamson

Very handy, thanks Choan.

By the way the little code rewrite I posted uses .next() because it assumes
the elements are siblings (which was ok for my purposes).
Jorn's technique, which you also use in your code, does not have this
restriction so it is better.

George



Choan C. Gálvez wrote:
> 
> On 11/14/06, "Jörn Zaefferer" <[EMAIL PROTECTED]> wrote:
>> > If you have a jquery array of elements and need to call the
>> show("slow")
>> > method on each one in turn, how should you do it?
>> >
>> > For instance how might would you reveal each LI element in a list one
>> > after
>> > the other?
>> > Just applying the show() method reveals them all at once eg: $("#myList
>> > LI").show("slow") so that's not what I need.
>> >
>> > Using callbacks works for one or two items but does not adapt easily to
>> > many
>> > items. I saw a technique somewhere that used arguments.callee, can
>> anyone
>> > suggest how that might be used?
>>
>> My untested stab, with a callback:
>>
>> var jquery = $(/*select stuff*/),
>> position = 0;
>> var handler = function() {
>> if(position < jquey.length)
>> $(jquery[position++]).show("slow", handler);
>> };
>> handler();
>>
>> This doesn't look too bad, does it? I hope it helps.
>>
>> Not that I select the current DOM element via jquery[index] and wrap that
>> into a jQuery again. Using eq(index) would be more elegant, but kills my
>> original object, forcing me to use end().
> 
> Wow. I was working in a quite verbose plugin. Merging our ideas, here it
> is:
> 
>   (function($) {
>   $.extend($.fn, { orderedEffect: function(m, s, p, cb) {
>   p === undefined && (p = 0);
>   var col = $(this);
>   var position = 0;
>   var handler = function() {
>   if (position < col.length) {
>   setTimeout(function() {
>   
> $(col[position++])[m](s, handler);
>   }, position == 0 ? 0 : p);
>   } else {
>   typeof cb == "function" && cb();
>   }
>   };
>   handler();
>   return this;
>   }});
>   })(jQuery);
> 
> 
> Which can be called as
> 
>   $("selector").orderedEffect( effect, speed, pause, callback );
> 
> For example:
> 
>   $("div").hide().orderedEffect("fadeIn", 500, 1000, function() {
> alert("done"); });
> 
> * `effect` is the, er, effect that will be applied, passed as a String.
> * `speed` needs no explanation at all.
> * `pause` is the delay that between the end of an effect and the start
> of the next one. Optional.
> * `callback` is a function that will be called when all effects are
> finished.
> 
> By the way, the method is chainable.
> 
> I'll write a demo page tonight.
> -- 
> Choan
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/What-is-the-best-way-to-show%28%29-many-items-in-sequence%2C-one-after-the-other--tf2629186.html#a7338241
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] What is the best way to show() many items in sequence, one after the other?

2006-11-14 Thread George Adamson

Thanks Jörn, good idea, that did the trick.

With some fiddling I was able to reduce the code to look like this, so it
can be applied to any list of elements:

var showInSequence = function($el){
if($el && $el.is())
$el.eq(0).show("slow", function(){ 
showInSequence($(this).next()) } );
}

showInSequence( $("#myList LI") );

George


Jörn Zaefferer wrote:
> 
> My untested stab, with a callback:
> 
> var jquery = $(/*select stuff*/),
> position = 0;
> var handler = function() {
> if(position < jquey.length)
> $(jquery[position++]).show("slow", handler);
> };
> handler();
> 
> Jörn Zaefferer
> 

-- 
View this message in context: 
http://www.nabble.com/What-is-the-best-way-to-show%28%29-many-items-in-sequence%2C-one-after-the-other--tf2629186.html#a7337790
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] What is the best way to show() many items in sequence, one after the other?

2006-11-14 Thread George Adamson

If you have a jquery array of elements and need to call the show("slow")
method on each one in turn, how should you do it?

For instance how might would you reveal each LI element in a list one after
the other?
Just applying the show() method reveals them all at once eg: $("#myList
LI").show("slow") so that's not what I need.

Using callbacks works for one or two items but does not adapt easily to many
items. I saw a technique somewhere that used arguments.callee, can anyone
suggest how that might be used?

Many thanks,
George
-- 
View this message in context: 
http://www.nabble.com/What-is-the-best-way-to-show%28%29-many-items-in-sequence%2C-one-after-the-other--tf2629186.html#a7336748
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] New way of animating

2006-11-06 Thread George Adamson


>jQuery can do everything that it can, natively (except color animation).

Just as an aside, if anyone needs colour animation then
http://jquery.offput.ca/highlightFade/ works well for animating color,
backgroundcolor or bordercolor. (Though you might not immediately guess from
its name)

George
-- 
View this message in context: 
http://www.nabble.com/New-way-of-animating-tf2568944.html#a7200316
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Blurry Text using JQuery... But only in IE - WORKAROUND

2006-10-24 Thread George Adamson


> My problem is that the text in the JTicker plugin is coming in blurry. 

Yeah it is a bug in IE but you can workaround it by explicitly setting the
background color of the blurry elements
(to any color other than transparent)

George
-- 
View this message in context: 
http://www.nabble.com/Blurry-Text-using-JQuery...-But-only-in-IE-tf2503213.html#a6981095
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] What is the best way to queue several effects?

2006-10-17 Thread George Adamson

Thanks nezza, yeah I'm using the handy pause plugin now too, but for each
item in the jquery list I'm having to increase the pause param so that the
fx run one after the other. This gets the right effect but I'm hoping there
is a neater way of queing fx so they run in sequence (and without using
callbacks):

Currently like this:

   var p = 0;
   $("DIV").each(function(){
  $(this)
  .pause(p+=500)
  .fadeIn(500)
   });

George


nezza wrote:
> 
> Hi George,
> 
> I produced a "jQuery" version of the MooTools right-hand menu, "
> http://www.nabble.com/file/3714/sliding.htm sliding.htm ", which applied
> the .animate() to  list-items in an unordered list. It utilised the
> following plugins:
> 
> Pause: http://www.mythin.net/projects/jquery.php
> Easing: http://gsgd.co.uk/sandbox/jquery.easing.php
> 
> Is this what your after?
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/What-is-the-best-way-to-queue-several-effects--tf2455389.html#a6852355
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] What is the best way to queue several effects?

2006-10-16 Thread George Adamson

Hi there, JQuery does a great job of queuing effects on the same element(s)
but I'm not sure how to queue effects on a set of many different ones.

What is the best way to run the same fx on many items in sequence, one after
the other?

Using callbacks is fine for a couple of effects but tedious if you have many
elements to animate one after the other.

Tried:
 - Calling .queue() on a set of elements, passing a function such as
function(){ $(this).show() }
 - Using a function to do the fx, decrementing a counter and calling itself
recursively using arguments.callee(n-1)

This has been raised in quite a few threads but I've not found an answer
other than using callbacks. In the absence of an available solution I might
have to resort using .each() to set a staggered timeout for each item in the
set.

Many thanks
George
-- 
View this message in context: 
http://www.nabble.com/What-is-the-best-way-to-queue-several-effects--tf2455389.html#a6843798
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] [ANN] JReflection

2006-10-14 Thread George Adamson

Had a play with this. It adds a reflection below image elements. The effect
crops up in numerous other plugins so it is nice to have this wrapped in a
plugin of its own.

Took a moment to figure it out because I applied it to   elements at first
and got nothing.

Re-read/figured that you apply it to elements that contain   elements. Works
well after that! probably worth making it work directly on img elements too
eg $("#myImage").Reflection().

A couple of other points:
 - How do you pass the options in? Other plugins do it like this:
.Reflection(options)
 - Wrapping the image in a div is an accepted way of doing this but it does
interfere with any positioning etc that the image may have on it. I've not
seen a really good solution for this that tackles both positioned and
non-positioned images. Would it be practical to leave the image as it is and
place the reflection in a positioned div just below the image? (You may then
need to make space for the reflection otherwise it will cover elements below
the image. Extending the bottom margin of the image is a possiblity in some
scenarios.)
 - It assumes a vertical reflection.  An option for horiz reflection would
be great but I realise you may then need extra options for left and right
(then perhaps separate width & opacity options for the horiz reflection and
then top and bottom too)
 - IE can reflect other elements. Can the canvas element reflect other
elements too (text etc) ?
 - The defaults hash may clash with other plugins because it is global (just
needs "var" in front of it)

George


Rey Bango-2 wrote:
> 
> Hi Abdur. What exactly does the plugin do? Do you have a demo?
> 
> Rey
> 
> Abdur-Rahman Advany wrote:
>> Hi,
>> 
>> I have wrapped reflection.js in a jquery style function so you can just 
>> do $(#div with images of images).Reflection() and you can pass height 
>> and opacity as options.
>> 
>> http://jquery.com/docs/Plugins/JReflection/
>> 
>> I will try to make the code more jQuery style and compact...
>> 
>> I need to add a way so I can choose what array of object jQuery should 
>> return, currently the images are packed inside a div (containing both 
>> image and reflection) and the container(s) is returned. I will try to 
>> add a option or a selector to make this more controllable...
>> 
>> Abdul
>> 
>> ___
>> jQuery mailing list
>> discuss@jquery.com
>> http://jquery.com/discuss/
>> 
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-ANN--JReflection-tf2440938.html#a6808996
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Performance question

2006-10-07 Thread George Adamson


Saw you had no responses so here's a couple of suggestions...

An easy performance booster is to use the second param in $() to set a
context for the search. Eg: $("DIV.myClass", myParentElement). Perhaps this
is what you meant when you mentioned 'getting a parent element' ?

Chaining methods is helpful so you can avoid re-querying. If you need to put
other code in betwen method calls then reusing the same JQuery object by
putting it into a variable beforehand is worth while to save requerying.

If you're going to do several queries inside the same parent element(s) then
a combination of the above will be a big help.

Not sure what experience you have. You may have already tried these
approaches. Worth a try if not. Someone more involved in the development may
be able to offer some more in depth performance tips.

Cheers

George


Raziel Alvarez wrote:
> 
> Hi. I'm building a highly dynamic application based using jQuery
> extensively. I have a set of templates with predefined markup, which is
> retrieved and modified using jQuery CSS queries. However, as the markup
> size
> increases the queries are becoming considerably slow. I've tested some
> different ways of rewriting my queries (retrieving the elements by id,
> searching by name or any other attribute under a specific context, getting
> a
> parent element and traversing the DOM using operations like children(),
> etc.) but I haven't discovered a best practice so I can improve the
> performance consistently.
> 
> I also tried to use XPath queries, but they actually didn't work (even the
> simplest ones) and I think they're built as CSS queries anyway.
> 
> Can anybody point me in the right direction to write performant code with
> jQuery? I know it depends on my markup and other factors, but I wonder if
> there's a set of best practices in order to get the most of the library.
> 
> Thanks,
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Performance-question-tf2398816.html#a6697355
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Slider plugin (pre-alpha): HELP NEEDED

2006-10-05 Thread George Adamson

> 

I like the lateral thinking with the mad class names. Useful idea for custom
properties.


-- 
View this message in context: 
http://www.nabble.com/Slider-plugin-%28pre-alpha%29%3A-HELP-NEEDED-tf2389171.html#a6665229
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Slider plugin (pre-alpha): HELP NEEDED

2006-10-05 Thread George Adamson


Very nice. That'll be useful. I attempted the same thing not long ago but
got distracted onto other things.
http://www.softwareunity.com/sandbox/JQuerySlider/   (best in IE). Thought
it may be helpful to share some discoveries...

By using css alone I found there was no need to wrap the slider in any DIVs
etc. The bg image provides the button that you move (and horizontal line if
you want it). Borders could be removed too. If you need static markers to
show increments then I suppose you could add them with extra markup. I was
thinking of experimenting with a carefully positioned list-style-image for
that, but it may be too fussy.

The tricky part is translating between the ranges of the value, the slider
and the mouse pointer. I found it easier to separate these translations into
functions so that I did not have to think about them again!

Good luck

George

wycats wrote:
> 
> I've developed (or partially developed) a new plugin that implements
> webform2's slider. Specifically, you can do stuff like  step="1" min="1" max="10" value="1" id="a" /> and jQuery will
> automatically
> convert it into a stylable range widget.
> 
> It uses jQuery and Interface, but there are three problems:
> 1) There is a rounding error of some sort, such that sometimes (not
> always),
> it's tough to get the range widget to get to the last number in the range.
> 2) There's a bug in IE I can't track down.
> 3) In order to make it work, I had to multiply my values (for the
> Interface
> slider's value array) by 234. Not 200; not 255; 234. The only reason I
> know
> it works is that I did a ton of trial and error to figure out how
> SliderSetValues works, and multiplying by that linear number fixed all the
> problems I was having. Ideally, I'd like to know why this is happening.
> 
> You can check out the widget as it currently stands at:
> http://www.visualjquery.com/plugins/slider.html
> The Javascript is at: http://www.visualjquery.com/plugins/range_control.js
> 
> The pertinent HTML is in the "about" div, and the pertinent CSS (the
> little
> that there is) is the CSS related to #a, #b, and #c.
> 
> Please help!
> 
> -- 
> Yehuda Katz
> Web Developer | Wycats Designs
> (ph)  718.877.1325
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 
Quoted from: 
http://www.nabble.com/Slider-plugin-%28pre-alpha%29%3A-HELP-NEEDED-tf2389171.html#a6660725


wycats wrote:
> 
> I've developed (or partially developed) a new plugin that implements
> webform2's slider. Specifically, you can do stuff like  step="1" min="1" max="10" value="1" id="a" /> and jQuery will
> automatically
> convert it into a stylable range widget.
> 
> It uses jQuery and Interface, but there are three problems:
> 1) There is a rounding error of some sort, such that sometimes (not
> always),
> it's tough to get the range widget to get to the last number in the range.
> 2) There's a bug in IE I can't track down.
> 3) In order to make it work, I had to multiply my values (for the
> Interface
> slider's value array) by 234. Not 200; not 255; 234. The only reason I
> know
> it works is that I did a ton of trial and error to figure out how
> SliderSetValues works, and multiplying by that linear number fixed all the
> problems I was having. Ideally, I'd like to know why this is happening.
> 
> You can check out the widget as it currently stands at:
> http://www.visualjquery.com/plugins/slider.html
> The Javascript is at: http://www.visualjquery.com/plugins/range_control.js
> 
> The pertinent HTML is in the "about" div, and the pertinent CSS (the
> little
> that there is) is the CSS related to #a, #b, and #c.
> 
> Please help!
> 
> -- 
> Yehuda Katz
> Web Developer | Wycats Designs
> (ph)  718.877.1325
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Slider-plugin-%28pre-alpha%29%3A-HELP-NEEDED-tf2389171.html#a6661610
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] How can one add httpheaders or cookies to $.ajax() request?

2006-10-05 Thread George Adamson

What is the best way to add a custom httpheader and/or cookie info to a
$.ajax() request?

Many thanks,

George

PS: The http://jquery.com/api/ doc for ajax() differs slightly from the
$.ajax() functionlality in the current jquery release.

-- 
View this message in context: 
http://www.nabble.com/How-can-one-add-httpheaders-or-cookies-to-%24.ajax%28%29-request--tf2388404.html#a6658459
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How should :nth-of-type work?

2006-10-03 Thread George Adamson

Good point J?rn, thank you. (I've not found a good use for :nth-of-type()
myself, but someome will!)

More interesting as it turns out, is the :nth-sibling-of-type() selector
that I created accidentally...
It turns out to be a simple way of returning TD elements in the same column
of a table.

Here are two examples on a form and a table:
http://www.softwareunity.com/sandbox/JQueryMoreSelectors/nth-of-type/

Original test page is here:
http://www.softwareunity.com/sandbox/JQueryMoreSelectors/

George


J?rn Zaefferer wrote:
> 
> Do you have an example at hand where this selector is actaully useful?
> 
> -- J?rn
> 

-- 
View this message in context: 
http://www.nabble.com/How-should-%3Anth-of-type-work--tf2375279.html#a6621407
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] How should :nth-of-type work?

2006-10-03 Thread George Adamson

Just canvassing opinions on the :nth-of-type() selector that is in now being
tested in the  http://www.softwareunity.com/sandbox/JQueryMoreSelectors/
Selectors Plugin  (plus other ...-of-type selectors).

At face value it would 
http://www.nabble.com/nth-of-type-not-working-in-some-cases-tf2356344.html#a6571942
appear to be the same as :eq()  but I think there's more to it...

In a JQuery set containing 3 DIVs and 3 SPANs (#div0, #div1, #div2, #span0,
#span1 #span2),
I would expect :eq(1) to return only div1, but :nth-of-type(1) to return
div1 and span1.
Does this seem correct to you?

Taking it a step further, if the set also contains another 3 DIVs (#divX,
#divY, and #divZ) that are not siblings of div0,1,2 (ie they have different
parents) then my current implementation of :nth-of-type(1) will return div1,
span1 and divY. I think I've done it wrong. Should it still return only div1
and span1? I think I've done :nth-sibling-of-type() by mistake!

Thanks for you help,

George




-- 
View this message in context: 
http://www.nabble.com/How-should-%3Anth-of-type-work--tf2375279.html#a6617459
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Chainable if/else - hot or not?

2006-10-01 Thread George Adamson


Very useful. One thought: It might be nice to allow the elseCallback to run
even when ifCallback is not provided.

George


J?rn Zaefferer wrote:
> 
> Hi folks,
> 
> the thread about showing and hiding DDs when clicking DTs gave me an 
> idea for a chainable if/else construct. I have implemented and tested it 
> and now I'd like to know if this is useful enough to be released as a 
> plugin or even adding to the core.
> 
> Basically I extended the current is(String expression) method. It now 
> accepts one or two functions. If one is given, it will be executed for 
> every element that fits the expression. If the second function is given, 
> it will be executed for every element that does not fit the expression.
> 
> Applied to the click dt to show/hide dd example:
> $(document).ready(function() {
> $('#faq').find('dd').hide().end().find('dt').click(function() {
> $(this).next().is(':visible',
> function() { $(this).slideUp(); },
> function() { $(this).slideDown(); }
> );
> });
> });
> 
> The extended is method looks like this:
> is: function(expr, ifCallback, elseCallback) {
> if(ifCallback) {
> var elseCalllback = elseCallback || function() {};
> return this.each(function() {
> if($(this).is(expr)) {
> ifCallback.apply(this);
> } else {
> elseCallback.apply(this);
> }
> });
> }
> return expr ? jQuery.filter(expr,this).r.length > 0 : false;
> },
> 
> The strength of this addition: is() returns the jQuery object, therefore 
> it does not break the chain. Your opinions?
> 
> -- J?rn
> 
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Chainable-if-else---hot-or-not--tf2363128.html#a6592731
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] 3D Carousel

2006-09-30 Thread George Adamson



Stefan Petre wrote:
> 
> http://interface.eyecon.ro/development/demos/carousel.html
> 

superb!
-- 
View this message in context: 
http://www.nabble.com/3D-Carousel-tf2362646.html#a6582364
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] next()

2006-09-29 Thread George Adamson


Yep, XPath will take you up the dom and down again but you'll still need to
use a method to get to the next row.

An advantage of Blair's example is that by using .parents() we do not have
to know how deep 'this' is within the TR. If the link is definately a child
of the TD then you could use something like:

$("../..", this).next().find("td:eq(" + $("..", this).index() + ")"
).doYourThing()

(There may be a more concise way to get the desired td!)

George


Glen Lipka wrote:
> 
> Also there is xPath or a combo solution.
> Hmm, the site seems down.  Anyway, click on the xPath link on the right
> when
> you look at the documentation. (not the API)
> 
> 
> On 9/29/06, Blair McKenzie <[EMAIL PROTECTED]> wrote:
>>
>> Here's a stab. Could probably be simplified.
>> $(this).parents("tr").next().find("td:eq(index of td)").doYourThing()
>>
>> On 9/20/06, John Malaby <[EMAIL PROTECTED]> wrote:
>> >
>> > Hi there,
>> > I am hoping one of you can help me in what seems a simple issue, but I
>> > have
>> > been on this most of the day now.
>> > I have a table with data in it, along with cell that has a link in it,
>> > the
>> > link should toggle another cell that is found further in the table.
>> I've
>> >
>> > tried many ways of referencing the td but with no success. I've tried
>> > with
>> > next(), siblings() next(".description") and no success.
>> >
>> > Can someone please point out how I would reference from a link that is
>> > inside a td to toggle another td that is in another row?
>> >
>> > thanks in advance
>> >
>> >
>> >
>> > ___
>> > jQuery mailing list
>> > discuss@jquery.com
>> > http://jquery.com/discuss/
>> >
>>
>>
>> ___
>> jQuery mailing list
>> discuss@jquery.com
>> http://jquery.com/discuss/
>>
>>
>>
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/next%28%29-tf2356342.html#a6566938
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] slideUp / slideDown and nested divs

2006-09-29 Thread George Adamson


Hi Mike,

You just need to tweak the JQuery syntax a little to refer to 'this' instead
of e.target:

Change from:

$("a.folder").toggle(function(e) {
   $(e.target).parent().next().slideDown('fast');
}, function(e) {
   $(e.target).parent().next().slideUp('fast');
});

To

$("a.folder").toggle(function(e) {
   $(this).parent().next().slideDown('fast');
}, function(e) {
   $(this).parent().next().slideUp('fast');
});

JQuery very cleverly makes 'this' available to your functions. You'll no
longer need the 'e' event parameter.

You can also do away with the parent() method like this $("..",
this).next().slideUp('fast')

Cheers,

George



Mika Tuupola wrote:
> 
> While converting from prototype + script.aculo.us to jQuery +  
> interface I now have a problem with nested divs and slideUp /  
> slideDown functions. To me it seems these efects don't transfer the  
> heigh to parent div. Check these two examples.
> 
> initially display: none;
> http://www.appelsiini.net/~tuupola/jquery/slideupdown/slideupdown.html
> 
> initially display: block;
> http://www.appelsiini.net/~tuupola/jquery/slideupdown/slideupdown2.html
> 
> Is this problem more with html or with jQuery?
> 
> -- 
> Mika Tuupola
> http://www.appelsiini.net/~tuupola/
> 
> 
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/slideUp---slideDown-and-nested-divs-tf2357182.html#a6566750
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] nth of type not working in some cases

2006-09-29 Thread George Adamson


>As Blair suggested, :nth-of-type was replaced by :eq, therefore I'm not
sure if that addition in your plugin really provides more value.

I thought the same initially, but when I researched further I found that
:eq() will give us the nth item in the set, but :nth-of-type will give us
the nth of each different type of item in the set.

Example: Our JQuery set contains 3 divs and 3 spans: #div0, #div1, #div2,
#span0, #span1 #span2.
Expected results: eq(1) will give us only div1, but :nth-of-type will give
us div1 and span1.

I hope this illustrates the difference. As far as I can figure, that's how
it's meant to work. That said, I have not found a use for it yet!

George


-- 
View this message in context: 
http://www.nabble.com/nth-of-type-not-working-in-some-cases-tf2356344.html#a6572206
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] this list

2006-09-29 Thread George Adamson

This is probably what you're looking for...

http://jquery.com/mailman/listinfo/discuss_jquery.com

George


volatileservers wrote:
> 
> Hello list, may I know how can I unsubscribe from the list.
> 
> Thank you very much for your help
> 
> volatile
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/this-list-tf2356880.html#a6565002
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] nth of type not working in some cases

2006-09-29 Thread George Adamson

The :nth-of-type selector is not in the current jQuery Base. Perhaps it was
once.

As luck would have it I added :nth-of-type to my Selectors Plugin yesterday
and I'd love it if you could try it out.

JS file:
http://www.softwareunity.com/sandbox/JQueryMoreSelectors/JQuery.moreSelectors.js
Demo: http://www.softwareunity.com/sandbox/JQueryMoreSelectors/

(It is commented as 'work in progress' in the script because while it seems
to work I have not yet tested it aggresively.)

I also added :blur yesterday, to find the element that last had the focus,
such as after clicking submit. Also in progress are :only-of-type,
:first-of-type, :last-of-type and :in-view. (The latter being an ambitious
experiment to return elements that are currently in the visible portion of
the browser window, ie not scrolled out of view). Full list in the js file.


Blair McKenzie-2 wrote:
> 
> Try
> var fileName = $("[EMAIL PROTECTED]:eq("+n+")").val();
> 
> On 9/19/06, Sure Fire <[EMAIL PROTECTED]> wrote:
>>
>> On my jquery tutorial site, I updated to the latest version of jquery
>> and a demo that was working prior is no longer functioning.  I've done
>> my best to narrow it down to this line:
>>
>> var fileName = $("[EMAIL PROTECTED]:nth-of-type("+n+")").val();
>>
>>
>>
>>
>> Full code is here:
>> http://15daysofjquery.com/examples/multiFile/demo2.php
>>
>> Thank you for your assistance.
>>
>>
>>
>> ___
>> jQuery mailing list
>> discuss@jquery.com
>> http://jquery.com/discuss/
>>
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/nth-of-type-not-working-in-some-cases-tf2356344.html#a6564908
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] SpinButton Plugin updated

2006-09-28 Thread George Adamson

Apologies Mark (Gibson) I've had mails from two Marks on this topic and I got
your surnames muddled. Sorry.
(the other Mark was working on SpinButton improvements too)

I've corrected your name on this post and in the JQuery Plugins page.

Thanks again, great stuff,

George


Mark Gibson-8 wrote:
> 
> George Adamson wrote:
>> The SpinButton / SpinBox Plugin has been updated with heaps of
>> improvements
>> by a splendid chap from this forum named Mark Lincoln.
> 
> It's Mark _Gibson_ :)
> 
>>  - Mark - Thanks for the code update. Great stuff. It pretty much worked
>> as-is. All I've added are checks to stop it barfing when the
>> options-parameter is not provided.
> 
> Thanks for the original Spin Button, it's come in very handy.
> 
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/SpinButton-Plugin-updated-tf2347123.html#a6546250
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] SpinButton Plugin updated

2006-09-28 Thread George Adamson


Great. How is the widget pack going? Are you attempting to unify the various
authors' coding techniques or is the priority simply to get them together in
one place/plugin?

George


wycats wrote:
> 
> It's also a "widget" that might be featured in the jQuery widget pack I'm
> putting together.
> 
> -- Yehuda
> 

-- 
View this message in context: 
http://www.nabble.com/SpinButton-Plugin-updated-tf2347123.html#a6544647
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] SpinButton Plugin updated

2006-09-27 Thread George Adamson


Good point! (I've now added the link to my previous post for the benefit of
nabble users)

http://www.softwareunity.com/sandbox/JQuerySpinBtn/


Matt Stith wrote:
> 
> Ooohhh this could be usefull in an upcoming project, you got a link
> please?
> 

-- 
View this message in context: 
http://www.nabble.com/SpinButton-Plugin-updated-tf2347123.html#a6534909
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] SpinButton Plugin updated

2006-09-27 Thread George Adamson

The SpinButton / SpinBox Plugin has been updated with heaps of improvements
by a splendid chap from this forum named Mark Lincoln.

The SpinButton Plugin takes ordinary  boxes and turns
them into SpinButton controls using just css and JS/JQuery. No extra markup
is added so the textbox submits and otherwise conducts its life just like
any other.

Usage: $("#myInputElement").SpinButton(mySpinButtonOptions)

Cheers all,

George

 - Mark - Thanks for the code update. Great stuff. It pretty much worked
as-is. All I've added are checks to stop it barfing when the
options-parameter is not provided.

Original forum post:
http://www.nabble.com/JQuery-Plugin%3A-SpinBox---SpinButton-Control-%28with-no-extra-markup%29-tf2091766.html#a5765856

-- 
View this message in context: 
http://www.nabble.com/SpinButton-Plugin-updated-tf2347123.html#a6534690
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] New Selectors plugin: Adds :focus, :modified, :input, :text etc

2006-09-27 Thread George Adamson

They're in the svn? Great. I'll take them out of my plugin in that case.



J?rn Zaefferer wrote:
> 
>> 
>> Simple  http://www.softwareunity.com/sandbox/JQueryMoreSelectors/
>> selectors
>> plugin  to add more specific query :selectors to JQuery.
> 
> Actually :input, :text etc. are already in SVN. But :input doesn't select
> button elements, I need to add that.
> :focus and :modified are great additions, good job.
> 
> -- J?rn
> -- 
> Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
> Ideal f?r Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/New-Selectors-plugin%3A-Adds-%3Afocus%2C-%3Amodified%2C-%3Ainput%2C-%3Atext-etc-tf2343998.html#a6527567
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] New plugin: Extra :selectors such as :focus, :modified, :input, :text

2006-09-27 Thread George Adamson

Simple  http://www.softwareunity.com/sandbox/JQueryMoreSelectors/ selectors
plugin  to add more specific query :selectors to JQuery.

Adds things like:

- $("FORM/*:modified") - To find form elements that have been changed or
selected by the user.

- $("FORM/*:focus") - To find the element that has the focus.

- $("FORM/*:text") - To find texty elements (textarea & input type=text).

And more. Full list and demo at
http://www.softwareunity.com/sandbox/JQueryMoreSelectors/

Note: There have been numerous discussions in the forums about which
selectors are more important in Base and which would be confusing etc. This
plugin aims to separate the bloat for those who want it! Very sensibly, the
Base has been kept uncluttered by keeping out these sort of things.

Cheers all,

George


-- 
View this message in context: 
http://www.nabble.com/New-plugin%3A-Extra-%3Aselectors-such-as-%3Afocus%2C-%3Amodified%2C-%3Ainput%2C-%3Atext-tf2343998.html#a6524425
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Suggestion: add iframe hack to core jQuery

2006-09-26 Thread George Adamson

Thanks Brandon, I'll give it a go. Looks like most of it will convert to
JQuery ok.

I know from my own experiments how much effort you must have put into this!

George


Brandon Aaron wrote:
> 
> Hey I've gone through the trouble already once before of getting an
> acurate reading of the x and y coordinates of an element
> cross-browser. I even wrote all the unit tests. It is painful! Anyways
> it is specific to prototype for now but could easily be optimized and
> convered to be jQuery-like. I don't really have the time as of right
> now, so this code is open to anyone that would like to convert it to a
> plugin.
> 
> http://www.brandonaaron.net/articles/2006/08/10/prototype-extensions-element-getoffset
> 
> Brandon
> 
> 
> On 9/26/06, George Adamson <[EMAIL PROTECTED]> wrote:
>>
>> Nice idea. Quite a few plugins would find that useful.
>>
>> Another useful funtion would be a method to return the x,y (left,top)
>> coordinates of any element (relative to the page or some specified
>> element).
>> The classic iteration through offsetParent elements would be a good start
>> but runs into problem with relatively positioned elements etc, and IE's
>> own
>> very special box model. Perhaps someone has a solution for this. I've
>> been
>> working on one gradually but I'm not there yet! (Very much
>> http://www.softwareunity.com/sandbox/JQueryElemXY/ work in progress !)
>>
>> I dare say there are plenty more 'useful' functions. You guys are doing a
>> great job of regulating what should be in the core and what should not.
>> Maybe someone will do a 'handyExtras' plugin some day ;)
>>
>> Cheers,
>>
>> George
>>
>>
>> Mark Gibson-8 wrote:
>> >
>> > Hi,
>> > I was thinking that due to it being such a common problem, I'd like to
>> > suggest adding the iframe hack for IE to the jQuery core.
>> > (To hide  elements beneath a positioned element)
>> >
>> > The plugin below appends an iframe with the necessary css so that you
>> > don't need any messy hacks in your normal CSS stylesheets.
>> >
>> > I've made use of IE's CSS expression() to resize the iframe to match
>> the
>> > parent element - the previous suggestions of 3000px caused select's to
>> > the left or below to disappear.
>> >
>> > I've only tested in IE6, will it work in IE 5/5.5?
>> > Is it needed for IE7?
>> >
>> > $.fn.iframehack = function() {
>> >   if ($.browser.msie)
>> >   return this.append('> >
>> style="display:block;position:absolute;top:0;left:0;z-index:-1;filter:mask();width:expression(this.parentNode.offsetWidth);height:expression(this.parentNode.offsetHeight)"/>');
>> >   else
>> >   return this;
>> > };
>> >
>> > ___
>> > jQuery mailing list
>> > discuss@jquery.com
>> > http://jquery.com/discuss/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Suggestion%3A-add-iframe-hack-to-core-jQuery-tf2337605.html#a6506401
>> Sent from the JQuery mailing list archive at Nabble.com.
>>
>>
>> ___
>> jQuery mailing list
>> discuss@jquery.com
>> http://jquery.com/discuss/
>>
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Suggestion%3A-add-iframe-hack-to-core-jQuery-tf2337605.html#a6507523
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Suggestion: add iframe hack to core jQuery

2006-09-26 Thread George Adamson

Nice idea. Quite a few plugins would find that useful.

Another useful funtion would be a method to return the x,y (left,top)
coordinates of any element (relative to the page or some specified element).
The classic iteration through offsetParent elements would be a good start
but runs into problem with relatively positioned elements etc, and IE's own
very special box model. Perhaps someone has a solution for this. I've been
working on one gradually but I'm not there yet! (Very much 
http://www.softwareunity.com/sandbox/JQueryElemXY/ work in progress !)

I dare say there are plenty more 'useful' functions. You guys are doing a
great job of regulating what should be in the core and what should not.
Maybe someone will do a 'handyExtras' plugin some day ;)

Cheers,

George


Mark Gibson-8 wrote:
> 
> Hi,
> I was thinking that due to it being such a common problem, I'd like to
> suggest adding the iframe hack for IE to the jQuery core.
> (To hide  elements beneath a positioned element)
> 
> The plugin below appends an iframe with the necessary css so that you
> don't need any messy hacks in your normal CSS stylesheets.
> 
> I've made use of IE's CSS expression() to resize the iframe to match the
> parent element - the previous suggestions of 3000px caused select's to 
> the left or below to disappear.
> 
> I've only tested in IE6, will it work in IE 5/5.5?
> Is it needed for IE7?
> 
> $.fn.iframehack = function() {
>   if ($.browser.msie)
>   return this.append(' style="display:block;position:absolute;top:0;left:0;z-index:-1;filter:mask();width:expression(this.parentNode.offsetWidth);height:expression(this.parentNode.offsetHeight)"/>');
>   else
>   return this;
> };
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Suggestion%3A-add-iframe-hack-to-core-jQuery-tf2337605.html#a6506401
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] XPath Axes: ancestor(-or-self) / parents / descendent / children

2006-09-25 Thread George Adamson

I'm interested to know how to extend the selector syntax to accept things
like axis definitions etc. (I know from the forum that we should be using
the .parents() methods etc but I'd like to extend the selector syntax
myself.)

While the .parent() and .children() methods etc work very well when combined
with the excellent XPath-style selector support, I'm finding many situations
where axis selectors such as ancestor:: and ancestor-or-self:: etc (or a
shorthand) would be very useful in the selector expression itself as an
alternative. (Note: The "//" syntax is already a good way to do some
descendent:: like functionality.)

I'm gradually building up a simple 'selectors' plugin to add selectors that
are not in the core. Another kind member has already explained how to add to
the :expr selectors so I have already developed :focus and :hover, with more
on their way (such as those in the docs pages that are not actually in the
current jquery release).

Please note that I'm not trying to restart this debate, I'm just after info
on the best way to provide axis filters in the expression strings. Adding to
the :expr is easy enough because they just need to return true or false. I
just can't figure out how to enable axis:: selectors.

Many thanks,
George Adamson
-- 
View this message in context: 
http://www.nabble.com/XPath-Axes%3A-ancestor%28-or-self%29---parents---descendent---children-tf2331493.html#a6486088
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Help finding parent element

2006-09-24 Thread George Adamson

Good point about using $("../",this) as an alternative to using
$(this).parent(), though I've noticed that the syntax should be $("..",this)
to return the parent, while $("../",this) returns siblings. Does this sound
right?

Cheers,

George Adamson


Glen Lipka wrote:
> 
> Parent() works, and also xPath expressions: (damn, jquery has so much
> power
> on traversal)
> refer to: http://jquery.com/docs/Base/Expression/XPath/
> 
> Example: $("../",this) should get the parent too.
> 
> It actually would really help "Getting Started" if someone would write a
> bunch (like 100) of common traversal examples.  There are a bunch of
> examples on several different sites, but they lack explanation of what
> they
> are doing. (Like the URL above).  A traversal cheat sheet! :)
> 
> On thing that has REALLY helped me is to use MS Script Editor.  You put
> the
> word debugger; in your code and then use the watch word functionality to
> explore the jQuery object.  So you can type in anything like $("../",this)
> and see what that gives you.  Easy to play around and see what hits what
> node.
> 
> Hope this helps.
> 
> Glen
> 
> On 9/23/06, Rey Bango <[EMAIL PROTECTED]> wrote:
>>
>> I'm just getting into the ins and outs of JQuery but I believe you can
>> use the .parent() method to do that. Something like this:
>>
>> $("p").parent()
>>
>> HTH.
>>
>> Rey...
>>
>> Bruce McKenzie wrote:
>> > What's the preferred/simplest way to get hold of the immediate parent
>> of
>> > a DOM element?
>> >
>> > I've got a table in which some cells are editable (I'm using the
>> > excellent editable plugin by Dylan Verheul). When a cell is changed,
>> the
>> > database gets updated and the Ajax callback needs to recalculate the
>> sum
>> > of the cells in the row.
>> >
>> > So, I have this in the editable object:
>> >
>> >  callback:function(){
>> >  recalcEstimate ( myCell ) ;
>> > // myCell is jQuery obj containing one TD tag
>> >  }
>> >
>> > and this is what gets called:
>> >
>> > function recalcEstimate(myCell){
>> > var myRow = myCell[0].parentNode;
>> > // this seems weird, but I couldn't retrieve the DOM element
>> > // I want from anything like "myCell.parent()"
>> > var total=0;
>> > $( 'td.editable', myRow ).each(function(){
>> >var aNum = $( this ).text();
>> >total += Number(aNum) ;
>> > });
>> > $(myRow).find('.total').html( total.toFixed(1)  ) ;
>> > }
>> >
>> > This works -- but I don't think I've seen any code written by someone
>> > who knows what they are doing (e.g., in the plugins or tutorials) that
>> > looks like this :-)
>> >
>> > What's the "best practice"?
>> >
>> > Bruce
>> > http://www.2MinuteExplainer.com
>> >
>> > ___
>> > jQuery mailing list
>> > discuss@jquery.com
>> > http://jquery.com/discuss/
>> >
>>
>> ___
>> jQuery mailing list
>> discuss@jquery.com
>> http://jquery.com/discuss/
>>
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Help-finding-parent-element-tf2324683.html#a6476467
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Is the forms plugin documented anwhere

2006-09-23 Thread George Adamson

Great info on ajax and forms. Is there any documentation on the forms plugin?

John mentions forms docs in the  http://jquery.com/dev/svn/plugins/ plugins
page  but I've not managed to find them.

Cheers,

George



malsup wrote:
> 
>> Any chance of a link to it?
> 
> The form plugin is available here:
> http://jquery.com/dev/svn/plugins/form/form.js?format=txt
> 
> Sample usage can be found here:
> http://malsup.com/jquery/form/
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Ajax-numpty%2C-stumbling-around-tf2317327.html#a6466257
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] fadeIn() changes display to 'block'

2006-09-22 Thread George Adamson

It would seem that the fadeTo() method changes the element.style.display to
'block'.

Is this by design? It messes up inline elements.

One workaround for the time being might be to wrap an inline element inside
another before fading it.

Cheers,

George



DaveG-2 wrote:
> 
> 
> I was looking at the code trying to understand why extra space is added
> after using FadeIn/Out, and also why setting properties of "visibility"
> after using fadeIn/Out doesn't work. The code is a little tough to follow,
> but it seems that the hide/show functions set the display property to
> block. According to http://www.w3schools.com/css/pr_class_display.asp this
> *adds* a newline element.
> 
> Question: why do show/hide set the display attribute? Why not use
> "visibility"?
> 
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/FadeIn-IssuesBlocks--tf1755895.html#a6448536
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] toggleClass and removeClass

2006-09-21 Thread George Adamson

Hello Mark,

Nice to see this bug progressing. A search on keywords "
http://www.nabble.com/forum/Search.jtp?forum=15494&local=y&query=classname+space
classname space " in the Nabble jquery forum reveals that quite a few of us
have reported this in one form or another.

Cheers,

George


Mark D. Lincoln wrote:
> 
> I have found a couple of fixes for the problem of using toggleClass and
> removeClass in Internet Explorer (IE).  It seems the root of the problem
> is
> that when you have multiple classes assigned to the className property of
> an
> element in IE ("class1 class2") and you remove one of the classes from the
> className property, you can be left with a className property containing
> classes with leading spaces (" class2").  What is even worse, if you
> remove
> both classes multiple times, you can end up with the className property
> containing just blank spaces ("").  It is these leading spaces which
> are
> causing toggleClass and removeClass to fail with multiple classes assigned
> to the className property.  This problem does not seem to exist in Firefox
> since it seems to remove leading and trailing spaces when the className
> property is changed.
> 
>  
> 
> After doing some research, I have come up with two possible solutions. 
> The
> first solution involves modifying the regular expression used to remove
> the
> class from the className property.  On line 345 of the jQuery source code,
> you will find the following:
> 
>  
> 
> new RegExp("(^|\\s*\\b[^-])"+c+"($|\\b(?=[^-]))", "g"), "") ); 
> 
>  
> 
> Change the regular expression to the following:
> 
>  
> 
> new RegExp("(^\\s*\\b[^-]|)"+c+"($\\b(?=[^-])|)", "g"), "") ); 
> 
>  
> 
> Note the position of the pipe (|) characters.  This solution will enable
> the
> removal of the specified class from the className property in IE, however,
> it does not solve the problem of the extra spaces.  Although the class
> being
> toggled or removed can now be found within the className property, the
> className property will continue to grow with extraneous blank spaces each
> time a class is removed.  The blank spaces do not seem to cause any short
> term problem, however, they might if the user uses the Web application for
> more than a short period.
> 
>  
> 
> The other solution is more of a sledgehammer approach as it involves
> removing the extraneous blank spaces from the className property anytime a
> class is removed.  This solution involves trimming the spaces from the
> className during the class removal.  On lines 343 to 345 of the jQuery
> source code you will see the following implementation of the "remove"
> method
> of the className property:
> 
>  
> 
> o.className = !c ? "" :
> 
>o.className.replace(
> 
>   new RegExp("(^|\\s*\\b[^-])"+c+"($|\\b(?=[^-]))", "g"), "");
> 
>  
> 
> If you change this code to use the "trim" method of the jQuery class, you
> will have the following:
> 
>  
> 
> o.className = jQuery.trim( !c ? "" :
> 
>o.className.replace(
> 
>   new RegExp("(^|\\s*\\b[^-])"+c+"($|\\b(?=[^-]))", "g"), "") );
> 
>  
> 
> This solution does not require changing the regular expression since the
> extraneous spaces will no longer appear within the className property. 
> This
> is the solution I am currently using, however, if someone has a better
> solution, please let me know.
> 
>  
> 
>  
> 
> Mark D. Lincoln
> 
>  
> 
> Mark D. Lincoln, Director of Research & Development
> 
> Eye On Solutions, LLC
> 
> (866) 253-9366x101
> 
> www.eyeonsolutions.com
> 
>  
> 
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/toggleClass-and-removeClass-tf2313152.html#a6432990
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] highlightFade Plugin

2006-09-21 Thread George Adamson

These may give you some ideas...

You can either use JQuery's own .fadeIn() method or try the highlightFade as
follows:


$("INPUT")
.focus(function(){
$(this)
.highlightFade({start:'white', end:'black', 
speed:'fast', attr:'color'})
.highlightFade({start:'white', end:'silver', 
speed:'fast',
attr:'borderColor'})
.highlightFade({start:'white', end:'yellow', 
speed:'fast',
attr:'backgroundColor'})
})
.blur(function(){
$(this)
.highlightFade({start:'black', end:'white', 
speed:'fast', attr:'color'})
.highlightFade({start:'silver', end:'white', 
speed:'fast',
attr:'borderColor'})
.highlightFade({start:'yellow', end:'white', 
speed:'fast',
attr:'backgroundColor'})
})

This will fade-in input elements on focus and fade-out on blur. For
completeness I have faded the color, background color and the borderColor.
Depends what effect you're after really. (Bright yellow might not be you
thing!)

Hope this helps

George



Mark Harwood-2 wrote:
> 
> I am loving this Plugin... but im a bit stuck, how could i go about 
> making a elemnt fade in on focus and then fade out when its out of focus?
> 
> Sorry really basic question but then so my knowledge of JS and jQuery!
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/highlightFade-Plugin-tf2040652.html#a6427951
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] JQuery selector to detect focus

2006-09-21 Thread George Adamson

Thanks Mike, that answers one question.

So a new :focus selector can be added like this: (for IE only so far. Boo!)

jQuery.extend(jQuery.expr[':'], {
focus: "a==document.activeElement"
});

// Example of usage: $("INPUT:focus")

Does anyone have an answer to the second question: How to detect which
element has the focus in browsers other than IE ?

George


malsup wrote:
> 
>> (a) How can we we bolt extra selector definitions to the JQuery library
>> without modifying the JQuery.js file itself.
> 
> You can see an example of adding to jQuery's selection expressions here:
> http://www.malsup.com/jquery/expr/
> 
> Mike
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/JQuery-selector-to-detect-focus-tf2311127.html#a6427103
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] JQuery selector to detect focus

2006-09-21 Thread George Adamson

Hi there, I have a page in which I need to detect which element has the
focus.

The JQuery documentation states that the 
http://jquery.com/docs/Base/Expression/CSS/ :focus  selector is not
supported, so this would not be possible:

$("DIV INPUT:focus")

It is easy enough to add a selector definition like this `focus:
"a==document.activeElement" ` to the JQuery code (just below "// Form
elements" where :enabled and :checked etc are defined). It works fine in IE
but apparently in other browsers we have to add code to track the focus as
it changes.

So, two questions:
(a) How can we we bolt extra selector definitions to the JQuery library
without modifying the JQuery.js file itself.
(b) In browsers other than IE, is there a simple way in to return the
element that has the focus?
-- 
View this message in context: 
http://www.nabble.com/JQuery-selector-to-detect-focus-tf2311127.html#a6425657
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] highlightFade Plugin

2006-09-20 Thread George Adamson

Wow, Blair, you don't hang about do you?!

For the benefit of new readers: Blair's highlightFade can now fade not only
the backgroundColor but also the borderColor and the [text] color. (Plus the
various specific top and left variations etc such as borderLeftColor.)

> Re: I love that idea and it's in my official release of 0.7
 Less than 24 hours ago I sent you some code to enhance your excellent
highlightFade plugin and you've already released an update! Nice one.

> Re: I fixed [fading more than one element attribute] in 0.7 by turning
> this.highlighting from a hash into a hash of hashes, making multiple
> different attr highlightFades possible with completely unique settings
 Now that it can fade element borders too I've found it very useful for
fading in the borders of form elements so that the form displays data with
less clutter until the user chooses to actually modify the data.

Many thanks Blair.

Regards,

George Adamson
-- 
View this message in context: 
http://www.nabble.com/highlightFade-Plugin-tf2040652.html#a6404220
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] JQuery Plugin: SpinBox / SpinButton Control (with no extra markup)

2006-08-12 Thread George Adamson


Calculating the mouse position in relation to the buttons is tricky under
certains circimstances. Relatively positioned ancestor elements can upset
things, (I had to allow for them explicitly in IE).

Here's a simpler demo here that shows it working in Opera, FF & IE:
http://www.softwareunity.com/sandbox/jqueryspinbtn/JQuerySpinBtn.OrigDemo.htm
(same js src as original demo but here the textbox parent elements have no
fussy positioning)

The original demo is still here:
http://www.softwareunity.com/sandbox/jqueryspinbtn/

Thanks for the feedback, I'll try to upgrade it to a proper plugin and
hopefully add min/max limits and arrow key detection etc.


John Resig wrote:
> 
> This is a great idea for a plugin - keep up the good work!
> 
>> It doesn't work for me in FF1.5.05/IE6.x (no arrows show up)
> 
> Works for me in Firefox 2.0 Beta 1, OSX.
> However, Safari 2.0 shows no arrows (but if you click, it decreases
> the count - only).
> And in Opera 9 it also decreases the count only, but does show the arrows.
> 
> --John
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/JQuery-Plugin%3A-SpinBox---SpinButton-Control-%28with-no-extra-markup%29-tf2091766.html#a5779305
Sent from the JQuery forum at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] JQuery Plugin: SpinBox / SpinButton Control (with no extra markup)

2006-08-11 Thread George Adamson
Hi everyone,

I've been working on a Spin Control that uses only a standard textbox. 

With Javascript enabled the textbox looks and acts like a spin-button 
control without adding any extra elements.

http://www.softwareunity.com/sandbox/jqueryspinbtn/

The up/down arrows are achieved using a background image, the rest is 
handled by Javascript/JQuery.
I hope it is useful for some of you. I'm also working on a drop down 
date-picker that uses similar principles.
(I just don't like solutions that add loads of extra markup!)

Feedback/comments are welcomed, though I won't be able to respond to 
requests for help/support, sorry!

George


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/