[jQuery] Re: Need input on best approach to this type of menu feature

2007-12-26 Thread Shawn

Two things:

First, that site does NOT work the way it should for me.  I'm using FF 
2.0.0.11 on Linux.  The popup menus are showing behind the flash. 
(Linux is an afterthought it seems - again...)  The text of the main bar 
isn't even properly sized - I'm getting wrapping text on some items, and 
the Search label is mostly behind the search textbox - only have of the 
S is showing.  Poor quality control here it would seem (at least with 
regards to FF on Linux).

Second, for what you are after, the bgiframe plugin may be helpful to 
you.  Open your drop down, but in an iframe so you don't get this layer 
issue with flash and other similar quirks.

Also a quick search of the Plugins list might find something that does 
what you need.  I'm sure I saw a few menu plugins in there. 
(http://plugins.jquery.com).

As a user I would find it annyoying to see the content shifted down to 
make room for a sub menu.  Perhaps pre-building that space with a nice 
decorative graphic that would look like part of the site design, but be 
overlayed by the sub-menu when needed?

My thoughts/observations.

Shawn



Rick Faircloth wrote:
 Hi, all…
 
 I’d like to request some suggestions as to what core jQuery
 
 functions and plug-in(s) might best be used to create a
 
 menu feature such as the one used on this site:
 
 _www.AtlantaFalcons.com_ http://www.AtlantaFalcons.com
 
 You’ll see an expanded area appear beneath the menu when you
 
 mouseover the main menu items at the top of the page;.
 
 I thought about using the Yahoo enhanced search approach
 
 which involves sliding the page content down to make room
 
 for the new search area, but I think I would rather use
 
 the approach on the Falcon’s site, and overlay the menu.
 
 The Yahoo approach would be simpler, just using a slide-and-hide
 
 approach, but the Falcon’s approach would be a little
 
 more complex.
 
 Involving, perhaps, absolutely positioned div’s and z-index
 
 for positioning the additional menu area?
 
 Thoughts and suggestions?
 
 Thanks for any input…
 
 Rick
 


[jQuery] Re: general unique id for new append element

2007-12-26 Thread MorningZ

Why not just keep a global variable, like:

var _id = 0;

and when you create the new item, use that counter to make like New_
+ _id, and then increment the counter


[jQuery] Re: Need input on best approach to this type of menu feature

2007-12-26 Thread rics

I think that with some show() or slide() functions you can make
something like that.

Make divs or the expandable area and hide them all. Then you can
show() and/or slide() them in mouseover, or something like that.

This is a beginning...

rics




On Dec 26, 12:20 am, Rick Faircloth [EMAIL PROTECTED]
wrote:
 Hi, all.

 I'd like to request some suggestions as to what core jQuery
 functions and plug-in(s) might best be used to create a
 menu feature such as the one used on this site:

 www.AtlantaFalcons.com

 You'll see an expanded area appear beneath the menu when you
 mouseover the main menu items at the top of the page;.

 I thought about using the Yahoo enhanced search approach
 which involves sliding the page content down to make room
 for the new search area, but I think I would rather use
 the approach on the Falcon's site, and overlay the menu.

 The Yahoo approach would be simpler, just using a slide-and-hide
 approach, but the Falcon's approach would be a little
 more complex.

 Involving, perhaps, absolutely positioned div's and z-index
 for positioning the additional menu area?

 Thoughts and suggestions?

 Thanks for any input.

 Rick


[jQuery] Re: Beginner help with highlight effect

2007-12-26 Thread rics

Yess :

Now it works. But I must use setTimeOut(). Without it the effect
didn't work. You know why? I couldn't find anything in JQuery docs
about it and the plugin even have any docs.

Oh, and by the way, my english is understandable? I'm brazilian and
not very good with the english language! :D

Merry Christmas,
rics





On Dec 25, 1:31 pm, Karl Swedberg [EMAIL PROTECTED] wrote:
 On Dec 24, 2007, at 11:35 AM, rics wrote:





  Hello,

  I'm a PHP developer, but all this javascript thing is new to me. It's
  the first time I try to do something with javascript and I'm using
  JQuery to help me do things fast (and best).

  I wish to make some highlight effect, but can't figure it out by
  myself. Can you help me?

  I wish to click a checkbox and then flash a div using yellow
  background. I think I have to paint the div background with yellow and
  then fade to transparent again. Am I thinking correct? How can I do
  that?

  Thanks,
  rics, from Brazil.

 Hi Rics,

 You can use the color plugin to animate a color from yellow to white
 (or to some other color, but not to transparent).

 http://plugins.jquery.com/project/color

 Then you could write a script like this (you'll need to change the
 selectors someCheckBox and #flash to suit your situation):

  $(document).ready(function() {
$('someCheckBox').click(function() { // on clicking some
 checkbox ...
  $('#flash').css({backgroundColor: '#ff0'}); // ... set
 background color to yellow.
  setTimeout(function() {
$('#flash').animate({backgroundColor: '#fff'}, 1000); //
 Then, animate bg color to white, but first ...
  },
  3000); // ... wait 3 seconds
});
  });

 Hope that helps.

 --Karl
 _
 Karl Swedbergwww.englishrules.comwww.learningjquery.com


[jQuery] Re: Beginner help with highlight effect

2007-12-26 Thread rics

From there:

Only properties that take numeric values are supported (e.g.
backgroundColor is not supported by animate()).

But thanks anyway... Your tip helped me with a lot of other issues! :D

Thanks!!!
rics



On Dec 24, 10:43 pm, Glen Lipka [EMAIL PROTECTED] wrote:
 Check out this page in the docs.http://docs.jquery.com/Effects/animate

 I am in the airport in Phoenix on public wifi, so I cant make a demo right
 this sec.  But that page should help.

 Glen

 On Dec 24, 2007 8:35 AM, rics [EMAIL PROTECTED] wrote:



  Hello,

  I'm a PHP developer, but all this javascript thing is new to me. It's
  the first time I try to do something with javascript and I'm using
  JQuery to help me do things fast (and best).

  I wish to make some highlight effect, but can't figure it out by
  myself. Can you help me?

  I wish to click a checkbox and then flash a div using yellow
  background. I think I have to paint the div background with yellow and
  then fade to transparent again. Am I thinking correct? How can I do
  that?

  Thanks,
  rics, from Brazil.


[jQuery] ajax function - php - display result

2007-12-26 Thread coughlinsmyalias

Hey all and happy holidays!

I have this code:

$.ajax({
 type: POST,
 url: add.php,
 data: {word: $(#word).blah.value}
})

That sends it fine to my database and will print on page refresh...i
am curious to how I would use it to print out say Word added. And
then display it on the page.

Right now I have my data being loaded via a php while() loop would it
be better to do this via ajax?

Thanks so much,

Ryan




[jQuery] Re: Working with the ajax function

2007-12-26 Thread Alexey Blinov
Hm... i didn't use (yet) ajax in jQuery but this one `data: word:
$(#word).blah.value` looks strange...
maybe something like `data: word=* **+** *$(#word).blah.value`?

On Dec 26, 2007 8:07 AM, coughlinsmyalias [EMAIL PROTECTED] wrote:


 Hey all, i have this:

$.ajax({
type: POST,
url: add.php,
data: word: $(#word).blah.value,
})

 And I get this error:

 missing } after property list
 http://localhost/magnet/?addWord=ryansubmit=Add
 Line 17

 Any idea why? And my goal is to fill out the form hit submit then
 display the value on the page instantly. Will this do this?

 And where i have blah that changes to word correct, here is my
 form:

 form name=add id=addWord method=post
 action=add.phplabelAdd Word:label
 input type=text size=20 name=word/
 input type=submit name=submit value=Add/
 /form

 Any thoughts?

 Thank you so much,
 Ryan



[jQuery] jqModal window hangs when trying to rewrite parent page

2007-12-26 Thread somlogan

All,

I would really be grateful if someone can shed light on my issue.  My
parent page contains a trigger to open a jqModal window.  The modal
window itself contains a button which when clicked on will rewrite the
trigger on the parent page.  I need to do this because my real-world
page has a table of statuses that link to modal windows which changes
the status (and hence the modal window trigger) according to user
input.

I have put together a simple example below, can someone tell me what
I'm doing wrong?  Right now the modal window just hangs when I click
on the submit button.  Thank you very very much!

Parent Page:

head
...
script type=text/javascript
$().ready(function() {
  $('#dialog').jqm({ajax: '@href',modal:true,trigger:
'a.testModal'}); }); /script /head body div id=refreshme
  lt;a href='modal.html' class='testModal'Open Modal Windowlt;/a
  div id='dialog' class='jqmWindow'
blahblah...
  /div
/div
/body

Modal Page
---
  form method=post id=form1
Click button to refresh base pagebr/
input type='submit' id='savebtn' value='save'input
type='submit'
id='cancelbtn' class='jqmClose' value='cancel'
  /form
  script type=text/javascript
$().ready(function() {
  $(#form1).submit(function(){
parent.$('#refreshme').empty().append(lt;a href='modal.html'
class='testModal'Open Modal Window Dynamiclt;/adiv id='dialog'
class='jqmWindow'blah/div);
return false;
parent.$('#dialog').jqm({ajax: '@href',modal:true,trigger:
'a.testModal'});
  });
});
  /script


[jQuery] how to create a function in jquery?

2007-12-26 Thread phpcurious

I wanted to create a function that will return an array consisting
values from 3 textboxes.

let's say:

$('document').ready(function() {


$('input#button_a').click(function() {
  a = $('input#input_text_a').val();
  b = $('input#input_text_b').val();
  c = $('input#input_text_c').val();
   });

  $('input#button_b').click(function() {
  a = $('input#input_text_a').val();
  b = $('input#input_text_b').val();
  c = $('input#input_text_c').val();
   });
 $('input#button_c').click(function() {
  a = $('input#input_text_a').val();
  b = $('input#input_text_b').val();
  c = $('input#input_text_c').val();
   });

});

is there a way I can create the function within this jquery script? or
is there a workaround?
please teach me, I am new in this aspect. thank you in advance!


[jQuery] Re: Working with the ajax function

2007-12-26 Thread Shawn

Try this:

$.ajax({
type: POST,
url: add.php,
data: word: $(#word).blah.value
})

Notice the comma after the data: line has been removed.

Betcha you're getting that error in IE...  That's one of the things that 
would trigger an IE error, but not a FF error.

Hope that's it

Shawn

coughlinsmyalias wrote:
 Hey all, i have this:
 
   $.ajax({
   type: POST,
   url: add.php,
   data: word: $(#word).blah.value,
   })
 
 And I get this error:
 
 missing } after property list
 http://localhost/magnet/?addWord=ryansubmit=Add
 Line 17
 
 Any idea why? And my goal is to fill out the form hit submit then
 display the value on the page instantly. Will this do this?
 
 And where i have blah that changes to word correct, here is my
 form:
 
 form name=add id=addWord method=post
 action=add.phplabelAdd Word:label
 input type=text size=20 name=word/
 input type=submit name=submit value=Add/
 /form
 
 Any thoughts?
 
 Thank you so much,
 Ryan


[jQuery] Re: Just can't seem to figure way...

2007-12-26 Thread 胡争辉
Have you fixed your problem?

2007/12/22, [EMAIL PROTECTED] [EMAIL PROTECTED]:


 Can someone look at this code.. for some reason the top expanable menu
 runs Smoothly and the one below it are Choppy when they expand?
 Now remember Im not really good at this... When you click on a main,
 it expands and opens twice..

 You can look at the issue here, the left hand sidebar is the problem:
 http://www.oaklandregionalhospital.com/tests/new/index.html


 Here is the code:



 !--webbot bot=HTMLMarkup startspan --?xml version=1.0
 encoding=utf-8?
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
   http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
 html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en-us
 head
 STYLE type=text/css
 !--
 A { text-decoration:none }
 --
 /STYLE

 titleDL Demo/title
 script src=http://jquery.com/src/jquery.js;/script
 script
 $(document).ready(function(){
 $(dd:not(:first)).hide();
 $(dt a).click(function(){
 $(dd:visible).slideUp(slow);
 $(this).parent().next().slideDown(slow);
 return false;
 });
 });
 /script
 style
 body { font-family: Tahoma; font-size: 4px; }
 dl { width: 200px; }
 dl,dd { margin: 0; }
 dt { background: #EBEBEB; font-size: 14px; padding: 5px; margin:
 2px; }
 dt a { color: #b2; }
 dd a { color: #000; }
 ul { list-style: none; padding: 5px; }
 /style
 /head

 body
 dl
 dta href=/Surgical Services/a/dt
 dd
 ul
 abOrthopedic Services:/b/a/li
 lia href=/docs/Reconstructive Surgery/a/li
 lia href=/blog/Hand - Elbow Injuries 
 Conditions/a/li
 lia href=/blog/Shoulder Injuries 
 Conditions/a/li
 lia href=/blog/Arthroscopic Surgery/a/li
 lia href=/blog/Total Joint Replacement/a/li
 lia href=/blog/Foot - Ankle Injuries 
 Conditions/a/li
 lia href=/blog/Sports Medicine/a
 liabCardiovascular Services:/b/a/li
 lia href=/blog/Peripheral Angiogram/a
 lia href=/blog/Endovascular Atherectomy/a

 /ul
 /dd
 dta href=/Podiatry  Wound Services/a/dt
 dd
 ul
 lia href=/dev/Podiatry and Wound Services/a/li
 /ul
 dta href=/dev/Gynecological Services/a/dt
 dd
 ul

 lia href=/src/Gynecological Services/a/li
 /ul
 /dd
 dta href=/Imaging Services/a/dt
 dd
 ul
 lia href=/docs/Radiology/a/li
 lia href=/blog/Magnetic Resonance Imaging
 (MRI)/a/li
 lia href=/blog/Computerized Tomography (CT)/a/li
 /ul
 /dd
 dta href=/Rehabilitation Services/a/dt
 dd
 ul
 lia href=/docs/Physical Therapy/a/li
 lia href=/blog/Occupational Therapy/a/li
 lia href=/blog/Speech Therapy/a/li


 /dl
 /body
 /html
 !--webbot bot=HTMLMarkup endspan --




-- 
QQ: 443089607
QQ mail: [EMAIL PROTECTED]
Skype: huzhenghui
Gtalk: huzhengh
GMail: [EMAIL PROTECTED]


[jQuery] Re: Adding result to database via php/jQuery - similar to tag feature on flickr

2007-12-26 Thread coughlinsmyalias

$.ajax({
 type: POST,
 url: add.php,
 data: {word: $(#word).blah.value}
})

I have this now, it sends to my database..but I need to find a way to
now print out the result, I have it printing out via my php while
loop. should i do this through ajax instead?

How would I added to my script to make it say:

Word added and t hen show word.

Thanks!

On Dec 25, 9:35 pm, coughlinsmyalias [EMAIL PROTECTED] wrote:
 Hey all,

 I have been looking on google and on the jquery site for a function/
 plugin that will allow me to do:

 Have a form with one field that on submit will add the word to the
 page instantly via ajax/php send the request to the database and post
 to the table then display a message like Word has been added

 I have come up blank on my search and thought i'd post here. Any
 thoughts?

 So after they submit it shows on page, instantly.

 Thanks so much and happy holidays,

 Ryan


[jQuery] Re: Need input on best approach to this type of menu feature

2007-12-26 Thread Rick Faircloth

Thanks for the help, Rics...

Rick

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of rics
 Sent: Wednesday, December 26, 2007 7:12 AM
 To: jQuery (English)
 Subject: [jQuery] Re: Need input on best approach to this type of menu feature
 
 
 I think that with some show() or slide() functions you can make
 something like that.
 
 Make divs or the expandable area and hide them all. Then you can
 show() and/or slide() them in mouseover, or something like that.
 
 This is a beginning...
 
 rics
 
 
 
 
 On Dec 26, 12:20 am, Rick Faircloth [EMAIL PROTECTED]
 wrote:
  Hi, all.
 
  I'd like to request some suggestions as to what core jQuery
  functions and plug-in(s) might best be used to create a
  menu feature such as the one used on this site:
 
  www.AtlantaFalcons.com
 
  You'll see an expanded area appear beneath the menu when you
  mouseover the main menu items at the top of the page;.
 
  I thought about using the Yahoo enhanced search approach
  which involves sliding the page content down to make room
  for the new search area, but I think I would rather use
  the approach on the Falcon's site, and overlay the menu.
 
  The Yahoo approach would be simpler, just using a slide-and-hide
  approach, but the Falcon's approach would be a little
  more complex.
 
  Involving, perhaps, absolutely positioned div's and z-index
  for positioning the additional menu area?
 
  Thoughts and suggestions?
 
  Thanks for any input.
 
  Rick




[jQuery] Re: Need input on best approach to this type of menu feature

2007-12-26 Thread Rick Faircloth

Hi, Shawn, and thanks for the reply...

Concerning Flash issues, I'm not planning to use
Flash anyway.

I'll check out the bgiframe plugin...thanks for the tip!

Rick

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Shawn
 Sent: Wednesday, December 26, 2007 3:18 AM
 To: jquery-en@googlegroups.com
 Subject: [jQuery] Re: Need input on best approach to this type of menu feature
 
 
 Two things:
 
 First, that site does NOT work the way it should for me.  I'm using FF
 2.0.0.11 on Linux.  The popup menus are showing behind the flash.
 (Linux is an afterthought it seems - again...)  The text of the main bar
 isn't even properly sized - I'm getting wrapping text on some items, and
 the Search label is mostly behind the search textbox - only have of the
 S is showing.  Poor quality control here it would seem (at least with
 regards to FF on Linux).
 
 Second, for what you are after, the bgiframe plugin may be helpful to
 you.  Open your drop down, but in an iframe so you don't get this layer
 issue with flash and other similar quirks.
 
 Also a quick search of the Plugins list might find something that does
 what you need.  I'm sure I saw a few menu plugins in there.
 (http://plugins.jquery.com).
 
 As a user I would find it annyoying to see the content shifted down to
 make room for a sub menu.  Perhaps pre-building that space with a nice
 decorative graphic that would look like part of the site design, but be
 overlayed by the sub-menu when needed?
 
 My thoughts/observations.
 
 Shawn
 
 





[jQuery] Programmatically controlling cut and paste

2007-12-26 Thread Chris Jordan
Is there a way to use jQuery (or javascript in general) to programmatically
controll copy and paste functions? I'd like to replace the right-click
context menu and *only* offer the ability to cut and paste. I was looking at
using Chris Domigan's ContextMenu plug-in to capture the right-click and
replace the stock menu with my own, but then it occurred to me that I don't
know how I would control the copying and pasting ability.

Thanks,
Chris

-- 
http://cjordan.us


[jQuery] Re: Need input on best approach to this type of menu feature

2007-12-26 Thread Olivier Percebois-Garve
What you are looking for is a tabs system triggered by the onmouseover 
event , is it?


I have built something like that but I did not make it into a plugin :
http://www.electris.lu/electris_net/service/conseil_en_energie.php

Olivier


Rick Faircloth wrote:


Hi, all...

I'd like to request some suggestions as to what core jQuery

functions and plug-in(s) might best be used to create a

menu feature such as the one used on this site:

_www.AtlantaFalcons.com_ http://www.AtlantaFalcons.com

You'll see an expanded area appear beneath the menu when you

mouseover the main menu items at the top of the page;.

I thought about using the Yahoo enhanced search approach

which involves sliding the page content down to make room

for the new search area, but I think I would rather use

the approach on the Falcon's site, and overlay the menu.

The Yahoo approach would be simpler, just using a slide-and-hide

approach, but the Falcon's approach would be a little

more complex.

Involving, perhaps, absolutely positioned div's and z-index

for positioning the additional menu area?

Thoughts and suggestions?

Thanks for any input...

Rick





[jQuery] Re: Kwick type horizontal accordion with jquery ?

2007-12-26 Thread Jeferson Koslowski
Hi,

here are two examples using jquery:

1. http://www.gmarwaha.com/jquery/jkwick/test/test.html
2. http://dev.jquery.com/~john/jquery/test/moo-menu.html

Also, u can find a lot of discussion about it here:
http://www.nabble.com/forum/Search.jtp?forum=15494local=yquery=kwick

Hope it helps.

On Dec 25, 2007 8:52 PM, Mark [EMAIL PROTECTED] wrote:


 Hey everyone!  Happy holidays.

 Ive been on a 3 day hunt for a horizontal accordion that functions
 almost identically to the one offered by mootools.  An example of this
 type of accordion can be see on the mootools homepage (http://
 www.mootools.net) downloads/docs/blogs/trac.

 I want to use jquery or any other structure other then mootools, but
 idealy jquery.  Now i've come across the common solutions on the
 internet, but they all seem to use a handle bar to control the
 function, I was interested in one very similar to the one by
 mootools.  What I mean is that simply hovering over a unit will force
 it to expand the div, rather then having to click on a handle bar.
 The use of hoverintent in the script is a big bonus as well..

 Well, if anyone knows of the existence of any such script it would be
 a big bonus :)

 thanks!




[jQuery] Re: Programmatically controlling cut and paste

2007-12-26 Thread Chris Jordan
Okay, I think I just found it. Before I posted this question I was searching
google for javascript programmatic cut and paste (and other variations on
that theme), but getting no where. Just a bit ago it occurred to me that was
I was really trying to do was get access to the clipboard. Duh. A search for
javascript clipboard access returned what I was looking for --
window.clipboardData.setData();

Before folks start writing to tell me that this is a security risk, keep in
mind that a) my app is for company intranet use only and not available to
the general public and b) I'm not using the control for evil... only for
good ;o) I won't be storing the information for any long term use, or
tracking what IP had what in their clipboard... nothing like that. I'm one
of the good guys *show's everyone his white hat*

Also, I realize that the method I mentioned above only works for IE which is
okay for me because when users launch this app they don't get a browser
choice. It's automattically using IE 6.

All that said, comments are still welcomed. :o)

Thanks,
Chris


On 12/26/07, Chris Jordan [EMAIL PROTECTED] wrote:

 Is there a way to use jQuery (or javascript in general) to
 programmatically controll copy and paste functions? I'd like to replace the
 right-click context menu and *only* offer the ability to cut and paste. I
 was looking at using Chris Domigan's ContextMenu plug-in to capture the
 right-click and replace the stock menu with my own, but then it occurred to
 me that I don't know how I would control the copying and pasting ability.

 Thanks,
 Chris

 --
 http://cjordan.us




-- 
http://cjordan.us


[jQuery] Re: check if an id exists

2007-12-26 Thread Yehuda Katz


I would definitely recommend $(#id).length. When working in a  
language, it's important to keep in mind the language's idioms. In the  
case of JS, 0 == false, so if($(#id).length) is a perfectly good  
idiom.


It's a bit confusing coming from another language (where 0 is true),  
but that's not a good enough reason to reduce the efficiency of your  
code.


-- Yehuda

On Dec 25, 2007, at 7:35 PM, McLars wrote:



$('#id').length is the old school, and most widely used, technique.
This is probably the fastest.

$('#id').is('*') does make sense semantically (expresses the intent),
and is more flexible.

Larry


On Dec 25, 12:33 am, Alexey Blinov [EMAIL PROTECTED] wrote:

Yep... my code have size(). Forgot to point it...
And thanks for info about more efficient way - using length.
So... which way is better than?

1. $('#id').length  0

2. $('#id').length() !== 0

3. $('#id').is('*') //never try it... but look pretty

- Alexey

On Dec 25, 2007 5:39 AM, Michael Geary [EMAIL PROTECTED] wrote:



 $('#id').size !== 0 would not work. I'll bet that your actual  
code has
.size() instead of .size without the parentheses, right? The size  
property
is a method, so the !== 0 test would always return true (since a  
function

reference is never equal to 0).


.length is slightly more efficient than .size() - look at the  
source code

for the .size method:



size: function() {
return this.length;
}


The only reason the size method exists at all is for compatibility  
with
very old jQuery code that may have used it back in the days when  
there was

no .length property.



-Mike- Hide quoted text -


- Show quoted text -




[jQuery] Re: how to create a function in jquery?

2007-12-26 Thread McLars

First, since all of your functions do the same thing, you do not have
to repeat yourself. I would suggest either wrapping all the buttons
and textboxes in another element or giving them a class so that they
can be selected together, for example:

  $('#wrapper input').click(...);   or $('.buttonClass').click(...);

Next, you say you want the values in an array, but you're currently
using separate variables (a, b, and c). Would you have the array
predefined or do you want to return an array? Also, if the textboxes
appear in the same order that you want to store the values, you can
use the .each() method with the enumerator for the array index. For
example:

  $('.buttonClass').click(function()
  {
$('.textboxClass').each(function(i)
{
  MyArray[i] = $(this).val();
})
  });

Or something like that, depending on where your array is, whether the
elements are in order, whether the number of textboxes is constant,
etc. etc.

Larry

On Dec 26, 1:13 am, phpcurious [EMAIL PROTECTED] wrote:
 I wanted to create a function that will return an array consisting
 values from 3 textboxes.

 let's say:

 $('document').ready(function() {

         $('input#button_a').click(function() {
               a = $('input#input_text_a').val();
               b = $('input#input_text_b').val();
               c = $('input#input_text_c').val();
            });

           $('input#button_b').click(function() {
               a = $('input#input_text_a').val();
               b = $('input#input_text_b').val();
               c = $('input#input_text_c').val();
            });
          $('input#button_c').click(function() {
               a = $('input#input_text_a').val();
               b = $('input#input_text_b').val();
               c = $('input#input_text_c').val();
            });

 });

 is there a way I can create the function within this jquery script? or
 is there a workaround?
 please teach me, I am new in this aspect. thank you in advance!


[jQuery] Re: general unique id for new append element

2007-12-26 Thread McLars

I believe that is what $.data(element) does, it returns a unique id.
However, it only returns an integer number. I would prefer to combine
it with a few characters as well, but I suppose that isn't strictly
necessary.

Byron's function above is a good example of how you could use it. But
if you do create a function to handle this, I wouldn't name the
function id (which is a property name). I would name it
uniqueId or something else. And you might allow a parameter for the
additional characters instead of hard-coding the literal jQuery_.
For example, if you generate ids like div1, div2, div3 and then
you generate some more ids like span1, span2, span3, it gives you
a little more control if you need to select those elements later--e.g.
$('[id^=div]') versus $('[id^=span]').

Generally, though, unless you do this a lot, it's pretty simple to
either generate your own random number or use $.data() right in the
assignment statement, like this:

  MyDiv.attr(id, div + (1 + Math.floor( * Math.random()));

or

  MyDiv.attr(id, div + $.data(MyDiv));

The only problem I have with $.data() is that it doesn't look
semantically like something that produces a unique id. In fact, it is
a jQuery internal that otherwise is used to store and retrieve expando
data.

Larry


On Dec 26, 5:56 am, MorningZ [EMAIL PROTECTED] wrote:
 Why not just keep a global variable, like:

 var _id = 0;

 and when you create the new item, use that counter to make like New_
 + _id, and then increment the counter


[jQuery] GET? Print out results via jquery/php

2007-12-26 Thread coughlinsmyalias

Hey all, I am wondering how I can get my results via php/ajax. Could i
use jquery for that print them out like this:

span class=word id=$word_$id'.$word.'/span

And print them all out like that above. Would I use the GET function
with jquery. Get them all printed out.

Thanks so much!


[jQuery] Re: Falling snow plugin

2007-12-26 Thread yaofong

Hi, I am one of the author of  http://www.techlicious.name.my

Nice to meet you all here...


[jQuery] Re: Programmatically controlling cut and paste

2007-12-26 Thread Yehuda Katz
If you're only using IE, you're good to go. An alternative that works  
cross-browser is to hijack Flash's access to the clipboard via  
ExternalInterface.


-- Yehuda

On Dec 26, 2007, at 9:29 AM, Chris Jordan wrote:

Okay, I think I just found it. Before I posted this question I was  
searching google for javascript programmatic cut and paste (and  
other variations on that theme), but getting no where. Just a bit  
ago it occurred to me that was I was really trying to do was get  
access to the clipboard. Duh. A search for javascript clipboard  
access returned what I was looking for --  
window.clipboardData.setData();


Before folks start writing to tell me that this is a security risk,  
keep in mind that a) my app is for company intranet use only and not  
available to the general public and b) I'm not using the control for  
evil... only for good ;o) I won't be storing the information for any  
long term use, or tracking what IP had what in their clipboard...  
nothing like that. I'm one of the good guys *show's everyone his  
white hat*


Also, I realize that the method I mentioned above only works for IE  
which is okay for me because when users launch this app they don't  
get a browser choice. It's automattically using IE 6.


All that said, comments are still welcomed. :o)

Thanks,
Chris


On 12/26/07, Chris Jordan [EMAIL PROTECTED] wrote:
Is there a way to use jQuery (or javascript in general) to  
programmatically controll copy and paste functions? I'd like to  
replace the right-click context menu and *only* offer the ability to  
cut and paste. I was looking at using Chris Domigan's ContextMenu  
plug-in to capture the right-click and replace the stock menu with  
my own, but then it occurred to me that I don't know how I would  
control the copying and pasting ability.


Thanks,
Chris

--
http://cjordan.us



--
http://cjordan.us




[jQuery] Re: how to create a function in jquery?

2007-12-26 Thread Yehuda Katz


You need to provide more information about what you're trying to do.

You can do something like $(#button_a, #button_b,  
#button_c).click(...), but I'm not sure why you're defining those  
variables. Also, without var, those variables are being defined in the  
global scope, which is bad practice.


-- Yehuda

On Dec 26, 2007, at 12:13 AM, phpcurious wrote:



I wanted to create a function that will return an array consisting
values from 3 textboxes.

let's say:

$('document').ready(function() {


$('input#button_a').click(function() {
  a = $('input#input_text_a').val();
  b = $('input#input_text_b').val();
  c = $('input#input_text_c').val();
   });

  $('input#button_b').click(function() {
  a = $('input#input_text_a').val();
  b = $('input#input_text_b').val();
  c = $('input#input_text_c').val();
   });
 $('input#button_c').click(function() {
  a = $('input#input_text_a').val();
  b = $('input#input_text_b').val();
  c = $('input#input_text_c').val();
   });

});

is there a way I can create the function within this jquery script? or
is there a workaround?
please teach me, I am new in this aspect. thank you in advance!




[jQuery] Re: Beginner help with highlight effect

2007-12-26 Thread Karl Swedberg


Hi Rics,

Glad it works for you. I used setTimeout() in the code that I sent to  
you, so I'm not sure why you're mentioning that you must use it. Are  
you using it somewhere other than the place where I'm using it? I put  
it in the callback of the fadeIn() method so that the element would  
stay yellow for 3 seconds before it starts fading out.


setTimeout() is a method of the window object, and it's native  
JavaScript. It is not exclusive to jQuery at all. That's probably why  
you couldn't find anything in the jQuery docs. Actually, I wrote about  
a little gimmick that you could use instead of setTimeout() if you  
just want to chain some jQuery methods together:


http://www.learningjquery.com/2007/01/effect-delay-trick

Your English is fine. :-)


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Dec 26, 2007, at 7:07 AM, rics wrote:



Yess :

Now it works. But I must use setTimeOut(). Without it the effect
didn't work. You know why? I couldn't find anything in JQuery docs
about it and the plugin even have any docs.

Oh, and by the way, my english is understandable? I'm brazilian and
not very good with the english language! :D

Merry Christmas,
rics





On Dec 25, 1:31 pm, Karl Swedberg [EMAIL PROTECTED] wrote:

On Dec 24, 2007, at 11:35 AM, rics wrote:






Hello,


I'm a PHP developer, but all this javascript thing is new to me.  
It's

the first time I try to do something with javascript and I'm using
JQuery to help me do things fast (and best).



I wish to make some highlight effect, but can't figure it out by
myself. Can you help me?



I wish to click a checkbox and then flash a div using yellow
background. I think I have to paint the div background with yellow  
and

then fade to transparent again. Am I thinking correct? How can I do
that?



Thanks,
rics, from Brazil.


Hi Rics,

You can use the color plugin to animate a color from yellow to white
(or to some other color, but not to transparent).

http://plugins.jquery.com/project/color

Then you could write a script like this (you'll need to change the
selectors someCheckBox and #flash to suit your situation):

$(document).ready(function() {
  $('someCheckBox').click(function() { // on clicking some
checkbox ...
$('#flash').css({backgroundColor: '#ff0'}); // ... set
background color to yellow.
setTimeout(function() {
  $('#flash').animate({backgroundColor: '#fff'}, 1000); //
Then, animate bg color to white, but first ...
},
3000); // ... wait 3 seconds
  });
});

Hope that helps.

--Karl
_
Karl Swedbergwww.englishrules.comwww.learningjquery.com




[jQuery] Re: server side jquery

2007-12-26 Thread GeekFreak

forgot to mention. it is open source and avail under the GPL

On Dec 26, 11:14 am, GeekFreak [EMAIL PROTECTED] wrote:
 For you folks that want to run jQuery serverside, here's a little
 teaser for a product we're releasing early in the new year, that will
 allow you run jQueryserverside(and much more) , we currently have
 most of the jquery unit tests working, and hope that the wonderfully
 active jQuery community will assist in completing those tests (some
 not being relevant for that environement)

 Essentially we have a page serving product that provides a full DOM
 that can be manipulated by jQuery (or any JS) prior to the page being
 served to the client. We think  it's pretty cool.

 if you want to get a ping from me when it is avail you can send me a
 pm to davey at the domain aptana.com

 cheers
 davey


[jQuery] Re: server side jquery

2007-12-26 Thread GeekFreak

For you folks that want to run jQuery serverside, here's a little
teaser for a product we're releasing early in the new year, that will
allow you run jQuery server side (and much more) , we currently have
most of the jquery unit tests working, and hope that the wonderfully
active jQuery community will assist in completing those tests (some
not being relevant for that environement)

Essentially we have a page serving product that provides a full DOM
that can be manipulated by jQuery (or any JS) prior to the page being
served to the client. We think  it's pretty cool.

if you want to get a ping from me when it is avail you can send me a
pm to davey at the domain aptana.com

cheers
davey


[jQuery] Re: Need input on best approach to this type of menu feature

2007-12-26 Thread Rick Faircloth
Thanks for the tip, Olivier. I'll check it out!

 

Rick

 

From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Olivier
Percebois-Garve
Sent: Wednesday, December 26, 2007 12:22 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Need input on best approach to this type of menu feature

 

What you are looking for is a tabs system triggered by the onmouseover event , 
is it?

I have built something like that but I did not make it into a plugin :
http://www.electris.lu/electris_net/service/conseil_en_energie.php

Olivier




 



[jQuery] Re: jquery.com down?

2007-12-26 Thread traunic

seems to be ok now  maybe a DOS?

On Dec 26, 2:23 pm, traunic [EMAIL PROTECTED] wrote:
 getting timeouts when attempting to go tohttp://jquery.com/


[jQuery] cloding events problems

2007-12-26 Thread Eridius


Would this be the correct way of cloning events?

for(var i = 0; i  array_length; i++)
$new_dom[x] = $('#hotel_information div#hotel_selection' +
table_id).clone(true);
}

for(var x = 0; x  array_length; x++)
{
var new_element = new_dom[x];
$(new_element).appendTo('#hotel_information');
}

I am trying this and and all my html is properly being copied by my binded
events(well bind events for the tabs plugin) and not being pulled?  is this
an issue with my code, with the tabs plug, or with something else?
-- 
View this message in context: 
http://www.nabble.com/cloding-events-problems-tp14506243s27240p14506243.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Re: check if an id exists

2007-12-26 Thread Michael Geary

It's funny, if I saw:

if( $('#id').is('*') ) { ... }

I would have no clue what the code was trying to do until I thought hard
about it: Let's see... is star... Now that's going to match *anything*.
Wouldn't it always return true? Naw, that can't be right, what would be the
point of this code... Oh! What if there are no elements at all? Then it
would return false! I think it would anyway. Better check the docs. Hmm...
The docs don't explicitly say what .is() does when the array is empty.
Better check the source code, and maybe try a couple of test cases to be
sure.

Where if I saw:

if( $('#id').length ) { ... }

I would know right away what it does: $() returns an array. Does it have
any elements? :-)

-Mike

 From: McLars
 
 $('#id').length is the old school, and most widely used, technique.
 This is probably the fastest.
 
 $('#id').is('*') does make sense semantically (expresses the 
 intent), and is more flexible.

  From: Alexey Blinov
  
  Yep... my code have size(). Forgot to point it...
  And thanks for info about more efficient way - using length.
  So... which way is better than?
 
  1. $('#id').length  0
 
  2. $('#id').length() !== 0
 
  3. $('#id').is('*') //never try it... but look pretty



[jQuery] Need to slide my grid/table with a slider like control.

2007-12-26 Thread Monica

I have a table with both Row Header and column headers. However, this
table's width goes beyond the page. We don't want to use the
horizontal scrollbar, instead would like a slider like control that
will keep the row headers sticky but would scroll/move the table
colums left or right as I am moving the slider. The slider control
would sit at a little( 20 pixels) distance from the bottom of the
table?

If there is no such plugin, could you give me some pointers on how to
tackle this?


Thanks,
Monica.



[jQuery] Re: jquery.com down?

2007-12-26 Thread Pierre

Seems like database issue (got a database timeout error when trying to
access the wiki). Worked the second time after a while tho

On Dec 26, 11:23 am, traunic [EMAIL PROTECTED] wrote:
 getting timeouts when attempting to go tohttp://jquery.com/


[jQuery] Re: check if an id exists

2007-12-26 Thread Hamish Campbell

extendify!

$(document).ready(function() {
jQuery.fn.exists = function() {
return ( this.is('*') )
}
}
});

On Dec 27, 10:28 am, Michael Geary [EMAIL PROTECTED] wrote:
 It's funny, if I saw:

 if( $('#id').is('*') ) { ... }

 I would have no clue what the code was trying to do until I thought hard
 about it: Let's see... is star... Now that's going to match *anything*.
 Wouldn't it always return true? Naw, that can't be right, what would be the
 point of this code... Oh! What if there are no elements at all? Then it
 would return false! I think it would anyway. Better check the docs. Hmm...
 The docs don't explicitly say what .is() does when the array is empty.
 Better check the source code, and maybe try a couple of test cases to be
 sure.

 Where if I saw:

 if( $('#id').length ) { ... }

 I would know right away what it does: $() returns an array. Does it have
 any elements? :-)

 -Mike



  From: McLars

  $('#id').length is the old school, and most widely used, technique.
  This is probably the fastest.

  $('#id').is('*') does make sense semantically (expresses the
  intent), and is more flexible.
   From: Alexey Blinov

   Yep... my code have size(). Forgot to point it...
   And thanks for info about more efficient way - using length.
   So... which way is better than?

   1. $('#id').length  0

   2. $('#id').length() !== 0

   3. $('#id').is('*') //never try it... but look pretty- Hide quoted text -

 - Show quoted text -


[jQuery] Re: check if an id exists

2007-12-26 Thread McLars

Yehuda, I will agree and (respectfully) disagree with you. Yes, using
the length property is expedient. It's how millions of programmers
have been doing such things, in many different languages, and they
will probably continue to do it. No harm there, as indeed JS treats
zero as a false and it works fine.

However, I still maintain that semantically it is a hack. The question
we are asking is does this element exist?. Technically, that should
be answered with a boolean result, and the .is() method's specific
purpose is to check for the existence of selected elements and return
a boolean response.

Also, efficiency is not always the most important criteria in coding.
Readability and maintainablility very often should be more important.
If you have a loop checking for the existence of thousands of
elements, then, yes, I'd say go for the faster solution. However, if
you're just responding to a button click or something that only
happens a few times (and especially if you or someone else will have
to maintain it later), I'd recommend using the syntax that most
clearly states the intent. The reason you need an entry in the FAQ
about this, is that the old length hack that some of us have used
for decades just isn't intuitive to newbies.

I do enjoy arguing a trivial point long past answering the OP's
question, but I draw the line at running speed tests. I have little
doubt that .is() is not as fast as .length (heck, .is() probably
uses .length internally), but unless you are doing huge amounts of
processing, a millisecond or two of difference is not more important
than good, legible coding style.

I'm not saying don't use .length. It's short and it works fine for
most cases. I'm just saying there is an alternative, too, to keep in
mind, that is designed for the task, expresses the intent more
clearly, and is more powerful.

Larry


On Dec 26, 10:58 am, Yehuda Katz [EMAIL PROTECTED] wrote:
 I would definitely recommend $(#id).length. When working in a  
 language, it's important to keep in mind the language's idioms. In the  
 case of JS, 0 == false, so if($(#id).length) is a perfectly good  
 idiom.

 It's a bit confusing coming from another language (where 0 is true),  
 but that's not a good enough reason to reduce the efficiency of your  
 code.

 -- Yehuda

 On Dec 25, 2007, at 7:35 PM, McLars wrote:





  $('#id').length is the old school, and most widely used, technique.
  This is probably the fastest.

  $('#id').is('*') does make sense semantically (expresses the intent),
  and is more flexible.

  Larry

  On Dec 25, 12:33 am, Alexey Blinov [EMAIL PROTECTED] wrote:
  Yep... my code have size(). Forgot to point it...
  And thanks for info about more efficient way - using length.
  So... which way is better than?

  1. $('#id').length  0

  2. $('#id').length() !== 0

  3. $('#id').is('*') //never try it... but look pretty

  - Alexey

  On Dec 25, 2007 5:39 AM, Michael Geary [EMAIL PROTECTED] wrote:

   $('#id').size !== 0 would not work. I'll bet that your actual  
  code has
  .size() instead of .size without the parentheses, right? The size  
  property
  is a method, so the !== 0 test would always return true (since a  
  function
  reference is never equal to 0).

  .length is slightly more efficient than .size() - look at the  
  source code
  for the .size method:

      size: function() {
          return this.length;
      }

  The only reason the size method exists at all is for compatibility  
  with
  very old jQuery code that may have used it back in the days when  
  there was
  no .length property.

  -Mike- Hide quoted text -

  - Show quoted text -- Hide quoted text -

 - Show quoted text -


[jQuery] Multiple autocomplete selector

2007-12-26 Thread Julien

Hello there,

I was wondering if you knew about a plugin, or if you knew if it was
easy to make a text input coupled with an autocomplete functionality
which adds a box for each item added to it. A bit like facebook does
to add multiple recipients for a message into a text input, as
illustrated here: 
http://refreshpartners.com/fb_dev_wiki_images/fb_multiple_friend_input.jpg

Many thanks!

Julien


[jQuery] FadeIn on $(document).ready flicker

2007-12-26 Thread Jeroen

I'm using jQuery on my new photo blog. I am fading in the image when
the dom has loaded like this:

$(function() {
// Animate photo
$('#photo').hide();
$('#photo').fadeIn(1500);
}

The problem is, the photo flickers for about a millisecond, as in, you
can see it
in full opacity. I can fix this by, in the html, providing a 'display:
none;' but
then non JS browsers will not see the photo. Is there a Unobtrusive way to
fix this?

Problem is cross browser. Not only IE.

Thanks!

-- 
Jeroen


[jQuery] Using ajax

2007-12-26 Thread coughlinsmyalias

Hey all, I am new at jQuery and playing with it for a couple of days
and i have:

$(document).ready(function(){





$.ajax({
type: GET,
url: words.php,
dataType: HTML,
error: function(){
alert('Error loading XML document');
},
success: function(data){
alert(Data Loaded:  + data);
}
 });

And i get this error:

missing } after function body
http://localhost/magnet/
Line 31

Any ideas why? All of my {} and () seem to match up?

Thanks so much!
Ryan


[jQuery] label fires click function twice

2007-12-26 Thread Michael Nosal

If I have a div with a label and input in it:
div id=tab
  input type=radio id=r1 value=foo
  label for=r1My Label/label
/div

and I add a click handler like so:
$('r1').click(function() {
  window.console.log(hello);
});

Clicking the div or the radio button gets one call to the click function.
Clicking the label element results in the click function being called twice.
Known? Unknown? Workaround?
Using jquery 1.2.1

--Mike N.


[jQuery] How to identify the selected element with jquery?

2007-12-26 Thread jerpod

I suspect this is extraordinarily simple,  but I've yet to find a way
to do it so bear with me (very new to jquery).

My mission is to allow a user to click on a link of css class
closed (the content below that point in the DOM will be hidden).
When that link is clicked the content will .show(), or
maybe .toggle().

My first issue is that there may be several links of the class
closed on the page.  I need to select only the DOM content below
that link -- ie, everything (I think) from the link up to the /body
tag.  So I need to know which link was clicked (the links will NOT
have IDs -- neither will anything else in the DOM).  How do I say with
jquery, select everything from the link that was clicked through the
end of the document?

My next issue (which I can tackle after my first problem is resolved),
is that I will need to loop through the returned object, toggling open
or closed, until I reach the next instance of an h tag (actually,
either h3 or h4). At that point I'll bail out of the loop.

So the effect is pretty simple:  When the user hits the page, there
are a bunch of closed sections.  By clicking the link the user
opens one or more of those individual sections.  What makes it
difficult is that fact that I need to enable some non-html-savvy
person to add new content through an admin (CMS) interface, and have
that person be able to add the code to necessary to do the open/close
routine.  I think I can do all this with jquery, and all the admin
user would need to do is add the closed class to the link. Does that
make sense?

All help appreciated.

jp



[jQuery] Re: Using ajax

2007-12-26 Thread Steve Blades
You have the closing brackets and parens around the functions of your
.ajax() call, but you don't appear to close out your
$(document).ready(function(){ // everything is in here });

-- 
Steve Cutter Blades
Adobe Certified Professional
Advanced Macromedia ColdFusion MX 7 Developer
_
http://blog.cutterscrossing.com
---
The Past is a Memory
The Future a Dream
But Today is a Gift
That's why they call it
The Present


[jQuery] Can jQuery create an element then bind a hover function to it?

2007-12-26 Thread zarino

Well, I know the answer is yes, but I can't figure out how. Can you
help?

I'm using jQuery to take values from an XML file (a schedule for a
radio station), wrap them up into nice HTML elements, and inject them
into my web page. When the user hovers over any of the jQuery-created
elements, I want something to happen.

Currently, my jQuery code looks like this...


$(document).ready(
function(){

var nowDay = new Date().getDay();
var nowHours = new Date().getHours();
var nowMinutes = new Date().getMinutes();
var nowID = nowDay * 1 + nowHours *100 + 
nowMinutes;

$.ajax({
type: GET,
url: schedule.xml,
dataType: xml,
success: function(xml) {
$(xml).find('show').each(
function(){

var showStart = 
$(this).attr('start');
var showEnd = 
$(this).attr('end');
var showDay = 
$(this).parent('day').attr('id');
var showTitle = 
$(this).find('title').text();
var showArtist 
= $(this).find('artist').text();
var 
showDescription = $(this).find('description').text();
var showTime = 
$(this).find('time').text();


$('#'+showDay).append(div class='show'span
class='time'+showTime+/span h3+showTitle+/h3div
class='more-info'p class='artist'+showArtist+/pp
class='description'+showDescription+/p/div/div);

}
);

$(.show).hover(
function(){

$(this).children('.more-info').SlideInUp(500);
}, function(){

$(this).children('.more-info').SlideOutUp(500);
}
);
}
});

}
);


As you can see, I'm trying to bind an animation to the hover event of
all div.show elements on the page. But because they're created by
jQuery, the usual way I'd do it doesn't seem to work.

Any suggestions would be greatly appreciated.

Many thanks :-)

Zarino Zappia


[jQuery] Re: label fires click function twice

2007-12-26 Thread Hamish Campbell

I've seen the same behaviour outside of jQuery - something to do with
the way 'for' sends events to the target element.

Can't remember how/if I fixed it, but you could ditch the label and
use jQuery to emulate the label functionality. Not a bad option
considering not all browsers support labels correctly/consistantly.

On Dec 27, 11:04 am, Michael Nosal [EMAIL PROTECTED] wrote:
 If I have a div with a label and input in it:
 div id=tab
   input type=radio id=r1 value=foo
   label for=r1My Label/label
 /div

 and I add a click handler like so:
 $('r1').click(function() {
   window.console.log(hello);

 });

 Clicking the div or the radio button gets one call to the click function.
 Clicking the label element results in the click function being called twice.
 Known? Unknown? Workaround?
 Using jquery 1.2.1

 --Mike N.


[jQuery] Re: Using ajax

2007-12-26 Thread Jeroen
On Dec 26, 2007 11:56 PM, Steve Blades [EMAIL PROTECTED] wrote:
 You have the closing brackets and parens around the functions of your
 .ajax() call, but you don't appear to close out your
 $(document).ready(function(){ // everything is in here });

$(document).ready(function(){
  $.ajax({
  type: GET,
  url: words.php,
  dataType: HTML,
  error: function(){
  alert('Error loading XML document');
  },
  success: function(data){
  alert(Data Loaded:  + data);
  }*);*
});


-- 
Jeroen


[jQuery] Firefox uncaught exception - Please help

2007-12-26 Thread Bill

I have posted this message back in November and received no replies.
I am able to get JQuery Ajax ClueTips to work in Internet Explorer
fine however when I open the same page in firefox the cluetips do not
work and when I look at the error console I see the following

Error: uncaught exception: [Exception... Component returned failure
code: 0x805e000a [nsIXMLHttpRequest.open]  nsresult: 0x805e000a
(unknown)  location: JS frame :: 
http://www.quidizzle.com/scripts/js/jquery.js
:: anonymous :: line 2293  data: no]

this is an example of one of the divs I am trying to display a tooltip
from

div class=nav id=q83 onMouseOut= change(event, 'up')
onMouseDown=change(event, 'down') onMouseUp=change(event, 'up')
onClick=window.location='layout.php?parent=83' href=ADS/
AlfaAD.html rel=ADS/AlfaAD.html div class=nav-img
style=background-image: url('images/stories/navigation/istockimages/
Vehicles.png')/div/div

I really have no clue where to start to fix this error.

I prefer to use Firefox, but for the time being I will have recommend
to users to use internet explorer.

Bill


[jQuery] Re: check if an id exists

2007-12-26 Thread McLars

Hamish, I like that!

Michael, the question is number two on the FAQ. Despite what seasoned
programmers may think, it's obviously not intuitive to newbies.


Personally, I think it's always good to point out alternatives to
learners. The .is() method is actually quite versatile and can be used
to test for more than just existence. It doesn't hurt to keep an open
mind and look at all the alternatives--even for something as simple as
checking existence. I didn't even know about the .is() method before.
I looked in the docs, tried it out, and actually learned something.

Larry


On Dec 26, 3:08 pm, Hamish Campbell [EMAIL PROTECTED] wrote:
 extendify!

 $(document).ready(function() {
         jQuery.fn.exists = function() {
                 return ( this.is('*') )
                 }
         }

 });

 On Dec 27, 10:28 am, Michael Geary [EMAIL PROTECTED] wrote:



  It's funny, if I saw:

  if( $('#id').is('*') ) { ... }

  I would have no clue what the code was trying to do until I thought hard
  about it: Let's see... is star... Now that's going to match *anything*.
  Wouldn't it always return true? Naw, that can't be right, what would be the
  point of this code... Oh! What if there are no elements at all? Then it
  would return false! I think it would anyway. Better check the docs. Hmm...
  The docs don't explicitly say what .is() does when the array is empty.
  Better check the source code, and maybe try a couple of test cases to be
  sure.

  Where if I saw:

  if( $('#id').length ) { ... }

  I would know right away what it does: $() returns an array. Does it have
  any elements? :-)

  -Mike

   From: McLars

   $('#id').length is the old school, and most widely used, technique.
   This is probably the fastest.

   $('#id').is('*') does make sense semantically (expresses the
   intent), and is more flexible.
From: Alexey Blinov

Yep... my code have size(). Forgot to point it...
And thanks for info about more efficient way - using length.
So... which way is better than?

1. $('#id').length  0

2. $('#id').length() !== 0

3. $('#id').is('*') //never try it... but look pretty- Hide quoted text 
-

  - Show quoted text -- Hide quoted text -

 - Show quoted text -


[jQuery] Re: Can jQuery create an element then bind a hover function to it?

2007-12-26 Thread Josh Nathanson


Zarino - it's because you are building the html within the success function 
of the Ajax call, but the binding of the hover function happens outside it.


What you might want to do is put your hover binding into its own function 
that you can call from within the Ajax success function:

var binder = function( divs ) {
   divs.hover( //etc.
}

Then inside your ajax success function:
   binder( $(.show) );

Alternately you could use the LiveQuery plugin which does this sort of thing 
automatically.


-- Josh

- Original Message - 
From: zarino [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, December 26, 2007 3:23 PM
Subject: [jQuery] Can jQuery create an element then bind a hover function to 
it?





Well, I know the answer is yes, but I can't figure out how. Can you
help?

I'm using jQuery to take values from an XML file (a schedule for a
radio station), wrap them up into nice HTML elements, and inject them
into my web page. When the user hovers over any of the jQuery-created
elements, I want something to happen.

Currently, my jQuery code looks like this...


$(document).ready(
function(){

var nowDay = new Date().getDay();
var nowHours = new Date().getHours();
var nowMinutes = new Date().getMinutes();
var nowID = nowDay * 1 + nowHours *100 + nowMinutes;

$.ajax({
type: GET,
url: schedule.xml,
dataType: xml,
success: function(xml) {
$(xml).find('show').each(
function(){

var showStart = $(this).attr('start');
var showEnd = $(this).attr('end');
var showDay = $(this).parent('day').attr('id');
var showTitle = $(this).find('title').text();
var showArtist = $(this).find('artist').text();
var showDescription = $(this).find('description').text();
var showTime = $(this).find('time').text();

$('#'+showDay).append(div class='show'span
class='time'+showTime+/span h3+showTitle+/h3div
class='more-info'p class='artist'+showArtist+/pp
class='description'+showDescription+/p/div/div);

}
);

$(.show).hover(
function(){
$(this).children('.more-info').SlideInUp(500);
}, function(){
$(this).children('.more-info').SlideOutUp(500);
}
);
}
});

}
);


As you can see, I'm trying to bind an animation to the hover event of
all div.show elements on the page. But because they're created by
jQuery, the usual way I'd do it doesn't seem to work.

Any suggestions would be greatly appreciated.

Many thanks :-)

Zarino Zappia 




[jQuery] Re: Firefox uncaught exception - Please help

2007-12-26 Thread Benjamin Sterling
Bill,
What is the url for the page with tooltip?

On 12/26/07, Bill [EMAIL PROTECTED] wrote:


 I have posted this message back in November and received no replies.
 I am able to get JQuery Ajax ClueTips to work in Internet Explorer
 fine however when I open the same page in firefox the cluetips do not
 work and when I look at the error console I see the following

 Error: uncaught exception: [Exception... Component returned failure
 code: 0x805e000a [nsIXMLHttpRequest.open]  nsresult: 0x805e000a
 (unknown)  location: JS frame ::
 http://www.quidizzle.com/scripts/js/jquery.js
 :: anonymous :: line 2293  data: no]

 this is an example of one of the divs I am trying to display a tooltip
 from

 div class=nav id=q83 onMouseOut= change(event,
 'up')
 onMouseDown=change(event, 'down') onMouseUp=change(event, 'up')
 onClick=window.location='layout.php?parent=83' href=ADS/
 AlfaAD.html rel=ADS/AlfaAD.html div class=nav-img
 style=background-image: url('images/stories/navigation/istockimages/
 Vehicles.png')/div/div

 I really have no clue where to start to fix this error.

 I prefer to use Firefox, but for the time being I will have recommend
 to users to use internet explorer.

 Bill




-- 
Benjamin Sterling
http://www.KenzoMedia.com
http://www.KenzoHosting.com
http://www.benjaminsterling.com


[jQuery] Re: Jquery Lightbox or Thickbox and Flickr?

2007-12-26 Thread bdee1


ok so it is working well but the client is asking how he can change the order
of the pictures.  it seems like with flickr you can add photos to sets and
set a specific order, but there doesnt seem to be an rss feed for sets,
only for tagged photos.  but there seems to be no way to set the order of
tagged photos.

how can i make this work fro my client?


bmsterling wrote:
 
 I looks fine to me, can you send me a screen shot of the issue?
 
 On 12/22/07, bdee1 [EMAIL PROTECTED] wrote:



 ok so i just dropped the code into a site template and it seems to work
 fine
 in IE but in firefox, it displays the gallery over and over again with
 weird
 layout.  can youplease take a look?  the url is
 http://beta.asset-guardians.com/portfolio.html
 http://beta.asset-guardians.com/portfolio.html

 you can see all the code by just doign a view source.

 any help would be greatly appreciated!
 --
 View this message in context:
 http://www.nabble.com/Jquery-Lightbox-or-Thickbox-and-Flickr--tp14418944s27240p14474371.html
 Sent from the jQuery General Discussion mailing list archive at
 Nabble.com
 .


 
 
 -- 
 Benjamin Sterling
 http://www.KenzoMedia.com
 http://www.KenzoHosting.com
 http://www.benjaminsterling.com
 
 

-- 
View this message in context: 
http://www.nabble.com/Jquery-Lightbox-or-Thickbox-and-Flickr--tp14418944s27240p14508959.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Re: Jquery Lightbox or Thickbox and Flickr?

2007-12-26 Thread Benjamin Sterling
At best, you can set it to randomize the returned json, but with the current
set up, you can't order it or grab a certain set.

On 12/26/07, bdee1 [EMAIL PROTECTED] wrote:



 ok so it is working well but the client is asking how he can change the
 order
 of the pictures.  it seems like with flickr you can add photos to sets
 and
 set a specific order, but there doesnt seem to be an rss feed for sets,
 only for tagged photos.  but there seems to be no way to set the order of
 tagged photos.

 how can i make this work fro my client?


 bmsterling wrote:
 
  I looks fine to me, can you send me a screen shot of the issue?
 
  On 12/22/07, bdee1 [EMAIL PROTECTED] wrote:
 
 
 
  ok so i just dropped the code into a site template and it seems to work
  fine
  in IE but in firefox, it displays the gallery over and over again with
  weird
  layout.  can youplease take a look?  the url is
  http://beta.asset-guardians.com/portfolio.html
  http://beta.asset-guardians.com/portfolio.html
 
  you can see all the code by just doign a view source.
 
  any help would be greatly appreciated!
  --
  View this message in context:
 
 http://www.nabble.com/Jquery-Lightbox-or-Thickbox-and-Flickr--tp14418944s27240p14474371.html
  Sent from the jQuery General Discussion mailing list archive at
  Nabble.com
  .
 
 
 
 
  --
  Benjamin Sterling
  http://www.KenzoMedia.com
  http://www.KenzoHosting.com
  http://www.benjaminsterling.com
 
 

 --
 View this message in context:
 http://www.nabble.com/Jquery-Lightbox-or-Thickbox-and-Flickr--tp14418944s27240p14508959.html
 Sent from the jQuery General Discussion mailing list archive at Nabble.com
 .




-- 
Benjamin Sterling
http://www.KenzoMedia.com
http://www.KenzoHosting.com
http://www.benjaminsterling.com


[jQuery] Re: Jquery Lightbox or Thickbox and Flickr?

2007-12-26 Thread Benjamin Sterling
Well, like I said, as of right now, can do sets, but if he/she is willing to
append a number infront of the file names you can probably do a sort and get
it in order.

The best place in the code to do that is at about line 223, just swap out
the if statement there with your sort code.

On 12/26/07, bdee1 [EMAIL PROTECTED] wrote:



 really?   man that could really be a problem for me then.  he needs them
 to
 be in a specific order.  wish i knew that before i started.


 bmsterling wrote:
 
  At best, you can set it to randomize the returned json, but with the
  current
  set up, you can't order it or grab a certain set.
 
  On 12/26/07, bdee1 [EMAIL PROTECTED] wrote:
 
 
 
  ok so it is working well but the client is asking how he can change the
  order
  of the pictures.  it seems like with flickr you can add photos to
 sets
  and
  set a specific order, but there doesnt seem to be an rss feed for
 sets,
  only for tagged photos.  but there seems to be no way to set the order
 of
  tagged photos.
 
  how can i make this work fro my client?
 
 
  bmsterling wrote:
  
   I looks fine to me, can you send me a screen shot of the issue?
  
   On 12/22/07, bdee1 [EMAIL PROTECTED] wrote:
  
  
  
   ok so i just dropped the code into a site template and it seems to
  work
   fine
   in IE but in firefox, it displays the gallery over and over again
 with
   weird
   layout.  can youplease take a look?  the url is
   http://beta.asset-guardians.com/portfolio.html
   http://beta.asset-guardians.com/portfolio.html
  
   you can see all the code by just doign a view source.
  
   any help would be greatly appreciated!
   --
   View this message in context:
  
 
 http://www.nabble.com/Jquery-Lightbox-or-Thickbox-and-Flickr--tp14418944s27240p14474371.html
   Sent from the jQuery General Discussion mailing list archive at
   Nabble.com
   .
  
  
  
  
   --
   Benjamin Sterling
   http://www.KenzoMedia.com
   http://www.KenzoHosting.com
   http://www.benjaminsterling.com
  
  
 
  --
  View this message in context:
 
 http://www.nabble.com/Jquery-Lightbox-or-Thickbox-and-Flickr--tp14418944s27240p14508959.html
  Sent from the jQuery General Discussion mailing list archive at
  Nabble.com
  .
 
 
 
 
  --
  Benjamin Sterling
  http://www.KenzoMedia.com
  http://www.KenzoHosting.com
  http://www.benjaminsterling.com
 
 

 --
 View this message in context:
 http://www.nabble.com/Jquery-Lightbox-or-Thickbox-and-Flickr--tp14418944s27240p14509070.html
 Sent from the jQuery General Discussion mailing list archive at Nabble.com
 .




-- 
Benjamin Sterling
http://www.KenzoMedia.com
http://www.KenzoHosting.com
http://www.benjaminsterling.com


[jQuery] Re: Jquery Lightbox or Thickbox and Flickr?

2007-12-26 Thread bdee1


ok so the other thing the client was requesting was to be able to get
captions into the lightbox effect.  i know that i just need to add the
caption to the title attribute of the a tags.  and it looks like the plugin
pulls the flickr caption as the alt tag for the image but how could i have
it set the title tag for each a tag to the same value as the alt tag for
each image?


bmsterling wrote:
 
 At best, you can set it to randomize the returned json, but with the
 current
 set up, you can't order it or grab a certain set.
 
 On 12/26/07, bdee1 [EMAIL PROTECTED] wrote:



 ok so it is working well but the client is asking how he can change the
 order
 of the pictures.  it seems like with flickr you can add photos to sets
 and
 set a specific order, but there doesnt seem to be an rss feed for sets,
 only for tagged photos.  but there seems to be no way to set the order of
 tagged photos.

 how can i make this work fro my client?


 bmsterling wrote:
 
  I looks fine to me, can you send me a screen shot of the issue?
 
  On 12/22/07, bdee1 [EMAIL PROTECTED] wrote:
 
 
 
  ok so i just dropped the code into a site template and it seems to
 work
  fine
  in IE but in firefox, it displays the gallery over and over again with
  weird
  layout.  can youplease take a look?  the url is
  http://beta.asset-guardians.com/portfolio.html
  http://beta.asset-guardians.com/portfolio.html
 
  you can see all the code by just doign a view source.
 
  any help would be greatly appreciated!
  --
  View this message in context:
 
 http://www.nabble.com/Jquery-Lightbox-or-Thickbox-and-Flickr--tp14418944s27240p14474371.html
  Sent from the jQuery General Discussion mailing list archive at
  Nabble.com
  .
 
 
 
 
  --
  Benjamin Sterling
  http://www.KenzoMedia.com
  http://www.KenzoHosting.com
  http://www.benjaminsterling.com
 
 

 --
 View this message in context:
 http://www.nabble.com/Jquery-Lightbox-or-Thickbox-and-Flickr--tp14418944s27240p14508959.html
 Sent from the jQuery General Discussion mailing list archive at
 Nabble.com
 .


 
 
 -- 
 Benjamin Sterling
 http://www.KenzoMedia.com
 http://www.KenzoHosting.com
 http://www.benjaminsterling.com
 
 

-- 
View this message in context: 
http://www.nabble.com/Jquery-Lightbox-or-Thickbox-and-Flickr--tp14418944s27240p14509107.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Re: Jquery Lightbox or Thickbox and Flickr?

2007-12-26 Thread Benjamin Sterling
Change line 193 to:

 var $a = $('a
title='+photos[i]['title']+'/').attr('href',photos[i]['full']['url']);

On 12/26/07, bdee1 [EMAIL PROTECTED] wrote:



 ok so the other thing the client was requesting was to be able to get
 captions into the lightbox effect.  i know that i just need to add the
 caption to the title attribute of the a tags.  and it looks like the
 plugin
 pulls the flickr caption as the alt tag for the image but how could i have
 it set the title tag for each a tag to the same value as the alt tag for
 each image?


 bmsterling wrote:
 
  At best, you can set it to randomize the returned json, but with the
  current
  set up, you can't order it or grab a certain set.
 
  On 12/26/07, bdee1 [EMAIL PROTECTED] wrote:
 
 
 
  ok so it is working well but the client is asking how he can change the
  order
  of the pictures.  it seems like with flickr you can add photos to
 sets
  and
  set a specific order, but there doesnt seem to be an rss feed for
 sets,
  only for tagged photos.  but there seems to be no way to set the order
 of
  tagged photos.
 
  how can i make this work fro my client?
 
 
  bmsterling wrote:
  
   I looks fine to me, can you send me a screen shot of the issue?
  
   On 12/22/07, bdee1 [EMAIL PROTECTED] wrote:
  
  
  
   ok so i just dropped the code into a site template and it seems to
  work
   fine
   in IE but in firefox, it displays the gallery over and over again
 with
   weird
   layout.  can youplease take a look?  the url is
   http://beta.asset-guardians.com/portfolio.html
   http://beta.asset-guardians.com/portfolio.html
  
   you can see all the code by just doign a view source.
  
   any help would be greatly appreciated!
   --
   View this message in context:
  
 
 http://www.nabble.com/Jquery-Lightbox-or-Thickbox-and-Flickr--tp14418944s27240p14474371.html
   Sent from the jQuery General Discussion mailing list archive at
   Nabble.com
   .
  
  
  
  
   --
   Benjamin Sterling
   http://www.KenzoMedia.com
   http://www.KenzoHosting.com
   http://www.benjaminsterling.com
  
  
 
  --
  View this message in context:
 
 http://www.nabble.com/Jquery-Lightbox-or-Thickbox-and-Flickr--tp14418944s27240p14508959.html
  Sent from the jQuery General Discussion mailing list archive at
  Nabble.com
  .
 
 
 
 
  --
  Benjamin Sterling
  http://www.KenzoMedia.com
  http://www.KenzoHosting.com
  http://www.benjaminsterling.com
 
 

 --
 View this message in context:
 http://www.nabble.com/Jquery-Lightbox-or-Thickbox-and-Flickr--tp14418944s27240p14509107.html
 Sent from the jQuery General Discussion mailing list archive at Nabble.com
 .




-- 
Benjamin Sterling
http://www.KenzoMedia.com
http://www.KenzoHosting.com
http://www.benjaminsterling.com


[jQuery] load a page, then use ajax to load html + script inside that page

2007-12-26 Thread Pierre

Hello all

I have a problem that has been discussed several times on this list,
but I could not find a satisfactory solution yet.

I created a regular html page. I have a onclick event which triggers
an ajax call. This ajax call runs a very simple php script on my
server, which returns some html as well as a little jquery call that
uses the preceding html. The problem is that the javascript is
evaluated before the html is loaded into the DOM, and it can't find
the html id it is supposed to manipulate.

Here is a simplified version of my code
page:
html
.
.
body
div id=buttonbutton/div
script type=text/javascript
function displayAjax(data)
{
  $(#button).after(data);
}
$(#button).click(function(){
  $.post('ajax.php', '',function(data){displayAjax(data);});
});
/script
/body
/html

ajax.php:
?php
die('div id=resultresult/div
script type=text/javascript
function test()
{
  alert($(#result).length);
}
test();
/script');
?

So the problem is that the javascript is evaluated before #result
exists in the DOM.


Now I know that I can move my test function from ajax.php to the page
initiating the ajax call, but it doesn't really make sense, as this
piece of javascript is very specific to the html defined in ajax.php.

I also saw that some people on the list worked around that by using a
setTimeout, but honestly I'd rather not do that.

So, if someone knows how to do that the right way, please let me know.
Also, if what I am trying to do is downright impossible, let me know
too please.

Happy Holidays!!

Pierre


[jQuery] Re: FadeIn on $(document).ready flicker

2007-12-26 Thread Hamish Campbell

Using FF2, FF3b2, IE7 and IE6 I don't get the flicker (XP SP2,
1280x1024, P4 3.2Ghz). Do you have a demo? Maybe you're running lots
of other code first?

On Dec 27, 10:51 am, Jeroen [EMAIL PROTECTED] wrote:
 I'm using jQuery on my new photo blog. I am fading in the image when
 the dom has loaded like this:

 $(function() {
         // Animate photo
         $('#photo').hide();
         $('#photo').fadeIn(1500);

 }

 The problem is, the photo flickers for about a millisecond, as in, you
 can see it
 in full opacity. I can fix this by, in the html, providing a 'display:
 none;' but
 then non JS browsers will not see the photo. Is there a Unobtrusive way to
 fix this?

 Problem is cross browser. Not only IE.

 Thanks!

 --
 Jeroen


[jQuery] Re: label fires click function twice

2007-12-26 Thread Shawn

Remember event bubbling is taking place for ALL events.

I suspect you will need to stop the event propagation to resolve this 
issue.  This can be done one of two ways:

1) Return false from your click handler function.
$(#r1).click(function () {
   window.console.log(hello);
   return false;
});

2) call stopPropagation() method of the event object
$(#r1).click(function (e) {
   window.console.log(hello);
   e.stopPropagation();
});

Also, in your sample code, you have $('r1').  There is no tags called 
r1.  I suspect you meant $(#r1), and that this is just a typo in 
your post.  But you might want to check that.. :)

HTH

Shawn


Michael Nosal wrote:
 If I have a div with a label and input in it:
 div id=tab
   input type=radio id=r1 value=foo
   label for=r1My Label/label
 /div
 
 and I add a click handler like so:
 $('r1').click(function() {
   window.console.log(hello);
 });
 
 Clicking the div or the radio button gets one call to the click function.
 Clicking the label element results in the click function being called twice.
 Known? Unknown? Workaround?
 Using jquery 1.2.1
 
 --Mike N.