[jQuery] Re: Loading external text in to a text area?

2009-09-07 Thread Nic Hubbard

If you use $.ajax and the success option, you could do:

$(''+html+' wrote:
> Hello, I would like to know if I can load a small text from a external source 
> into a textarea.
> the external source is a php that will write some clean text depending on the 
> vars received.
> I know load() can do the job for a div but I don't think it will work for a 
> textarea.


[jQuery] Using serialize() with one form field

2009-08-17 Thread Nic Hubbard

Is it possible to use serialize with just one form field?  I am
constructing a url to send with $.post and I need to convert the
spaces and special characters of a field.

Currently this does not seem to work:

var news_letter_email = $('#newsletter_email').serialize();

Ideas for how this can be achieved?


[jQuery] Re: Get vars from one event function to another

2009-08-12 Thread Nic Hubbard

Thanks James for that tip.

Still looking for how to pass a var from one event function to
another...

On Aug 12, 4:28 pm, James  wrote:
> I'm not sure I understand what you're trying to do with the change()
> function...
> You know you can get the value of a select just with val(). You don't
> have to loop through each option to find which is selected.
>
> 
>     1
>     2
> 
>
> var myVal = $("#mySelect").val(); // 1 or 2
>
> On Aug 12, 1:18 pm, Nic Hubbard  wrote:
>
> > I am confused about how to do this the right way.
>
> > I have a change event which grabs the value of the selected option
> > list and sets that as a var.  But, I would like to add that to the end
> > of my post string when I submit the form, how would I do this?
>
> > $('select').change(function() {
>
> >         $('select option:selected').each(function() {
>
> >                 var my_val = $(this).val();
>
> >         });//end each
>
> > });//end change
>
> > $('#my_submit').submit(function() {
>
> >         var action = $('form').attr('action');
> >         // How do I get my_val variable into here??
> >         $('form').attr('action', action + 'new_parm=' + my_val);
>
> > });


[jQuery] Get vars from one event function to another

2009-08-12 Thread Nic Hubbard

I am confused about how to do this the right way.

I have a change event which grabs the value of the selected option
list and sets that as a var.  But, I would like to add that to the end
of my post string when I submit the form, how would I do this?

$('select').change(function() {

$('select option:selected').each(function() {

var my_val = $(this).val();

});//end each

});//end change

$('#my_submit').submit(function() {

var action = $('form').attr('action');
// How do I get my_val variable into here??
$('form').attr('action', action + 'new_parm=' + my_val);

});


[jQuery] Re: Using .live and .each

2009-08-06 Thread Nic Hubbard

Sorry, I slipped up while typing.  I meant I am NOW using ajax as
well.

Using ajax I bring in new content such as:

my iso date

Each time I insert these into the DOM they need to be converted.  The
above script was used to convert them on page load and did not account
for content being added using ajax.

On Aug 5, 5:14 pm, James  wrote:
> It's not clear what you want to do. You said you are "not using ajax"
> but you have content "brought in through ajax". What exactly do you
> need $.live for? For what browser event?
>
> On Aug 5, 1:17 pm, Nic Hubbard  wrote:
>
>
>
> > Anyone?  Someone must have done this...
>
> > On Aug 5, 11:32 am, Nic Hubbard  wrote:
>
> > > I have a script that runs when I load the page which converts some
> > > dates.  I am not using ajax as well, and I need to use .live to
> > > convert the dates that I brought in through ajax.  How would I
> > > combine .live with .each and make it work?
>
> > > if ($("span.ISODate").length > 0) {
> > >         $("span.ISODate").each(function() {
> > >                 $(this).text(getTFID($(this).text()))
> > >         });
>
> > > }


[jQuery] Re: Using .live and .each

2009-08-05 Thread Nic Hubbard

Anyone?  Someone must have done this...

On Aug 5, 11:32 am, Nic Hubbard  wrote:
> I have a script that runs when I load the page which converts some
> dates.  I am not using ajax as well, and I need to use .live to
> convert the dates that I brought in through ajax.  How would I
> combine .live with .each and make it work?
>
> if ($("span.ISODate").length > 0) {
>         $("span.ISODate").each(function() {
>                 $(this).text(getTFID($(this).text()))
>         });
>
>
>
> }


[jQuery] Using .live and .each

2009-08-05 Thread Nic Hubbard

I have a script that runs when I load the page which converts some
dates.  I am not using ajax as well, and I need to use .live to
convert the dates that I brought in through ajax.  How would I
combine .live with .each and make it work?

if ($("span.ISODate").length > 0) {
$("span.ISODate").each(function() {
$(this).text(getTFID($(this).text()))
});
}


[jQuery] Re: jQuery and javascript objects

2009-07-07 Thread Nic Hubbard

Is it possible to use the .each() function on an object that came from
JSON?

On Jul 7, 11:54 pm, Nic Hubbard  wrote:
> I have some JSON that I returned from my server.  I then converted it
> to an object using eval.  It is only then that I can start
> manipulating it with jQuery (trust me).  Currently the multilevel
> object is set in a var.  Is there a way that I can then have jQuery
> use this, to get values from it?  Or is there no sense in trying to
> use jQuery for this, and it might not even be of help?
>
> Thanks.


[jQuery] jQuery and javascript objects

2009-07-07 Thread Nic Hubbard

I have some JSON that I returned from my server.  I then converted it
to an object using eval.  It is only then that I can start
manipulating it with jQuery (trust me).  Currently the multilevel
object is set in a var.  Is there a way that I can then have jQuery
use this, to get values from it?  Or is there no sense in trying to
use jQuery for this, and it might not even be of help?

Thanks.


[jQuery] Re: Live() event doesnot refresh the class of the event which was changed dynamically.

2009-07-05 Thread Nic Hubbard

Pretty sure that you have to create a new .live() event for your
expected class.  So, you would need to do:

 $(".newClass").live("mouseover", function(){
//clickable function here..

});

On Jul 5, 12:30 am, Sanam  wrote:
> Hello,
>      I got this problem with live() event.I have used it as  follows.
>
>     $(".addressDiv span").live("mouseover", function(){
>     //clickable function here..
>     
>     });
>
> I have used the live() event to trigger the function on mouseover in
> the dynamically added elements. But the problem i got is that once the
> live event is called it takes the class of the element and stores. And
> when the class of that particular element is changed dynamically the
> live() event does not detect the new classed added dynamically,
> instead it takes the former class. Live() event does not update the
> class.  How can I solve this problem?
>
> Sanam


[jQuery] Start Animation from Center of Screen

2009-06-30 Thread Nic Hubbard

I have some animated text using the top and left css properties.  But,
everything starts from the top left of my screen.  How could I make
the animation start from the center, and then float out from there?

Example Page:
http://www.puc.edu/media/reasons/who-is-god

jQuery Code:

$(document).ready(function(){

// Start floater function
var floater = function()
{

$('.floater').each(function() {

// Random Times
var timeout = Array();
timeout[0] = 4000;
timeout[1] = 5000;
timeout[2] = 1;
timeout[3] = 15000;
timeout[4] = 2;
timeout[5] = 25000;
timeout[6] = 3;

var time = timeout[Math.floor(Math.random() * 
timeout.length)];

$(this).animate({
'marginTop':(Math.random() * 
$(window).height()) + 'px',
'marginLeft':(Math.random() * 
$(window).width()) + 'px'
},
time,'swing',function(){
setTimeout(floater,10);
});// End animate
});// End each
}// End floater

// Execute our function
floater();

// Stop animation when button is clicked
$('.floater').mouseover(function(){
  $(this).stop();
  $(this).children('p').fadeIn('slow');
});

$('.floater').mouseout(function(){
//floater();
});

// Add our colors
$('.floater').each(function()
{
// Create array of colors
var colors = Array();
colors[0] = '#66ff44';
colors[1] = '#9900ff';
colors[2] = '#ff11ff';
colors[3] = '#ff2266';
colors[4] = '#ff7755';
colors[5] = '#ffbb55';
colors[6] = '#eeff33';

// Random hex value
var color_hex = colors[Math.floor(Math.random() * 
colors.length)];

$(this).css('color', color_hex);

});// End each


});// End ready



[jQuery] Re: Float Image on Page

2009-06-30 Thread Nic Hubbard

I figured it out, I just used the .each function so that each floater
would get a random value. :)

On Jun 29, 9:41 pm, Nic Hubbard  wrote:
> Is there a way to make this more random?  Meaning, if I have multiple
> images, using the above script they all kind of go on the same
> direction.
>
> Thanks again.
>
> On Jun 29, 9:19 pm, mkmanning  wrote:
>
>
>
> > Quick example:
>
> > $(document).ready(function(){
> > var floater = function(){
> >          $('img').animate( {'marginTop':(Math.random() * $(window).height())
> > + 'px','marginLeft':(Math.random() * $(window).width()) + 'px'},
> > 2000,'linear',function(){
> >                 setTimeout(floater,10);
> >          } );
>
> > }
> > floater();
> > });
>
> > Hope that can give you someplace to start.
>
> > On Jun 29, 4:32 pm, Nic Hubbard  wrote:
>
> > > I have been trying to find a solution to this for a while, but all I
> > > can find is about style:float which is not what I want.
>
> > > I would like to animate an image randomly around the screen.  So, it
> > > could slowly float across the screen, and would randomly choose its
> > > motion.
>
> > > Any ideas?


[jQuery] Re: Float Image on Page

2009-06-29 Thread Nic Hubbard

Is there a way to make this more random?  Meaning, if I have multiple
images, using the above script they all kind of go on the same
direction.

Thanks again.

On Jun 29, 9:19 pm, mkmanning  wrote:
> Quick example:
>
> $(document).ready(function(){
> var floater = function(){
>          $('img').animate( {'marginTop':(Math.random() * $(window).height())
> + 'px','marginLeft':(Math.random() * $(window).width()) + 'px'},
> 2000,'linear',function(){
>                 setTimeout(floater,10);
>          } );
>
> }
> floater();
> });
>
> Hope that can give you someplace to start.
>
> On Jun 29, 4:32 pm, Nic Hubbard  wrote:
>
> > I have been trying to find a solution to this for a while, but all I
> > can find is about style:float which is not what I want.
>
> > I would like to animate an image randomly around the screen.  So, it
> > could slowly float across the screen, and would randomly choose its
> > motion.
>
> > Any ideas?


[jQuery] Re: Float Image on Page

2009-06-29 Thread Nic Hubbard

Thanks!  This is just what I was looking for!

On Jun 29, 9:19 pm, mkmanning  wrote:
> Quick example:
>
> $(document).ready(function(){
> var floater = function(){
>          $('img').animate( {'marginTop':(Math.random() * $(window).height())
> + 'px','marginLeft':(Math.random() * $(window).width()) + 'px'},
> 2000,'linear',function(){
>                 setTimeout(floater,10);
>          } );
>
> }
> floater();
> });
>
> Hope that can give you someplace to start.
>
> On Jun 29, 4:32 pm, Nic Hubbard  wrote:
>
> > I have been trying to find a solution to this for a while, but all I
> > can find is about style:float which is not what I want.
>
> > I would like to animate an image randomly around the screen.  So, it
> > could slowly float across the screen, and would randomly choose its
> > motion.
>
> > Any ideas?


[jQuery] Float Image on Page

2009-06-29 Thread Nic Hubbard

I have been trying to find a solution to this for a while, but all I
can find is about style:float which is not what I want.

I would like to animate an image randomly around the screen.  So, it
could slowly float across the screen, and would randomly choose its
motion.

Any ideas?


[jQuery] Re: Object as Function argument

2009-06-24 Thread Nic Hubbard

How does jQuery do it for plugins?  I was wanting to be able to use
callbacks as well in the object.

What is happening what a plugin uses: var options = $.extend(defaults,
options);

Somehow, that is getting the object to pass through as the function
params.

Any help on this?

On Jun 24, 12:09 am, fredrik  wrote:
> Not really sure what you are after. But I think you need to make an
> new instance of test first:
>
> var test = function (defaults){
>     this.defaults = defaults || this.defaults;
>     alert(this.defaults.test);
>
> }
>
> test.prototype = {
>     defaults : { test : 'nothing' }
>
> };
>
> new test();
> new test({test: 'hello world'});
>
> On Jun 24, 8:07 am, Nic Hubbard  wrote:
>
>
>
> > I have used an object in the past as a function argument, but this was
> > for a plugin that I wrote.  Using it in the architecture of a plugin
> > it worked.
>
> > BUT, this time, I just want to write a normal function, but still use
> > an object to set defaults and pass in changes to those defaults
> > through as a param.  Is this possible, or do I have to make this a
> > jQuery function like $.myfunction() ?
>
> > I am trying:
>
> > function test(defaults)
> > {
> >         var defaults = {
> >                 test: ''
> >         };
>
> > alert(defaults.test);
>
> > }
>
> > test({test: 'It works!'});
>
> > The above does not seem to work, and replace the default with that was
> > passed in the function.  What am I doing wrong here?


[jQuery] Object as Function argument

2009-06-23 Thread Nic Hubbard

I have used an object in the past as a function argument, but this was
for a plugin that I wrote.  Using it in the architecture of a plugin
it worked.

BUT, this time, I just want to write a normal function, but still use
an object to set defaults and pass in changes to those defaults
through as a param.  Is this possible, or do I have to make this a
jQuery function like $.myfunction() ?

I am trying:

function test(defaults)
{
var defaults = {
test: ''
};

alert(defaults.test);
}

test({test: 'It works!'});

The above does not seem to work, and replace the default with that was
passed in the function.  What am I doing wrong here?


[jQuery] Looping through getJSON data

2009-06-23 Thread Nic Hubbard

I am returning data from the .getJSON() function and trying to write
is all out in the body.  But, for some reason this is not working at
all.  What have I done wrong?

$.getJSON(api_url, params,
function(data, texStatus)   {
// Check our array
for (i=0;i

[jQuery] Re: Array to JSON?

2009-06-23 Thread Nic Hubbard

Well, right now I am sending JSON to my php script which then uses
json_decode() to make them into vars.  But, I am wondering, is sending
JSON the best way?  Or should I just send the data as a normal query
string, rather than JSON?  Which is best?

On Jun 22, 5:13 pm, cs  wrote:
> Why not make each field that has a nested key-value pair an object
> instead? In short, any array with a key but without a value is an
> object since your value is just an array of elements. What language is
> in charge of your back-end? And how is it handling the inputs your
> pass it? This is what really counts.
>
> JSON is
>
> On Jun 22, 7:01 pm, Nic Hubbard  wrote:
>
>
>
> > Yeah, I am not too hot on using a plugin for this.  I had hoped there
> > was just a quick function that I could pass in an array and return
> > JSON.
>
> > On Jun 22, 8:28 am, diogobaeder  wrote:
>
> > > Hmmm... why would one use this plugin if we have Douglas Crockford's
> > > json2.org, which is the original JSON library from the same creator of
> > > the concept "JSON"? And why load more modules into the main jQuery
> > > object, making it heavier, if we don't use DOM element wrappers in the
> > > plugin, only conversions to/from JS objects?
>
> > > Sorry, I don't mean to be harsh, but it seems to me that this plugin
> > > is a reinvented wheel, and also that it didn't have to be a "jQuery
> > > plugin" to work. Does it have anything that we can't see in json2.org?
>
> > > Diogo
>
> > > On Jun 21, 11:39 pm, kranthi  wrote:
>
> > > > are u looking forhttp://www.google.co.in/search?q=jquery+json+plugin?


[jQuery] Re: Array to JSON?

2009-06-22 Thread Nic Hubbard

Yeah, I am not too hot on using a plugin for this.  I had hoped there
was just a quick function that I could pass in an array and return
JSON.

On Jun 22, 8:28 am, diogobaeder  wrote:
> Hmmm... why would one use this plugin if we have Douglas Crockford's
> json2.org, which is the original JSON library from the same creator of
> the concept "JSON"? And why load more modules into the main jQuery
> object, making it heavier, if we don't use DOM element wrappers in the
> plugin, only conversions to/from JS objects?
>
> Sorry, I don't mean to be harsh, but it seems to me that this plugin
> is a reinvented wheel, and also that it didn't have to be a "jQuery
> plugin" to work. Does it have anything that we can't see in json2.org?
>
> Diogo
>
> On Jun 21, 11:39 pm, kranthi  wrote:
>
>
>
> > are u looking forhttp://www.google.co.in/search?q=jquery+json+plugin?


[jQuery] Array to JSON?

2009-06-21 Thread Nic Hubbard

I have been trying to figure out how I could go from an associative
array to JSON.  Is there a function for this?


[jQuery] getJSON items

2009-06-19 Thread Nic Hubbard

It is possible to have getJSON() grab all of the data pairs and put
them into a js array?  Rather than having to know the names of the
data?


[jQuery] Loop through XML to find children

2009-06-19 Thread Nic Hubbard

I have an XML structure like the following:


  1
  2
  3


This XML gets returned to me after an ajax post, so I can get the tags
using:
$(xml).find('item').each(function() {
var 1 = $(this).children('attr1').text();
var 2 = $(this).children('attr2').text();
}

But, what if I don't want to set those into vars, but push each
attribute into an array, even if I don't know the name?  Also, could I
push them into an associative array so that I the name/value pairs are
together?

Thanks!


[jQuery] Random Image from Array

2009-06-08 Thread Nic Hubbard

I have some image URLs stored in an array.  I then want to be able to
print out one of those image URLs randomly on page load.  What would
be the best method to do this in jQuery?

My array looks like:

var theImages = new Array()
theImages[1] = 'http://www.puc.edu/__data/assets/image/0014/16007/
visual_arts1.jpg'
theImages[2] = 'http://www.puc.edu/__data/assets/image/0015/16008/
visual_arts2.jpg'
theImages[3] = 'http://www.puc.edu/__data/assets/image/0017/16208/
visual_arts3.jpg'
theImages[4] = 'http://www.puc.edu/__data/assets/image/0018/19035/
visual_arts4.jpg'


[jQuery] Re: Hover image under flash element.....

2009-06-02 Thread Nic Hubbard

You need to use the wmode for your flash element.  Setting wmode to
opaque should fix this.

On Jun 2, 5:38 am, Warrick  wrote:
> I am trying to place several hover/tool tips using jQuery in a page
> that contains a flash elemnt to the right. When viewed in a browser
> the hover/tool tip appears partially below the adjacent flash element.
> Any one have any ideas???
> Thanks


[jQuery] Pass var to click event

2009-05-25 Thread Nic Hubbard

I am having trouble passing a variable into a function used within a
click event.  I am doing the following:

var test = 'Works!';
$('#action_confirm').click(function(test) {
alert(test);
});

I keep getting undefined.  What am I doing wrong?


[jQuery] Submit form when hitting enter

2009-05-20 Thread Nic Hubbard

I have a form that I built, and I replaced the submit button with an
image.  When you click the image, it calls the .submit() jQuery
function and submits the form.

Because I am not using the normal submit input button, hitting enter
in most browsers won't submit the form.  I think that users are used
to this happening, so I would like to replicate this.

What would I need to do?  Can I trigger the .submit() function when
the enter button is hit?


[jQuery] Re: Cycle Plugin - Can't Get Pause To Work

2009-04-29 Thread Nic Hubbard

Hi Mike,

Yes, still having issues.  It is not the anchors that I am concerned
about (the pause/play icon).  It is when you click the "Contact about
this artwork" link, it should be pausing the cycle, which it is not
doing.

This is where my problem lies.

On Apr 29, 10:15 am, Mike Alsup  wrote:
> Nic, Are you still having a problem with this?  Your pause and resume
> anchors appear to be working just fine.
>
> Mike
>
> On Apr 27, 3:04 am, Nic Hubbard  wrote:
>
> > Really?  No one knows why the cycle pause is not working?  Someone
> > must be using this!
>
> > On Apr 24, 8:25 am, Nic Hubbard  wrote:
>
> > > Anyone?
>
> > > On Apr 23, 9:44 pm, Nic Hubbard  wrote:
>
> > > > Shawn,
>
> > > > Yes, I havepauseon hover set, and this is correctly working.  It is
> > > > when the overlay comes up, and it is suppose topausethe current
> > > > image, which, my code seems to be correct to do so $
> > > > ('#artistCycleParent').cycle('pause'); but it just keeps cycling and
> > > > does not honor thepause.
>
> > > > I have it in my click function, and everything in the click function
> > > > does work, but not thepause.  Once the user clicks off of the
> > > > overlay, it should resume.
>
> > > > On Apr 23, 9:22 pm, Shawn  wrote:
>
> > > > >Pauseis working for me, with a catch.
>
> > > > > If my mouse is not over the image, it cycles.  Placing my mouse over 
> > > > > the
> > > > > image pauses the cycling.
>
> > > > > Clicking the link brings up an overlay (?) and a form - at this point
> > > > > the mouse is not "over" the image, but over the overlay/form.  So the
> > > > > image cycles as it should.
>
> > > > > I don't think you want thepauseoption here.  I think you want to
> > > > > progamatically start/stop the cycling.  See the section "Manually
> > > > > Pausing a slideshow" athttp://malsup.com/jquery/cycle/int2.html.
>
> > > > > HTH.
>
> > > > > Shawn
>
> > > > > Nic Hubbard wrote:
> > > > > > I am using thecycleplugin, but for some reason I can't get thepause
> > > > > > feature to work.  I am showing a hidden div, and when I do, I need 
> > > > > > to
> > > > > >pausethe slideshow.
> > > > > > Here is what I am using:
>
> > > > > >    $('#artistCycleParent').cycle({
> > > > > >            fx:      'fade',
> > > > > >            speed:    3000,
> > > > > >            timeout:  5000,
> > > > > >            pause:  1,
> > > > > >            next:   '#artworkNext',
> > > > > >            prev:   '#artworkPrev'
> > > > > >    });
>
> > > > > >    //Pausethecycle
> > > > > >    $('#pauseButton').click(function() {
> > > > > >            $('#artistCycleParent').cycle('pause');
> > > > > >            $(this).hide();
> > > > > >            $('#resumeButton').show();
> > > > > >            return false;
> > > > > >    });
>
> > > > > >    // Resume thecycle
> > > > > >    $('#resumeButton').click(function() {
> > > > > >            $('#artistCycleParent').cycle('resume');
> > > > > >            $(this).hide();
> > > > > >            $('#pauseButton').show();
> > > > > >            return false;
> > > > > >    });
>
> > > > > > The code looks ok to me, but it just does not seem topause.
>
> > > > > > Example:http://www.caldwellsnyder.com/artists/montoya-ortiz/view-artworks
> > > > > > Click on "Contact about artwork"
>
> > > > > > Thanks.


[jQuery] Re: Cycle Plugin - Can't Get Pause To Work

2009-04-27 Thread Nic Hubbard

Really?  No one knows why the cycle pause is not working?  Someone
must be using this!

On Apr 24, 8:25 am, Nic Hubbard  wrote:
> Anyone?
>
> On Apr 23, 9:44 pm, Nic Hubbard  wrote:
>
> > Shawn,
>
> > Yes, I havepauseon hover set, and this is correctly working.  It is
> > when the overlay comes up, and it is suppose topausethe current
> > image, which, my code seems to be correct to do so $
> > ('#artistCycleParent').cycle('pause'); but it just keeps cycling and
> > does not honor thepause.
>
> > I have it in my click function, and everything in the click function
> > does work, but not thepause.  Once the user clicks off of the
> > overlay, it should resume.
>
> > On Apr 23, 9:22 pm, Shawn  wrote:
>
> > >Pauseis working for me, with a catch.
>
> > > If my mouse is not over the image, it cycles.  Placing my mouse over the
> > > image pauses the cycling.
>
> > > Clicking the link brings up an overlay (?) and a form - at this point
> > > the mouse is not "over" the image, but over the overlay/form.  So the
> > > image cycles as it should.
>
> > > I don't think you want thepauseoption here.  I think you want to
> > > progamatically start/stop the cycling.  See the section "Manually
> > > Pausing a slideshow" athttp://malsup.com/jquery/cycle/int2.html.
>
> > > HTH.
>
> > > Shawn
>
> > > Nic Hubbard wrote:
> > > > I am using thecycleplugin, but for some reason I can't get thepause
> > > > feature to work.  I am showing a hidden div, and when I do, I need to
> > > >pausethe slideshow.
> > > > Here is what I am using:
>
> > > >    $('#artistCycleParent').cycle({
> > > >            fx:      'fade',
> > > >            speed:    3000,
> > > >            timeout:  5000,
> > > >            pause:  1,
> > > >            next:   '#artworkNext',
> > > >            prev:   '#artworkPrev'
> > > >    });
>
> > > >    //Pausethecycle
> > > >    $('#pauseButton').click(function() {
> > > >            $('#artistCycleParent').cycle('pause');
> > > >            $(this).hide();
> > > >            $('#resumeButton').show();
> > > >            return false;
> > > >    });
>
> > > >    // Resume thecycle
> > > >    $('#resumeButton').click(function() {
> > > >            $('#artistCycleParent').cycle('resume');
> > > >            $(this).hide();
> > > >            $('#pauseButton').show();
> > > >            return false;
> > > >    });
>
> > > > The code looks ok to me, but it just does not seem topause.
>
> > > > Example:http://www.caldwellsnyder.com/artists/montoya-ortiz/view-artworks
> > > > Click on "Contact about artwork"
>
> > > > Thanks.


[jQuery] Re: Safari Layout Issues

2009-04-24 Thread Nic Hubbard

Ok, sorry guys, I realized I had come .css files below my .js files,
this was causing the conflict in Safari.

On Apr 24, 12:55 pm, Nic Hubbard  wrote:
> Here is the cycle code I am using:
>
> if ($('#home_exhibition_hold').length) {
>                 $('#home_exhibition_hold').cycle({
>                         fx:      'fade',
>                         speed:    2000,
>                         timeout:  7000,
>                         pause:  0,
>                         pager:   '#slide_pager'
>                 });
>         }
>         if ($('.home_slides').length < 2) {
>                 $('#slide_pager').hide();
>         }
>
> On Apr 24, 12:54 pm, Nic Hubbard  wrote:
>
> > For some strange reason I am only having layout issues in Safari, even
> > IE6 renders the page correctly!  I have using jQuery Cycle on the
> > page, and I am starting to wonder if that is what is causing the
> > layout issue.
>
> > Example:  http://www.caldwellsnyder.com/home
>
> > It seems that the div #home_exhibition_hold won't honor the height and
> > width settings when loaded in Safari.  And I am wondering if there is
> > some js that is effecting this.
>
> > Does anyone have any ideas?


[jQuery] Re: Safari Layout Issues

2009-04-24 Thread Nic Hubbard

Here is the cycle code I am using:

if ($('#home_exhibition_hold').length) {
$('#home_exhibition_hold').cycle({
fx:  'fade',
speed:2000,
timeout:  7000,
pause:  0,
pager:   '#slide_pager'
});
}
if ($('.home_slides').length < 2) {
$('#slide_pager').hide();
}


On Apr 24, 12:54 pm, Nic Hubbard  wrote:
> For some strange reason I am only having layout issues in Safari, even
> IE6 renders the page correctly!  I have using jQuery Cycle on the
> page, and I am starting to wonder if that is what is causing the
> layout issue.
>
> Example:  http://www.caldwellsnyder.com/home
>
> It seems that the div #home_exhibition_hold won't honor the height and
> width settings when loaded in Safari.  And I am wondering if there is
> some js that is effecting this.
>
> Does anyone have any ideas?


[jQuery] Safari Layout Issues

2009-04-24 Thread Nic Hubbard

For some strange reason I am only having layout issues in Safari, even
IE6 renders the page correctly!  I have using jQuery Cycle on the
page, and I am starting to wonder if that is what is causing the
layout issue.

Example:  http://www.caldwellsnyder.com/home

It seems that the div #home_exhibition_hold won't honor the height and
width settings when loaded in Safari.  And I am wondering if there is
some js that is effecting this.

Does anyone have any ideas?


[jQuery] Re: Cycle Plugin - Can't Get Pause To Work

2009-04-24 Thread Nic Hubbard

Anyone?

On Apr 23, 9:44 pm, Nic Hubbard  wrote:
> Shawn,
>
> Yes, I have pause on hover set, and this is correctly working.  It is
> when the overlay comes up, and it is suppose to pause the current
> image, which, my code seems to be correct to do so $
> ('#artistCycleParent').cycle('pause'); but it just keeps cycling and
> does not honor the pause.
>
> I have it in my click function, and everything in the click function
> does work, but not the pause.  Once the user clicks off of the
> overlay, it should resume.
>
> On Apr 23, 9:22 pm, Shawn  wrote:
>
> > Pause is working for me, with a catch.
>
> > If my mouse is not over the image, it cycles.  Placing my mouse over the
> > image pauses the cycling.
>
> > Clicking the link brings up an overlay (?) and a form - at this point
> > the mouse is not "over" the image, but over the overlay/form.  So the
> > image cycles as it should.
>
> > I don't think you want the pause option here.  I think you want to
> > progamatically start/stop the cycling.  See the section "Manually
> > Pausing a slideshow" athttp://malsup.com/jquery/cycle/int2.html.
>
> > HTH.
>
> > Shawn
>
> > Nic Hubbard wrote:
> > > I am using the cycle plugin, but for some reason I can't get the pause
> > > feature to work.  I am showing a hidden div, and when I do, I need to
> > > pause the slideshow.
> > > Here is what I am using:
>
> > >    $('#artistCycleParent').cycle({
> > >            fx:      'fade',
> > >            speed:    3000,
> > >            timeout:  5000,
> > >            pause:  1,
> > >            next:   '#artworkNext',
> > >            prev:   '#artworkPrev'
> > >    });
>
> > >    // Pause the cycle
> > >    $('#pauseButton').click(function() {
> > >            $('#artistCycleParent').cycle('pause');
> > >            $(this).hide();
> > >            $('#resumeButton').show();
> > >            return false;
> > >    });
>
> > >    // Resume the cycle
> > >    $('#resumeButton').click(function() {
> > >            $('#artistCycleParent').cycle('resume');
> > >            $(this).hide();
> > >            $('#pauseButton').show();
> > >            return false;
> > >    });
>
> > > The code looks ok to me, but it just does not seem to pause.
>
> > > Example:http://www.caldwellsnyder.com/artists/montoya-ortiz/view-artworks
> > > Click on "Contact about artwork"
>
> > > Thanks.


[jQuery] Re: Cycle Plugin - Can't Get Pause To Work

2009-04-23 Thread Nic Hubbard

Shawn,

Yes, I have pause on hover set, and this is correctly working.  It is
when the overlay comes up, and it is suppose to pause the current
image, which, my code seems to be correct to do so $
('#artistCycleParent').cycle('pause'); but it just keeps cycling and
does not honor the pause.

I have it in my click function, and everything in the click function
does work, but not the pause.  Once the user clicks off of the
overlay, it should resume.

On Apr 23, 9:22 pm, Shawn  wrote:
> Pause is working for me, with a catch.
>
> If my mouse is not over the image, it cycles.  Placing my mouse over the
> image pauses the cycling.
>
> Clicking the link brings up an overlay (?) and a form - at this point
> the mouse is not "over" the image, but over the overlay/form.  So the
> image cycles as it should.
>
> I don't think you want the pause option here.  I think you want to
> progamatically start/stop the cycling.  See the section "Manually
> Pausing a slideshow" athttp://malsup.com/jquery/cycle/int2.html.
>
> HTH.
>
> Shawn
>
> Nic Hubbard wrote:
> > I am using the cycle plugin, but for some reason I can't get the pause
> > feature to work.  I am showing a hidden div, and when I do, I need to
> > pause the slideshow.
> > Here is what I am using:
>
> >    $('#artistCycleParent').cycle({
> >            fx:      'fade',
> >            speed:    3000,
> >            timeout:  5000,
> >            pause:  1,
> >            next:   '#artworkNext',
> >            prev:   '#artworkPrev'
> >    });
>
> >    // Pause the cycle
> >    $('#pauseButton').click(function() {
> >            $('#artistCycleParent').cycle('pause');
> >            $(this).hide();
> >            $('#resumeButton').show();
> >            return false;
> >    });
>
> >    // Resume the cycle
> >    $('#resumeButton').click(function() {
> >            $('#artistCycleParent').cycle('resume');
> >            $(this).hide();
> >            $('#pauseButton').show();
> >            return false;
> >    });
>
> > The code looks ok to me, but it just does not seem to pause.
>
> > Example:http://www.caldwellsnyder.com/artists/montoya-ortiz/view-artworks
> > Click on "Contact about artwork"
>
> > Thanks.


[jQuery] Cycle Plugin - Can't Get Pause To Work

2009-04-23 Thread Nic Hubbard

I am using the cycle plugin, but for some reason I can't get the pause
feature to work.  I am showing a hidden div, and when I do, I need to
pause the slideshow.
Here is what I am using:

$('#artistCycleParent').cycle({
fx:  'fade',
speed:3000,
timeout:  5000,
pause:  1,
next:   '#artworkNext',
prev:   '#artworkPrev'
});

// Pause the cycle
$('#pauseButton').click(function() {
$('#artistCycleParent').cycle('pause');
$(this).hide();
$('#resumeButton').show();
return false;
});

// Resume the cycle
$('#resumeButton').click(function() {
$('#artistCycleParent').cycle('resume');
$(this).hide();
$('#pauseButton').show();
return false;
});

The code looks ok to me, but it just does not seem to pause.

Example: http://www.caldwellsnyder.com/artists/montoya-ortiz/view-artworks
Click on "Contact about artwork"

Thanks.


[jQuery] Supersized Plugin Image Preload

2009-04-20 Thread Nic Hubbard

I am currently using the supersized plugin (http://buildinternet.com/
2009/02/supersized-full-screen-backgroundslideshow-jquery-plugin/) to
have a full screen, correct ratio scaling image background.  It works
very well.  Only problem is, all the images try to load at the some
time, and give a very strange effect.

Just wondering if anyone would be interested in helping me figure out
if it is possible to preload those.  I tried to use jquery.preload.js
but it did not seem to help.

Here is my site that uses is: http://67.207.148.241

Thanks for any help, I appreciate it!


[jQuery] Re: show if class matches current body id

2009-04-18 Thread Nic Hubbard

function initMenu() {
if ($('body').attr('id') === $('#menu ul').attr('class')) {
$('#menu ul').hide();
$('#menu ul.test').show();
$('#menu li a').click(
function() {
$(this).next().toggle();
}
);
}
}

$(document).ready(function() {initMenu();});

On Apr 18, 7:54 am, Max  wrote:
> Hi im trying to adapt the following function so that if the ul class
> matches the body's id it will show.  Right now it is set to show the
> ul with the class 'test'.
>
> This is for an accordion menu, and would allow the same menu to be an
> include on all pages. and the appropriate segment would open.
>
> function initMenu() {
>
>   $('#menu ul').hide();
>   $('#menu ul.test').show();
>   $('#menu li a').click(
>     function() {
>         $(this).next().toggle();
>       }
>     );
>   }
> $(document).ready(function() {initMenu();});
>
> any suggestions?
> Thanks!


[jQuery] Re: Custom Callback not using jQuery object

2009-04-16 Thread Nic Hubbard

Eric,

I now have the need to take the callback out of the scope of the
plugin, and put that into a function that is being called within the
plugin, what would be the best way to do this?

So, if I had:

my_function(defaults.onComplete.apply(obj, []));

For some reason that does not seem like it would work.  Should I just
pass obj?

On Feb 25, 2:40 pm, Eric Garside  wrote:
> Sure. Basically apply allows you to declare the scope of the function
> you're calling, instead of letting that scope resolve normally. With
> any function, it will take on the scope of whatever encloses it. So if
> you declare a function without it being enclosed, "this" will resolve
> to "window" in almost all cases.
>
> function myFunc(){ alert(this); }
> myFunc(); // [object Window]
>
> If your function is enclosed in an object, say:
>
> var obj = { name: 'myObject', myFunc: function(){ alert
> (this.name); } };
> obj.myFunc(); // myObject
>
> then "this" will take on the scope of the object which encloses it.
>
> Using apply, you can manually declare the scope the function will
> have.
>
> var obj1 = { name: 'obj1', myFunc: function(){ alert(this.name); }};
> var obj2 = { name: 'obj2' };
> obj1.myFunc.apply(obj2, []); // obj2
>
> So the first argument of apply sets the scope, which is basically a
> fancy way of saying, tells it what to make "this" inside the function.
> The second argument of apply is an array, in which you can pass
> parameters. So:
>
> function myFunc(param1, param2, param3){
>   alert(this + ' is equal to ' + (param1 + param2 + param3));
>
> }
>
> myFunc.apply(12, [2,4,6]); // alerts "12 is equal to 12"
>
> I hope I answered your question, but I fear I may have just rambled at
> you. :(
>
> On Feb 25, 4:24 pm, Nic Hubbard  wrote:
>
> > Ha!  That worked perfectly!  Thanks, I really appreciate that, I was
> > lost.
>
> > So, could you explain, just so I know, what this did:
> > defaults.onComplete.apply(obj, []); ?
>
> > On Feb 25, 1:07 pm, Eric Garside  wrote:
>
> > > The problem is you're losing scope when calling onComplete. Try using
> > > the .apply method. Instead of:
>
> > > defaults.onComplete();
>
> > > try:
>
> > > defaults.onComplete.apply(obj.get(0), []);
>
> > > That should get "this" back to what you're expecting it to be. You
> > > could also skip a step and call:
>
> > > defaults.onComplete.apply(obj, []);
>
> > > ---
>
> > > onComplete: function(){ alert(this.attr('class')); }
>
> > > I'm pretty sure that should work. IF not, let me know, and I'll play
> > > around with it locally and actually test it out.
>
> > > On Feb 25, 3:52 pm, Nic Hubbard  wrote:
>
> > > > I was meaning when trying to call $(this) in the following
> > > > circumstance:
>
> > > >         $('a.matrixStatus').matrixStatus({
> > > >             urlSuffix: '?action=status_posting',
> > > >             onComplete: function() {alert('Callback worked'); alert($
> > > > (this).attr('class'));}
> > > >         });
>
> > > > When I am trying to pass things to the custom function, using $(this)
> > > > does not work.
>
> > > > On Feb 25, 12:28 pm, brian  wrote:
>
> > > > > Something like this? (no pun intended)
>
> > > > > obj.click(function() {
> > > > >   var self = $(this);
>
> > > > >   ...
>
> > > > >    defaults.onComplete(self);
>
> > > > > On Wed, Feb 25, 2009 at 3:11 PM, Nic Hubbard  
> > > > > wrote:
>
> > > > > > I have built a custom callback into my plugin, here is an example:
>
> > > > > >  $.fn.matrixStatus = function(options) {
> > > > > >    var defaults = {
> > > > > >      urlSuffix: '?action=live',
> > > > > >          onComplete: function() {}
> > > > > >    };
>
> > > > > >    var options = $.extend(defaults, options);
>
> > > > > >    return this.each(function() {
> > > > > >      var obj = $(this);
> > > > > >          var itemDesc = obj.attr('rel');
> > > > > >      var itemId = obj.attr('id');
> > > > > >      var itemHref = obj.attr('href');
> > > > > >      obj.click(function() {
> > > > > &

[jQuery] Re: Creating an ajax status

2009-04-16 Thread Nic Hubbard

I got this working, thanks guys.

On Apr 16, 10:19 am, Donny Kurnia  wrote:
> Nic Hubbard wrote:
> > I have a number of GET and POST ajax calls that do various things my
> > script.  For each one, I would like to set a status that is a string,
> > so that I can out put that to the user.  So, it might look like this:
>
> > Ajax POST
> > Posting to page
>
> > Ajax GET
> > Getting content page
>
> > Ajax POST
> > Sending data to page
>
> > Basically I want to set the status using something like $
> > ('#status_div').text(); so that the user will see the status text when
> > each ajax function is run.
>
> > Does anyone have ideas on how this could be accomplished?
>
> This is what I used to do:
>
> 1. In the click function handler, put the loading text and image to the
> status placeholder.
> $('#status_div').html(' Loading ...');
>
> 2. Call the ajax
>
> 3. In the ajax callbak function, I update the status placeholder with
> the ajax response message
> $.post(url
>        ,{param: "value"}
>        ,function(r){
>          $('#status_div').html(r.message);
>        }
>        , "json");
>
> The complete code will be like this:
> $(trigger).click(function(){
>   $('#status_div').html(' Loading ...');
>   $.post(url
>          ,{param: "value"}
>          ,function(r){
>            $('#status_div').html(r.message);
>          }
>          , "json");
>
> });
>
> You can adjust this according to your need. This is what I like to do in
> my code (and my client so far happy with it) :)
>
> --
> Donny Kurniahttp://hantulab.blogspot.comhttp://www.plurk.com/user/donnykurnia


[jQuery] Re: CTRL+S to Insert Record PHP+JQUERY

2009-04-16 Thread Nic Hubbard

http://jshotkeys.googlepages.com/test-static-01.html

On Apr 15, 10:24 pm, bharani kumar 
wrote:
> Hi All ,
> Can u please tell ,
>
> How to implement  in jquery, php,,
>
> Insert record after pressed the CTRL+S in keyboard ,
>
> Thanks
>
> --
> உங்கள் நண்பன்
> பரணி  குமார்
>
> Regards
> B.S.Bharanikumar
>
> POST YOUR OPINIONhttp://bharanikumariyerphp.site88.net/bharanikumar/


[jQuery] Creating an ajax status

2009-04-16 Thread Nic Hubbard

I have a number of GET and POST ajax calls that do various things my
script.  For each one, I would like to set a status that is a string,
so that I can out put that to the user.  So, it might look like this:

Ajax POST
Posting to page

Ajax GET
Getting content page

Ajax POST
Sending data to page

Basically I want to set the status using something like $
('#status_div').text(); so that the user will see the status text when
each ajax function is run.

Does anyone have ideas on how this could be accomplished?


[jQuery] Re: Ajax request -- passing additional paramters to success method

2009-04-15 Thread Nic Hubbard

Perfect!

On Apr 15, 1:57 pm, Eric Garside  wrote:
> $.ajax({
>         type: "GET",
>         dataType: "json",
>         url: tUrl,
>         success: function(data){ GotNewData(data, 'custom string'); },
>         error: GetDataError,
>         complete: AjaxRequestComplete
>     });
>
> On Apr 15, 4:53 pm, Nic Hubbard  wrote:
>
> > I am interested in this as well.  How could I send a string to the
> > success GotNewData function?
>
> > On Feb 26, 9:50 am, P Burrows  wrote:
>
> > > Is anyone aware of a way to pass some additional context information to 
> > > the
> > > "success" function of an ajax request?
> > > For instance, here is my code which works fine:
>
> > > $.ajax({
> > >         type: "GET",
> > >         dataType: "json",
> > >         url: tUrl,
> > >         success: GotNewData,
> > >         error: GetDataError,
> > >         complete: AjaxRequestComplete
> > >     });
>
> > > To the "GotNewData" function, I would also like to pass some other
> > > information. The url would be nice, but some other context info would be
> > > fine too. A unique ID. Some random string. ...anything.
>
> > > Any ideas?
>
> > > --
> > > Patrick Burrowshttp://www.CleverHumans.com


[jQuery] Re: Ajax request -- passing additional paramters to success method

2009-04-15 Thread Nic Hubbard

I am interested in this as well.  How could I send a string to the
success GotNewData function?

On Feb 26, 9:50 am, P Burrows  wrote:
> Is anyone aware of a way to pass some additional context information to the
> "success" function of an ajax request?
> For instance, here is my code which works fine:
>
> $.ajax({
>         type: "GET",
>         dataType: "json",
>         url: tUrl,
>         success: GotNewData,
>         error: GetDataError,
>         complete: AjaxRequestComplete
>     });
>
> To the "GotNewData" function, I would also like to pass some other
> information. The url would be nice, but some other context info would be
> fine too. A unique ID. Some random string. ...anything.
>
> Any ideas?
>
> --
> Patrick Burrowshttp://www.CleverHumans.com


[jQuery] Re: Check value when adding to array

2009-04-13 Thread Nic Hubbard

Could you explain this one a little more?  How you coded it is a
little confusing to me.

On Apr 13, 6:34 pm, mkmanning  wrote:
> If I understand you code, you're trying to create an array of
> name=value, with value being specifically set if the name has _test in
> it?
>
> var arr = $.map($('input'),function(n,i){
>         return n.name+'='+(n.name.indexOf('_test')!=-1?'some_value':n.value);
>
> });
>
> On Apr 13, 5:27 pm, Nic Hubbard  wrote:
>
> > I have input values that I am adding to a array.  I would like to be
> > able to check if any of them end in _test and if so, I need to set a
> > specific value.  Is there any, in an if statement, to check if an
> > attribute of one of the input fields ends with _test?
>
> > main_form.find('input').each(function() {
> >   arr_current_item2.push($(this).attr('name') + '=' + $(this).val());
>
> > });// End each


[jQuery] Re: Check value when adding to array

2009-04-13 Thread Nic Hubbard

Tried the following, but did not seem to work:

if ($("input[name*='delete_linkid']",this)) {
   alert('it does!');
}

On Apr 13, 5:27 pm, Nic Hubbard  wrote:
> I have input values that I am adding to a array.  I would like to be
> able to check if any of them end in _test and if so, I need to set a
> specific value.  Is there any, in an if statement, to check if an
> attribute of one of the input fields ends with _test?
>
> main_form.find('input').each(function() {
>   arr_current_item2.push($(this).attr('name') + '=' + $(this).val());
>
> });// End each


[jQuery] Check value when adding to array

2009-04-13 Thread Nic Hubbard

I have input values that I am adding to a array.  I would like to be
able to check if any of them end in _test and if so, I need to set a
specific value.  Is there any, in an if statement, to check if an
attribute of one of the input fields ends with _test?

main_form.find('input').each(function() {
  arr_current_item2.push($(this).attr('name') + '=' + $(this).val());
});// End each


[jQuery] Re: Finding ID within Ajax response

2009-04-13 Thread Nic Hubbard

You are right, that did work.  Thanks, I really appreciate your help
on this!

Had you run into this issue before?

On Apr 13, 3:33 pm, Ryan  wrote:
> In my tests wrapping your full test html page in the div seems to
> work. Not pretty but works.
>
> On Apr 13, 11:29 pm, Nic Hubbard  wrote:
>
> > Yeah, but my page returns a full HTML page, so I need to do something
> > like:
>
> > $("body").wrapInner('');
>
> > Which, does not seem to work.
>
> > On Apr 13, 3:14 pm, Ryan  wrote:
>
> > > In that case you would need to add something like
>
> > > html = ''+html+'';
>
> > > to your function. Its a bit of an ugly hack I know.
>
> > > Having played with it a bit now. I think your probably right about it
> > > being a jquery bug. It might be worthwhile exploring which function
> > > the problem lies with then submitting it to the jquery team.
>
> > > R
>
> > > On Apr 13, 10:55 pm, Nic Hubbard  wrote:
>
> > > > Hey, that actually worked!  But, why would this have helped?  And, is
> > > > there a way around this, since the real form that I need to get, I
> > > > cannot wrap a div around.
>
> > > > On Apr 13, 2:46 pm, Ryan  wrote:
>
> > > > > If you wrap your form in a div I think it should work - haven't tested
> > > > > it
>
> > > > > R
>
> > > > > On Apr 13, 10:22 pm, Nic Hubbard  wrote:
>
> > > > > > Could this be a jQuery bug?
>
> > > > > > On Apr 13, 2:13 pm, James  wrote:
>
> > > > > > > I still haven't figured it out, but playing around and setting the
> > > > > > > ajax response as a jquery object, $(html), and making it global 
> > > > > > > so I
> > > > > > > can view it's attributes through Firebug, I was able to locate the
> > > > > > > form element on the ajax response. It was the index-5 element for 
> > > > > > > your
> > > > > > > test page. My sample code below. Though this still doesn't help 
> > > > > > > as to
> > > > > > > why we can't reference it using #test2, maybe someone else can get
> > > > > > > something more out of it.
>
> > > > > > > I've also tried appended the response to the page and still no go.
>
> > > > > > > --
>
> > > > > > > var globalHTML;  // global variable
>
> > > > > > > $(document).ready(function() {
>
> > > > > > >         $.ajax({
> > > > > > >                 url: 'http://www.puc.edu/dev/tests/linking-test',
> > > > > > >                 type: 'GET',
> > > > > > >                 success: function(html) {
> > > > > > >                         var $html = $(html);  // wrap response as 
> > > > > > > jquery object
>
> > > > > > >                         globalHTML = $html;  // check object with 
> > > > > > > firebug
>
> > > > > > >                         alert( $html.get(5).action );
> > > > > > >                 }
> > > > > > >         });
>
> > > > > > > });
>
> > > > > > > Using Firebug and looking at the attributes of the object I've 
> > > > > > > found
> > > > > > > that the form is on the 5th-index of the object, for your test 
> > > > > > > page.
> > > > > > > Though this still doesn't really help much
>
> > > > > > > alert( $(html).get(5).action );
>
> > > > > > > On Apr 13, 10:28 am, Nic Hubbard  wrote:
>
> > > > > > > > Ok, my test now reflects your suggestions.  But, sadly, none of 
> > > > > > > > that
> > > > > > > > helped, it is still returning undefined. :(
>
> > > > > > > > On Apr 13, 1:03 pm, Nic Luciano  wrote:
>
> > > > > > > > > Hey Nic,
>
> > > > > > > > > I have a couple small recommendations- hopefully one will fix 
> > > > > > > > > the issue.
>
> > > > > > > > > Try using $.get() instead of $.ajax, and specify "type" 
> > > > 

[jQuery] Re: Finding ID within Ajax response

2009-04-13 Thread Nic Hubbard

Yeah, but my page returns a full HTML page, so I need to do something
like:

$("body").wrapInner('');

Which, does not seem to work.

On Apr 13, 3:14 pm, Ryan  wrote:
> In that case you would need to add something like
>
> html = ''+html+'';
>
> to your function. Its a bit of an ugly hack I know.
>
> Having played with it a bit now. I think your probably right about it
> being a jquery bug. It might be worthwhile exploring which function
> the problem lies with then submitting it to the jquery team.
>
> R
>
> On Apr 13, 10:55 pm, Nic Hubbard  wrote:
>
> > Hey, that actually worked!  But, why would this have helped?  And, is
> > there a way around this, since the real form that I need to get, I
> > cannot wrap a div around.
>
> > On Apr 13, 2:46 pm, Ryan  wrote:
>
> > > If you wrap your form in a div I think it should work - haven't tested
> > > it
>
> > > R
>
> > > On Apr 13, 10:22 pm, Nic Hubbard  wrote:
>
> > > > Could this be a jQuery bug?
>
> > > > On Apr 13, 2:13 pm, James  wrote:
>
> > > > > I still haven't figured it out, but playing around and setting the
> > > > > ajax response as a jquery object, $(html), and making it global so I
> > > > > can view it's attributes through Firebug, I was able to locate the
> > > > > form element on the ajax response. It was the index-5 element for your
> > > > > test page. My sample code below. Though this still doesn't help as to
> > > > > why we can't reference it using #test2, maybe someone else can get
> > > > > something more out of it.
>
> > > > > I've also tried appended the response to the page and still no go.
>
> > > > > --
>
> > > > > var globalHTML;  // global variable
>
> > > > > $(document).ready(function() {
>
> > > > >         $.ajax({
> > > > >                 url: 'http://www.puc.edu/dev/tests/linking-test',
> > > > >                 type: 'GET',
> > > > >                 success: function(html) {
> > > > >                         var $html = $(html);  // wrap response as 
> > > > > jquery object
>
> > > > >                         globalHTML = $html;  // check object with 
> > > > > firebug
>
> > > > >                         alert( $html.get(5).action );
> > > > >                 }
> > > > >         });
>
> > > > > });
>
> > > > > Using Firebug and looking at the attributes of the object I've found
> > > > > that the form is on the 5th-index of the object, for your test page.
> > > > > Though this still doesn't really help much
>
> > > > > alert( $(html).get(5).action );
>
> > > > > On Apr 13, 10:28 am, Nic Hubbard  wrote:
>
> > > > > > Ok, my test now reflects your suggestions.  But, sadly, none of that
> > > > > > helped, it is still returning undefined. :(
>
> > > > > > On Apr 13, 1:03 pm, Nic Luciano  wrote:
>
> > > > > > > Hey Nic,
>
> > > > > > > I have a couple small recommendations- hopefully one will fix the 
> > > > > > > issue.
>
> > > > > > > Try using $.get() instead of $.ajax, and specify "type" option as 
> > > > > > > "html"-
> > > > > > > alternatively, you can use $.load() if your ultimate purpose is 
> > > > > > > to inject
> > > > > > > this HTML into DOM.
>
> > > > > > > In addition rather than using find(), just select by ID as a 
> > > > > > > subset of the
> > > > > > > DOM node..
>
> > > > > > > alert($(html).find("#test") becomes
> > > > > > > alert($("#test", html));
>
> > > > > > > Hope some of this helps... cheers!
>
> > > > > > > Nic Luciano
> > > > > > > Senior Web Developer @ 
> > > > > > > AdaptiveBluehttp://www.twitter.com/niclucianohttp://www.linkedin.com/in/nicluciano
>
> > > > > > > On Mon, Apr 13, 2009 at 3:35 PM, Nic Hubbard 
> > > > > > >  wrote:
>
> > > > > > > > Nope, that does not work either.
>
> > > > > 

[jQuery] Re: Finding ID within Ajax response

2009-04-13 Thread Nic Hubbard

Hey, that actually worked!  But, why would this have helped?  And, is
there a way around this, since the real form that I need to get, I
cannot wrap a div around.

On Apr 13, 2:46 pm, Ryan  wrote:
> If you wrap your form in a div I think it should work - haven't tested
> it
>
> R
>
> On Apr 13, 10:22 pm, Nic Hubbard  wrote:
>
> > Could this be a jQuery bug?
>
> > On Apr 13, 2:13 pm, James  wrote:
>
> > > I still haven't figured it out, but playing around and setting the
> > > ajax response as a jquery object, $(html), and making it global so I
> > > can view it's attributes through Firebug, I was able to locate the
> > > form element on the ajax response. It was the index-5 element for your
> > > test page. My sample code below. Though this still doesn't help as to
> > > why we can't reference it using #test2, maybe someone else can get
> > > something more out of it.
>
> > > I've also tried appended the response to the page and still no go.
>
> > > --
>
> > > var globalHTML;  // global variable
>
> > > $(document).ready(function() {
>
> > >         $.ajax({
> > >                 url: 'http://www.puc.edu/dev/tests/linking-test',
> > >                 type: 'GET',
> > >                 success: function(html) {
> > >                         var $html = $(html);  // wrap response as jquery 
> > > object
>
> > >                         globalHTML = $html;  // check object with firebug
>
> > >                         alert( $html.get(5).action );
> > >                 }
> > >         });
>
> > > });
>
> > > Using Firebug and looking at the attributes of the object I've found
> > > that the form is on the 5th-index of the object, for your test page.
> > > Though this still doesn't really help much
>
> > > alert( $(html).get(5).action );
>
> > > On Apr 13, 10:28 am, Nic Hubbard  wrote:
>
> > > > Ok, my test now reflects your suggestions.  But, sadly, none of that
> > > > helped, it is still returning undefined. :(
>
> > > > On Apr 13, 1:03 pm, Nic Luciano  wrote:
>
> > > > > Hey Nic,
>
> > > > > I have a couple small recommendations- hopefully one will fix the 
> > > > > issue.
>
> > > > > Try using $.get() instead of $.ajax, and specify "type" option as 
> > > > > "html"-
> > > > > alternatively, you can use $.load() if your ultimate purpose is to 
> > > > > inject
> > > > > this HTML into DOM.
>
> > > > > In addition rather than using find(), just select by ID as a subset 
> > > > > of the
> > > > > DOM node..
>
> > > > > alert($(html).find("#test") becomes
> > > > > alert($("#test", html));
>
> > > > > Hope some of this helps... cheers!
>
> > > > > Nic Luciano
> > > > > Senior Web Developer @ 
> > > > > AdaptiveBluehttp://www.twitter.com/niclucianohttp://www.linkedin.com/in/nicluciano
>
> > > > > On Mon, Apr 13, 2009 at 3:35 PM, Nic Hubbard  
> > > > > wrote:
>
> > > > > > Nope, that does not work either.
>
> > > > > > On Apr 13, 12:20 pm, Jack Killpatrick  wrote:
> > > > > > > Maybe try:
>
> > > > > > > success: function(html){
> > > > > > >   alert($(html).find('form').attr('action'));
>
> > > > > > > I had some issues in the past using form id's with the jquery form
> > > > > > > plugin, but usually getting it using 'form' worked.
>
> > > > > > > That said, since the response isn't in the DOM yet, I'm not sure 
> > > > > > > if that
> > > > > > > might present an issue (too/instead).
>
> > > > > > > - Jack
>
> > > > > > > Nic Hubbard wrote:
> > > > > > > > Yes, this is very odd. I have tried it quite a few ways, but I 
> > > > > > > > can
> > > > > > > > never target the form.  Any other ideas?
>
> > > > > > > > It is frustrating because I really need to target a form in the 
> > > > > > > > html
> > > > > > > > response...
>
> > > >

[jQuery] Re: Finding ID within Ajax response

2009-04-13 Thread Nic Hubbard

Could this be a jQuery bug?

On Apr 13, 2:13 pm, James  wrote:
> I still haven't figured it out, but playing around and setting the
> ajax response as a jquery object, $(html), and making it global so I
> can view it's attributes through Firebug, I was able to locate the
> form element on the ajax response. It was the index-5 element for your
> test page. My sample code below. Though this still doesn't help as to
> why we can't reference it using #test2, maybe someone else can get
> something more out of it.
>
> I've also tried appended the response to the page and still no go.
>
> --
>
> var globalHTML;  // global variable
>
> $(document).ready(function() {
>
>         $.ajax({
>                 url: 'http://www.puc.edu/dev/tests/linking-test',
>                 type: 'GET',
>                 success: function(html) {
>                         var $html = $(html);  // wrap response as jquery 
> object
>
>                         globalHTML = $html;  // check object with firebug
>
>                         alert( $html.get(5).action );
>                 }
>         });
>
> });
>
> Using Firebug and looking at the attributes of the object I've found
> that the form is on the 5th-index of the object, for your test page.
> Though this still doesn't really help much
>
> alert( $(html).get(5).action );
>
> On Apr 13, 10:28 am, Nic Hubbard  wrote:
>
> > Ok, my test now reflects your suggestions.  But, sadly, none of that
> > helped, it is still returning undefined. :(
>
> > On Apr 13, 1:03 pm, Nic Luciano  wrote:
>
> > > Hey Nic,
>
> > > I have a couple small recommendations- hopefully one will fix the issue.
>
> > > Try using $.get() instead of $.ajax, and specify "type" option as "html"-
> > > alternatively, you can use $.load() if your ultimate purpose is to inject
> > > this HTML into DOM.
>
> > > In addition rather than using find(), just select by ID as a subset of the
> > > DOM node..
>
> > > alert($(html).find("#test") becomes
> > > alert($("#test", html));
>
> > > Hope some of this helps... cheers!
>
> > > Nic Luciano
> > > Senior Web Developer @ 
> > > AdaptiveBluehttp://www.twitter.com/niclucianohttp://www.linkedin.com/in/nicluciano
>
> > > On Mon, Apr 13, 2009 at 3:35 PM, Nic Hubbard  wrote:
>
> > > > Nope, that does not work either.
>
> > > > On Apr 13, 12:20 pm, Jack Killpatrick  wrote:
> > > > > Maybe try:
>
> > > > > success: function(html){
> > > > >   alert($(html).find('form').attr('action'));
>
> > > > > I had some issues in the past using form id's with the jquery form
> > > > > plugin, but usually getting it using 'form' worked.
>
> > > > > That said, since the response isn't in the DOM yet, I'm not sure if 
> > > > > that
> > > > > might present an issue (too/instead).
>
> > > > > - Jack
>
> > > > > Nic Hubbard wrote:
> > > > > > Yes, this is very odd. I have tried it quite a few ways, but I can
> > > > > > never target the form.  Any other ideas?
>
> > > > > > It is frustrating because I really need to target a form in the html
> > > > > > response...
>
> > > > > > On Apr 13, 11:45 am, James  wrote:
>
> > > > > >> That's strange. I can't get it to work either and I'm getting the 
> > > > > >> same
> > > > > >> results as you (I can get #test2, but not #test). I've even 
> > > > > >> truncated
> > > > > >> the response down to as if you're only receiving the  part 
> > > > > >> and
> > > > > >> it still doesn't work. I'd be interested in seeing what happens 
> > > > > >> here
> > > > > >> too.
>
> > > > > >> On Apr 13, 6:47 am, Nic Hubbard  wrote:
>
> > > > > >>> Test page to show the 
> > > > > >>> problem:http://www.puc.edu/dev/tests/ajax-test
>
> > > > > >>> On Apr 13, 9:33 am, Nic Hubbard  wrote:
>
> > > > > >>>> I am pulling my hair out over this.  I swear that this is a bug.
>
> > > > > >>>> For some reason, I CANNOT target any forms withi

[jQuery] Re: Finding ID within Ajax response

2009-04-13 Thread Nic Hubbard

Ok, my test now reflects your suggestions.  But, sadly, none of that
helped, it is still returning undefined. :(

On Apr 13, 1:03 pm, Nic Luciano  wrote:
> Hey Nic,
>
> I have a couple small recommendations- hopefully one will fix the issue.
>
> Try using $.get() instead of $.ajax, and specify "type" option as "html"-
> alternatively, you can use $.load() if your ultimate purpose is to inject
> this HTML into DOM.
>
> In addition rather than using find(), just select by ID as a subset of the
> DOM node..
>
> alert($(html).find("#test") becomes
> alert($("#test", html));
>
> Hope some of this helps... cheers!
>
> Nic Luciano
> Senior Web Developer @ 
> AdaptiveBluehttp://www.twitter.com/niclucianohttp://www.linkedin.com/in/nicluciano
>
> On Mon, Apr 13, 2009 at 3:35 PM, Nic Hubbard  wrote:
>
> > Nope, that does not work either.
>
> > On Apr 13, 12:20 pm, Jack Killpatrick  wrote:
> > > Maybe try:
>
> > > success: function(html){
> > >   alert($(html).find('form').attr('action'));
>
> > > I had some issues in the past using form id's with the jquery form
> > > plugin, but usually getting it using 'form' worked.
>
> > > That said, since the response isn't in the DOM yet, I'm not sure if that
> > > might present an issue (too/instead).
>
> > > - Jack
>
> > > Nic Hubbard wrote:
> > > > Yes, this is very odd. I have tried it quite a few ways, but I can
> > > > never target the form.  Any other ideas?
>
> > > > It is frustrating because I really need to target a form in the html
> > > > response...
>
> > > > On Apr 13, 11:45 am, James  wrote:
>
> > > >> That's strange. I can't get it to work either and I'm getting the same
> > > >> results as you (I can get #test2, but not #test). I've even truncated
> > > >> the response down to as if you're only receiving the  part and
> > > >> it still doesn't work. I'd be interested in seeing what happens here
> > > >> too.
>
> > > >> On Apr 13, 6:47 am, Nic Hubbard  wrote:
>
> > > >>> Test page to show the problem:http://www.puc.edu/dev/tests/ajax-test
>
> > > >>> On Apr 13, 9:33 am, Nic Hubbard  wrote:
>
> > > >>>> I am pulling my hair out over this.  I swear that this is a bug.
>
> > > >>>> For some reason, I CANNOT target any forms within the html response.
> > > >>>> I have tried very simple examples and it still won't work.  Here is
> > > >>>> what I have, that still returns undefined:
>
> > > >>>> HTML:
> > > >>>> http://test.com";>
> > > >>>> this is my text
> > > >>>> 
>
> > > >>>> jQuery:
> > > >>>> success: function(html){
> > > >>>>   alert($(html).find("#test").attr('action'));
> > > >>>>   alert($(html).find("#test2").text());
>
> > > >>>> }
>
> > > >>>> #test2 works, but #test never does, and it seems this is because it
> > is
> > > >>>> a form.  Have I done something wrong here?  Can I not target a form?
>
> > > >>>> On Apr 12, 4:35 pm, Nic Hubbard  wrote:
>
> > > >>>>> I have an ajax GET call that returns the HTML of a page on my
> > server.
> > > >>>>> Within that page is a form with a specific ID.  I know it is there,
> > I
> > > >>>>> can see it in the response in Firebug, but when I try to get
> > > >>>>> attributes of that ID, it always returns undefined!  What have I
> > done
> > > >>>>> wrong here?
>
> > > >>>>> success: function(html){
>
> > > >>>>> $(html).find('#main_form').each(function() {
> > > >>>>> var linking_data = $(this).serialize();
> > > >>>>> var form_action = $(this).attr('action');
> > > >>>>> alert(form_action);
>
> > > >>>>> });
> > > >>>>> }
>
> > > >>>>> I have tried to not use each() and that still returns undefined.  I
> > > >>>>> don't get it.


[jQuery] Re: Finding ID within Ajax response

2009-04-13 Thread Nic Hubbard

Nope, that does not work either.

On Apr 13, 12:20 pm, Jack Killpatrick  wrote:
> Maybe try:
>
> success: function(html){
>   alert($(html).find('form').attr('action'));
>
> I had some issues in the past using form id's with the jquery form
> plugin, but usually getting it using 'form' worked.
>
> That said, since the response isn't in the DOM yet, I'm not sure if that
> might present an issue (too/instead).
>
> - Jack
>
> Nic Hubbard wrote:
> > Yes, this is very odd. I have tried it quite a few ways, but I can
> > never target the form.  Any other ideas?
>
> > It is frustrating because I really need to target a form in the html
> > response...
>
> > On Apr 13, 11:45 am, James  wrote:
>
> >> That's strange. I can't get it to work either and I'm getting the same
> >> results as you (I can get #test2, but not #test). I've even truncated
> >> the response down to as if you're only receiving the  part and
> >> it still doesn't work. I'd be interested in seeing what happens here
> >> too.
>
> >> On Apr 13, 6:47 am, Nic Hubbard  wrote:
>
> >>> Test page to show the problem:http://www.puc.edu/dev/tests/ajax-test
>
> >>> On Apr 13, 9:33 am, Nic Hubbard  wrote:
>
> >>>> I am pulling my hair out over this.  I swear that this is a bug.
>
> >>>> For some reason, I CANNOT target any forms within the html response.
> >>>> I have tried very simple examples and it still won't work.  Here is
> >>>> what I have, that still returns undefined:
>
> >>>> HTML:
> >>>> http://test.com";>
> >>>> this is my text
> >>>> 
>
> >>>> jQuery:
> >>>> success: function(html){
> >>>>   alert($(html).find("#test").attr('action'));
> >>>>   alert($(html).find("#test2").text());
>
> >>>> }
>
> >>>> #test2 works, but #test never does, and it seems this is because it is
> >>>> a form.  Have I done something wrong here?  Can I not target a form?
>
> >>>> On Apr 12, 4:35 pm, Nic Hubbard  wrote:
>
> >>>>> I have an ajax GET call that returns the HTML of a page on my server.
> >>>>> Within that page is a form with a specific ID.  I know it is there, I
> >>>>> can see it in the response in Firebug, but when I try to get
> >>>>> attributes of that ID, it always returns undefined!  What have I done
> >>>>> wrong here?
>
> >>>>> success: function(html){
>
> >>>>> $(html).find('#main_form').each(function() {
> >>>>> var linking_data = $(this).serialize();
> >>>>> var form_action = $(this).attr('action');
> >>>>> alert(form_action);
>
> >>>>> });
> >>>>> }
>
> >>>>> I have tried to not use each() and that still returns undefined.  I
> >>>>> don't get it.


[jQuery] Re: Finding ID within Ajax response

2009-04-13 Thread Nic Hubbard

Yes, this is very odd. I have tried it quite a few ways, but I can
never target the form.  Any other ideas?

It is frustrating because I really need to target a form in the html
response...

On Apr 13, 11:45 am, James  wrote:
> That's strange. I can't get it to work either and I'm getting the same
> results as you (I can get #test2, but not #test). I've even truncated
> the response down to as if you're only receiving the  part and
> it still doesn't work. I'd be interested in seeing what happens here
> too.
>
> On Apr 13, 6:47 am, Nic Hubbard  wrote:
>
> > Test page to show the problem:http://www.puc.edu/dev/tests/ajax-test
>
> > On Apr 13, 9:33 am, Nic Hubbard  wrote:
>
> > > I am pulling my hair out over this.  I swear that this is a bug.
>
> > > For some reason, I CANNOT target any forms within the html response.
> > > I have tried very simple examples and it still won't work.  Here is
> > > what I have, that still returns undefined:
>
> > > HTML:
> > > http://test.com";>
> > > this is my text
> > > 
>
> > > jQuery:
> > > success: function(html){
> > >   alert($(html).find("#test").attr('action'));
> > >   alert($(html).find("#test2").text());
>
> > > }
>
> > > #test2 works, but #test never does, and it seems this is because it is
> > > a form.  Have I done something wrong here?  Can I not target a form?
>
> > > On Apr 12, 4:35 pm, Nic Hubbard  wrote:
>
> > > > I have an ajax GET call that returns the HTML of a page on my server.
> > > > Within that page is a form with a specific ID.  I know it is there, I
> > > > can see it in the response in Firebug, but when I try to get
> > > > attributes of that ID, it always returns undefined!  What have I done
> > > > wrong here?
>
> > > > success: function(html){
>
> > > > $(html).find('#main_form').each(function() {
> > > > var linking_data = $(this).serialize();
> > > > var form_action = $(this).attr('action');
> > > > alert(form_action);
>
> > > > });
> > > > }
>
> > > > I have tried to not use each() and that still returns undefined.  I
> > > > don't get it.


[jQuery] Re: Finding ID within Ajax response

2009-04-13 Thread Nic Hubbard

Nope, that returns undefined as well. :(

On Apr 13, 11:34 am, Nathan  wrote:
> You could try changing this: alert($(html).find("#test").attr
> ('action'));
> To This: alert($("#test").attr('action'));
>
> On Apr 13, 9:47 am, Nic Hubbard  wrote:
>
> > Test page to show the problem:http://www.puc.edu/dev/tests/ajax-test
>
> > On Apr 13, 9:33 am, Nic Hubbard  wrote:
>
> > > I am pulling my hair out over this.  I swear that this is a bug.
>
> > > For some reason, I CANNOT target any forms within the html response.
> > > I have tried very simple examples and it still won't work.  Here is
> > > what I have, that still returns undefined:
>
> > > HTML:
> > > http://test.com";>
> > > this is my text
> > > 
>
> > > jQuery:
> > > success: function(html){
> > >   alert($(html).find("#test").attr('action'));
> > >   alert($(html).find("#test2").text());
>
> > > }
>
> > > #test2 works, but #test never does, and it seems this is because it is
> > > a form.  Have I done something wrong here?  Can I not target a form?
>
> > > On Apr 12, 4:35 pm, Nic Hubbard  wrote:
>
> > > > I have an ajax GET call that returns the HTML of a page on my server.
> > > > Within that page is a form with a specific ID.  I know it is there, I
> > > > can see it in the response in Firebug, but when I try to get
> > > > attributes of that ID, it always returns undefined!  What have I done
> > > > wrong here?
>
> > > > success: function(html){
>
> > > > $(html).find('#main_form').each(function() {
> > > > var linking_data = $(this).serialize();
> > > > var form_action = $(this).attr('action');
> > > > alert(form_action);
>
> > > > });
> > > > }
>
> > > > I have tried to not use each() and that still returns undefined.  I
> > > > don't get it.


[jQuery] Re: Finding ID within Ajax response

2009-04-13 Thread Nic Hubbard

Test page to show the problem: http://www.puc.edu/dev/tests/ajax-test

On Apr 13, 9:33 am, Nic Hubbard  wrote:
> I am pulling my hair out over this.  I swear that this is a bug.
>
> For some reason, I CANNOT target any forms within the html response.
> I have tried very simple examples and it still won't work.  Here is
> what I have, that still returns undefined:
>
> HTML:
> http://test.com";>
> this is my text
> 
>
> jQuery:
> success: function(html){
>   alert($(html).find("#test").attr('action'));
>   alert($(html).find("#test2").text());
>
> }
>
> #test2 works, but #test never does, and it seems this is because it is
> a form.  Have I done something wrong here?  Can I not target a form?
>
> On Apr 12, 4:35 pm, Nic Hubbard  wrote:
>
> > I have an ajax GET call that returns the HTML of a page on my server.
> > Within that page is a form with a specific ID.  I know it is there, I
> > can see it in the response in Firebug, but when I try to get
> > attributes of that ID, it always returns undefined!  What have I done
> > wrong here?
>
> > success: function(html){
>
> > $(html).find('#main_form').each(function() {
> > var linking_data = $(this).serialize();
> > var form_action = $(this).attr('action');
> > alert(form_action);
>
> > });
> > }
>
> > I have tried to not use each() and that still returns undefined.  I
> > don't get it.


[jQuery] Re: Finding ID within Ajax response

2009-04-13 Thread Nic Hubbard

I am pulling my hair out over this.  I swear that this is a bug.

For some reason, I CANNOT target any forms within the html response.
I have tried very simple examples and it still won't work.  Here is
what I have, that still returns undefined:

HTML:
http://test.com";>
this is my text


jQuery:
success: function(html){
  alert($(html).find("#test").attr('action'));
  alert($(html).find("#test2").text());
}

#test2 works, but #test never does, and it seems this is because it is
a form.  Have I done something wrong here?  Can I not target a form?

On Apr 12, 4:35 pm, Nic Hubbard  wrote:
> I have an ajax GET call that returns the HTML of a page on my server.
> Within that page is a form with a specific ID.  I know it is there, I
> can see it in the response in Firebug, but when I try to get
> attributes of that ID, it always returns undefined!  What have I done
> wrong here?
>
> success: function(html){
>
> $(html).find('#main_form').each(function() {
> var linking_data = $(this).serialize();
> var form_action = $(this).attr('action');
> alert(form_action);
>
> });
> }
>
> I have tried to not use each() and that still returns undefined.  I
> don't get it.


[jQuery] Finding ID within Ajax response

2009-04-12 Thread Nic Hubbard

I have an ajax GET call that returns the HTML of a page on my server.
Within that page is a form with a specific ID.  I know it is there, I
can see it in the response in Firebug, but when I try to get
attributes of that ID, it always returns undefined!  What have I done
wrong here?

success: function(html){

$(html).find('#main_form').each(function() {
var linking_data = $(this).serialize();
var form_action = $(this).attr('action');
alert(form_action);
});
}

I have tried to not use each() and that still returns undefined.  I
don't get it.


[jQuery] Get var out of ajax scope

2009-04-09 Thread Nic Hubbard

I have an $.ajax() call that I am using to GET some text from a page
on my site.  I have put it in a variable with the success function.
How can I move that var up and out of the $.ajax function so I can use
it in other parts of my script?

Thanks.


[jQuery] Re: .split an elements attribute

2009-04-09 Thread Nic Hubbard

Ah, thank you!  Not sure what I was thinking.

On Apr 9, 3:04 pm, mkmanning  wrote:
> Try alert( typeof(link_path) ) and you'll see it's a function. Try
> link_path.toString() and then split it.
>
> On Apr 9, 2:54 pm, Nic Hubbard  wrote:
>
> > I am getting the attribute of an image on a page.  It is the onclick
> > attribute, but I need some text from the onclick function. (Sounds
> > strange, but I do).  Using the following works totally fine:
>
> > var link_path = $(html).find("img[alt='Show in Asset Map']").attr
> > ('onclick');
> > alert(link_path);
>
> > From that, I can gather the onclick attribute.  But, I would like to
> > use .split() to section it up, but I keep getting a warning ($
> > (html).find("img[alt='Show in Asset Map']").attr("onclick").split is
> > not a function) when I try to use split with this.  Even Breaking it
> > down and trying link_path.split('a'); does not work and gives the
> > error.
>
> > Why would this be?


[jQuery] .split an elements attribute

2009-04-09 Thread Nic Hubbard

I am getting the attribute of an image on a page.  It is the onclick
attribute, but I need some text from the onclick function. (Sounds
strange, but I do).  Using the following works totally fine:

var link_path = $(html).find("img[alt='Show in Asset Map']").attr
('onclick');
alert(link_path);

>From that, I can gather the onclick attribute.  But, I would like to
use .split() to section it up, but I keep getting a warning ($
(html).find("img[alt='Show in Asset Map']").attr("onclick").split is
not a function) when I try to use split with this.  Even Breaking it
down and trying link_path.split('a'); does not work and gives the
error.

Why would this be?



[jQuery] Checking each div to see if it contains specific text

2009-04-09 Thread Nic Hubbard

I have a list of container divs that have children.  I want to check
for specific text in one child element, and if that is found, then
hide another child element.  For some reason what I have is not
working:

$('.exhibition_item_body').each(function () {
if ($(this).children(".checkReception:contains('--:--:--')")) {
$(this).children('.reception').hide();
}
});

The divs look like:


Jane Maxwell
2009-03-05 --:--:--
Mar 5 - Mar 31, 2009
Reception Mar 5, 2009 5 -
7 PM
San Francisco
Previous Exhibition





[jQuery] Re: Ignore first item in XML

2009-04-07 Thread Nic Hubbard

Hmmm, what a great idea.  Not sure what I was thinking.  I will go
that route. :)

On Apr 7, 5:05 pm, James  wrote:
> Why not just keep what you have and add an additional conditional
> check to see whether the node has an ID attribute or not? If not,
> ignore the node.
>
> On Apr 7, 1:59 pm, Nic Hubbard  wrote:
>
> > I am grabbing some XML from our server, then writing that out with
> >  tags in the browser, all using the jquery .ajax() function.
>
> > By design, our server wraps items with a parent of the same name,
> > like:
>
> > 
> > test 1
> > test 2
> > 
>
> > Because my function checks for each test tag, it finds the first
> > parent, but returns undefined, since it does not have any attributes.
> > Is it possible to ignore this first result, and start with the second
> > item, which will correctly have attributes?
>
> > success: function(xml) {
> >                      $(xml).find('testt').each(function() {
> >                          var id_text = $(this).attr('id')
> >                          var id_name = $(this).attr('name')
> >                          $('').html('id_code + ' - ' +
> > id_text).appendTo('#test');
> >                      });
> >                 }


[jQuery] Ignore first item in XML

2009-04-07 Thread Nic Hubbard

I am grabbing some XML from our server, then writing that out with
 tags in the browser, all using the jquery .ajax() function.

By design, our server wraps items with a parent of the same name,
like:


test 1
test 2


Because my function checks for each test tag, it finds the first
parent, but returns undefined, since it does not have any attributes.
Is it possible to ignore this first result, and start with the second
item, which will correctly have attributes?

success: function(xml) {
 $(xml).find('testt').each(function() {
 var id_text = $(this).attr('id')
 var id_name = $(this).attr('name')
 $('').html('id_code + ' - ' +
id_text).appendTo('#test');
 });
}


[jQuery] Re: Create array from li text

2009-04-06 Thread Nic Hubbard

Yeah, I had thought of the hidden div idea, and placing the html into
that, then using .each().  I just wondered if there was a method to do
it without adding the content to the DOM.

On Apr 6, 10:35 am, Jack Killpatrick  wrote:
> d'oh, I just realized you have the html in a var...
>
> I s'pose a "cheat" would be to add them to a hidden UL and then do
> something like the below so you could take advantage of the .text() and
> .each() method. Other than that, I'm not sure of the regex offhand to
> split the LI's and parse out the inner text, sry.
>
> - Jack
>
> Jack Killpatrick wrote:
> > maybe something like this:
>
> > var ar = [];
> > $('#yourList li').each(function(){
> >     ar.push( $(this).text() );
> > });
>
> > - Jack
>
> > Nic Hubbard wrote:
> >> A better explanation:
>
> >> I have a var that contains some html.  Within that there are 
> >> elements that I need to strip the text out of and put that into an
> >> array.  How would I do this?
>
> >> I figure I could use each() and push(), but I am not sure how to do
> >> this grabbing it from a var.
>
> >> On Apr 5, 11:30 pm, Nic Hubbard  wrote:
>
> >>> What would be the correct method to create an array from the text
> >>> inside  items?
>
> >>> Is below, the best method, or would it even work?
>
> >>> var array_test = $(#test li).text().makeArray();


[jQuery] Re: Create array from li text

2009-04-06 Thread Nic Hubbard

A better explanation:

I have a var that contains some html.  Within that there are 
elements that I need to strip the text out of and put that into an
array.  How would I do this?

I figure I could use each() and push(), but I am not sure how to do
this grabbing it from a var.

On Apr 5, 11:30 pm, Nic Hubbard  wrote:
> What would be the correct method to create an array from the text
> inside  items?
>
> Is below, the best method, or would it even work?
>
> var array_test = $(#test li).text().makeArray();


[jQuery] Create array from li text

2009-04-05 Thread Nic Hubbard

What would be the correct method to create an array from the text
inside  items?

Is below, the best method, or would it even work?

var array_test = $(#test li).text().makeArray();


[jQuery] Re: Combining Selectors

2009-04-05 Thread Nic Hubbard

This worked!  Thank you!

On Apr 5, 4:06 pm, "Michael Geary"  wrote:
> To help troubleshoot, take jQuery out of the picture and replace your alert
> with:
>
> alert( this + " input[type='submit']" );
>
> That will make it clear what the problem is.
>
> Since concatenating "this" to a string doesn't work, how do you fix it? Use
> the second argument to the $ function:
>
> $( selector, context )
>
> Like this:
>
> alert( $( " input[type='submit']", this ).attr('id') );
>
> -Mike
>
> > From: Nic Hubbard
>
> > I am confused why the following is returning undefined:
>
> > alert($(this + " input[type='submit']").attr('id'));
>
> > This is within the context of a plugin that I built.  
> > Removing the this makes it correctly find the input, why I
> > want to narrow the scope.


[jQuery] Combining Selectors

2009-04-05 Thread Nic Hubbard

I am confused why the following is returning undefined:

alert($(this + " input[type='submit']").attr('id'));

This is within the context of a plugin that I built.  Removing the
this makes it correctly find the input, why I want to narrow the scope.


[jQuery] Re: Position Div over Quicktime Movie

2009-03-29 Thread Nic Hubbard

Seriously?

On Mar 26, 2:57 pm, Saira Zaheer  wrote:
> http://tinyurl.com/dar2ld
>
> http://tinyurl.com/cvjkqa
>
> http://tinyurl.com/ae56nz
>
> On 3/26/09, Nic Hubbard  wrote:
>
>
>
> > Anyone?
>
> > On Mar 24, 4:41 pm, Nic Hubbard  wrote:
> > > Does anyone know of any jQuery/javascript trickery that can help with
> > > positioning a div over a quicktime movie?  So far, I found found that
> > > it is not possible.  But, it seems that there has to be some way to do
> > > this!
>
> > > Has anyone done this before?


[jQuery] Re: Position Div over Quicktime Movie

2009-03-26 Thread Nic Hubbard

Anyone?

On Mar 24, 4:41 pm, Nic Hubbard  wrote:
> Does anyone know of any jQuery/javascript trickery that can help with
> positioning a div over a quicktime movie?  So far, I found found that
> it is not possible.  But, it seems that there has to be some way to do
> this!
>
> Has anyone done this before?


[jQuery] Re: jQuery.preload - Getting Link Mode To Work

2009-03-25 Thread Nic Hubbard

Thank you!

This did the trick.

I didn't realize that how I had it would only load up the first
match.

I appreciate the help!

On Mar 24, 6:05 pm, James  wrote:
> Try replacing this line:
> var $links = $('#artistsColumns a').attr('rel');
>
> with:
> var $links = [];
> $.each($('#artistsColumns a'), function() {
>      $links.push( $(this).attr('rel') );
>
> });
>
> $('#artistsColumns a').attr('rel'); only gives you one string value,
> thus it will only preload one url.
> I made it loop through the matching jQuery set and put all the rel
> values into an array, which you use for preloading.
>
> On Mar 24, 1:19 pm, Nic Hubbard  wrote:
>
> > Anyone?
>
> > On Mar 23, 2:08 pm, Nic Hubbard  wrote:
>
> > > I seem to be having issues with getting link mode to work with Ariel
> > > Flesler's preload plugin.  I have a hidden menu, which shows a hidden
> > > div when you mouse over a nav item.  This then shows a list of names,
> > > and I am using the preload plugin to load up a thumbnail image for
> > > each of the names.  Currently, it does not seem to be preloading, as
> > > running your mouse over each name takes a few seconds for the image to
> > > load.  So, for some reason,  it seems like they are not getting
> > > preloaded.
>
> > > And ideas on why this would be?  Did I implement the plugin wrong for
> > > link mode?
>
> > > Code:
> > > // - Artists Menu: Show Artist Preview Image -
> > >         var $links = $('#artistsColumns a').attr('rel');
> > >         var $preview = $('#artist_menu_artwork');
>
> > >         $.preload($links,
> > >                 {
> > >                         threshold: 2
>
> > >                 }
> > >         );
>
> > >         $('#artistsColumns a').mouseover(function(){
> > >                 $preview.attr('src', $(this).attr('rel'));
> > >         });
>
> > > Link:http://67.207.148.241/home
> > > (Move your mouse over the "Artists" top nav)


[jQuery] Position Div over Quicktime Movie

2009-03-24 Thread Nic Hubbard

Does anyone know of any jQuery/javascript trickery that can help with
positioning a div over a quicktime movie?  So far, I found found that
it is not possible.  But, it seems that there has to be some way to do
this!

Has anyone done this before?


[jQuery] Re: jQuery.preload - Getting Link Mode To Work

2009-03-24 Thread Nic Hubbard

Anyone?

On Mar 23, 2:08 pm, Nic Hubbard  wrote:
> I seem to be having issues with getting link mode to work with Ariel
> Flesler's preload plugin.  I have a hidden menu, which shows a hidden
> div when you mouse over a nav item.  This then shows a list of names,
> and I am using the preload plugin to load up a thumbnail image for
> each of the names.  Currently, it does not seem to be preloading, as
> running your mouse over each name takes a few seconds for the image to
> load.  So, for some reason,  it seems like they are not getting
> preloaded.
>
> And ideas on why this would be?  Did I implement the plugin wrong for
> link mode?
>
> Code:
> // - Artists Menu: Show Artist Preview Image -
>         var $links = $('#artistsColumns a').attr('rel');
>         var $preview = $('#artist_menu_artwork');
>
>         $.preload($links,
>                 {
>                         threshold: 2
>
>                 }
>         );
>
>         $('#artistsColumns a').mouseover(function(){
>                 $preview.attr('src', $(this).attr('rel'));
>         });
>
> Link:http://67.207.148.241/home
> (Move your mouse over the "Artists" top nav)


[jQuery] jQuery right before tag?

2009-03-23 Thread Nic Hubbard

I am working on optimizing my page for speed.  And, in doing this, I
am wondering if I should put jQuery, as well as my other .js files
right before the  tag, similar to google analytics files.  Is
this a good idea?  Or will this not work?


[jQuery] jQuery.preload - Getting Link Mode To Work

2009-03-23 Thread Nic Hubbard

I seem to be having issues with getting link mode to work with Ariel
Flesler's preload plugin.  I have a hidden menu, which shows a hidden
div when you mouse over a nav item.  This then shows a list of names,
and I am using the preload plugin to load up a thumbnail image for
each of the names.  Currently, it does not seem to be preloading, as
running your mouse over each name takes a few seconds for the image to
load.  So, for some reason,  it seems like they are not getting
preloaded.

And ideas on why this would be?  Did I implement the plugin wrong for
link mode?

Code:
// - Artists Menu: Show Artist Preview Image -
var $links = $('#artistsColumns a').attr('rel');
var $preview = $('#artist_menu_artwork');

$.preload($links,
{
threshold: 2

}
);

$('#artistsColumns a').mouseover(function(){
$preview.attr('src', $(this).attr('rel'));
});


Link: http://67.207.148.241/home
(Move your mouse over the "Artists" top nav)


[jQuery] Re: Invalid Argument in IE7/8

2009-03-14 Thread Nic Hubbard

Anyone?

I still can't figure out why jScroll Pane is causing the Invalid
Argument.

On Mar 13, 9:38 am, Henry  wrote:
> Nic Hubbard wrote:
> > Ok, I removed all instances of the cycle plugin when it is
> > not needed.  But, this has not fixed the problem in IE7/8.
>
> > Why would it be saying that jQuery.js is the file with the
> > problem?
>
> IE browser throw an "invalid argument" error when attempts are made to
> apply nonsensical values to CSS style properties, such as an attempt
> to set a width or height to a negative value.  If that sort of thing
> is the cause of your error then it is happening in the jQuery file
> because that is where the property is actually being set, but the real
> error will be wherever the nonsensical value is passed as an argument
> to the jQuery function/method call.


[jQuery] Re: Invalid Argument in IE7/8

2009-03-13 Thread Nic Hubbard

Ok, I tracked it down.

It is coming from jScroll Pane.  When I add the function:

$('#exhibitionsBoxInner').jScrollPane({
 showArrows:true,
 arrowSize: 10,
 scrollbarWidth: 6
 });

I get the error.  Removing it, and the error is gone, and the rest of
my functions work perfectly.

Ideas?

On Mar 13, 9:38 am, Henry  wrote:
> Nic Hubbard wrote:
> > Ok, I removed all instances of the cycle plugin when it is
> > not needed.  But, this has not fixed the problem in IE7/8.
>
> > Why would it be saying that jQuery.js is the file with the
> > problem?
>
> IE browser throw an "invalid argument" error when attempts are made to
> apply nonsensical values to CSS style properties, such as an attempt
> to set a width or height to a negative value.  If that sort of thing
> is the cause of your error then it is happening in the jQuery file
> because that is where the property is actually being set, but the real
> error will be wherever the nonsensical value is passed as an argument
> to the jQuery function/method call.


[jQuery] Re: Invalid Argument in IE7/8

2009-03-13 Thread Nic Hubbard

Hmm, I am not sure this is happeningbut I will look through my
scripts.

On Mar 13, 9:38 am, Henry  wrote:
> Nic Hubbard wrote:
> > Ok, I removed all instances of the cycle plugin when it is
> > not needed.  But, this has not fixed the problem in IE7/8.
>
> > Why would it be saying that jQuery.js is the file with the
> > problem?
>
> IE browser throw an "invalid argument" error when attempts are made to
> apply nonsensical values to CSS style properties, such as an attempt
> to set a width or height to a negative value.  If that sort of thing
> is the cause of your error then it is happening in the jQuery file
> because that is where the property is actually being set, but the real
> error will be wherever the nonsensical value is passed as an argument
> to the jQuery function/method call.


[jQuery] Should I test if an element exists?

2009-03-13 Thread Nic Hubbard

I have a .js file that I wrote for my whole sites.  Part of it only
pertain to certain pages, so some of the selectors would not find
anything on other pages.  This file is included in all pages, so my
question is, should I check if a selector exists first, before I run
each script?

I am thinking I could use:

if ( $('#myDiv').length ) {
  // Run my scrip there
}


[jQuery] Re: Invalid Argument in IE7/8

2009-03-13 Thread Nic Hubbard

Ok, I removed all instances of the cycle plugin when it is not
needed.  But, this has not fixed the problem in IE7/8.

Why would it be saying that jQuery.js is the file with the problem?

On Mar 13, 8:49 am, Josh Powell  wrote:
> Where does this error come from?
>
> [cycle] terminating; zero elements found by selector
>
> You can see it when the page loads on the firebug console, but it
> doesn't give a file name or line number.  it may be that since you
> aren't getting any elements back, IE is messing up because you are
> trying to use a method or attribute of those elements that are not
> defined.
>
> On Mar 13, 8:36 am, Nic Hubbard  wrote:
>
> > My page is throwing an invalid argument error on line 23 of jQuery,
> > version 1.2.6.  Is there any reason this should be happening?  It
> > seems that because of this, the rest of my script is not running.
>
> > I am using the cycle plugin as well as jScroll Panel.
>
> > Example:http://67.207.148.241/home


[jQuery] Re: Invalid Argument in IE7/8

2009-03-13 Thread Nic Hubbard

Nice find!

I realized I was not using Cycle on that page, but I had it embedded
in my template.  I will try removing that and see if it fixes the
invalid argument error.

On Mar 13, 8:49 am, Josh Powell  wrote:
> Where does this error come from?
>
> [cycle] terminating; zero elements found by selector
>
> You can see it when the page loads on the firebug console, but it
> doesn't give a file name or line number.  it may be that since you
> aren't getting any elements back, IE is messing up because you are
> trying to use a method or attribute of those elements that are not
> defined.
>
> On Mar 13, 8:36 am, Nic Hubbard  wrote:
>
> > My page is throwing an invalid argument error on line 23 of jQuery,
> > version 1.2.6.  Is there any reason this should be happening?  It
> > seems that because of this, the rest of my script is not running.
>
> > I am using the cycle plugin as well as jScroll Panel.
>
> > Example:http://67.207.148.241/home


[jQuery] Invalid Argument in IE7/8

2009-03-13 Thread Nic Hubbard

My page is throwing an invalid argument error on line 23 of jQuery,
version 1.2.6.  Is there any reason this should be happening?  It
seems that because of this, the rest of my script is not running.

I am using the cycle plugin as well as jScroll Panel.

Example: http://67.207.148.241/home


[jQuery] Re: jScoll Pane and Hidden Divs

2009-03-13 Thread Nic Hubbard

Yes.  http://67.207.148.241/exhibitions

Roll your mouse over exhibitions.

On Mar 13, 3:45 am, Alexandre Plennevaux 
wrote:
> can u put up an online demo somewhere?  (http://jsbin.com/)
>
> On Fri, Mar 13, 2009 at 8:55 AM, Nic Hubbard  wrote:
>
> > Well, I had thought of that, but I am needing to fade it in with the
> > fadeIn() function.  Not sure how how to do this when the jScroll is
> > inside the hidden div...
>
> > On Mar 13, 12:41 am, Alexandre Plennevaux 
> > wrote:
> >> yep it's correct: you need to initialise it then hide it. you could
> >> also position it outside the view port, initialise it, hide it, then
> >> position it back in the viewport to avoid the initial display.
>
> >> On Fri, Mar 13, 2009 at 6:43 AM, Nic Hubbard  wrote:
>
> >> > I have a hidden div that uses the .fadeIn() function when a link is
> >> > clicked.  Inside this is a div that uses jScroll Pane.  But, for some
> >> > reason when I hide that parent div first, jScroll pane won't work.  It
> >> > seems like it might not be initialized inside a hidden div.
>
> >> > Is this true?  Any ideas on how to get this working?
>
> >> >http://67.207.148.241/exhibitions(Mouseover Exhibitions)
>
> >> > Thanks!


[jQuery] Re: jScoll Pane and Hidden Divs

2009-03-13 Thread Nic Hubbard

Well, I had thought of that, but I am needing to fade it in with the
fadeIn() function.  Not sure how how to do this when the jScroll is
inside the hidden div...

On Mar 13, 12:41 am, Alexandre Plennevaux 
wrote:
> yep it's correct: you need to initialise it then hide it. you could
> also position it outside the view port, initialise it, hide it, then
> position it back in the viewport to avoid the initial display.
>
> On Fri, Mar 13, 2009 at 6:43 AM, Nic Hubbard  wrote:
>
> > I have a hidden div that uses the .fadeIn() function when a link is
> > clicked.  Inside this is a div that uses jScroll Pane.  But, for some
> > reason when I hide that parent div first, jScroll pane won't work.  It
> > seems like it might not be initialized inside a hidden div.
>
> > Is this true?  Any ideas on how to get this working?
>
> >http://67.207.148.241/exhibitions(Mouse over Exhibitions)
>
> > Thanks!


[jQuery] jScoll Pane and Hidden Divs

2009-03-12 Thread Nic Hubbard

I have a hidden div that uses the .fadeIn() function when a link is
clicked.  Inside this is a div that uses jScroll Pane.  But, for some
reason when I hide that parent div first, jScroll pane won't work.  It
seems like it might not be initialized inside a hidden div.

Is this true?  Any ideas on how to get this working?

http://67.207.148.241/exhibitions (Mouse over Exhibitions)

Thanks!


[jQuery] Re: Building Columns From A List Of Items

2009-03-03 Thread Nic Hubbard

Ok, I think I worked out my own solution.  If anyone sees and problems
with this working when adding more items to the list please let me
know.  So far it is working great!

var total_artists = $('#artistsColumns p').length;
var total_artists_mod = total_artists % 3;
var total_artists_col = total_artists / 3;
$('#artistsColumns p').slice(0 , total_artists_col).addClass
('first');
$('#artistsColumns p').slice(total_artists_col , total_artists_col *
2).addClass('second');
$('#artistsColumns p').slice(total_artists_col * 2 ,
(total_artists_col * 3) + total_artists_mod).addClass('third');

// Now lets wrap those in some divs
$('p.first').wrapAll('');
$('p.second').wrapAll('');
$('p.third').wrapAll('');

On Mar 3, 11:02 am, brian  wrote:
> On Tue, Mar 3, 2009 at 1:48 PM, Nic Hubbard  wrote:
>
> > Should I keep the division by 10 on the Math function?
>
> No, as i said, that's the problem. There's not only no need for it,
> but it's giving you results you don't want. Quick: what's zero divided
> by ten? And what's the remainder of that result divided by 3?
>
> This should help to illustrate what's going on:
>
> $('#artistsColumns p').each(function(i){
>         var d = Math.floor(i/10);
>         var n = d % 3;
>         $(this).html('d:' + d + ' n:' + n + '' +
> $(this).html());
>         $(this).addClass(classNames[n]);
>
> });


[jQuery] Re: Building Columns From A List Of Items

2009-03-03 Thread Nic Hubbard

Sure Jack, I would be happy to give it a try.  Let me know what I need
to do.

On Mar 3, 5:24 pm, Jack Killpatrick  wrote:
> Nic, I've got an almost-completed "listcols". If you'd like to give it a
> try, let me know and I'll get you a pre-release copy. It splits a list
> (UL, OL or any child nodes) into evenly balanced columns using the
> actual height of the list items. It also has options for how many cols
> and how wide the 'gutter' between them should be. It does not have a
> means to re-render the list if items get added to it after the list gets
> 'converted'.
>
> I'm not sure if it would meet your needs for this situation, but
> throwing it out there in case you want to give it a try.
>
> - Jack
>
> Nic Hubbard wrote:
> > I have a list of names wrapped in  tags that are sorted in
> > alphabetical order.  I am trying to build 3 even columns out of
> > these.  There are 63 items, so each column should have 21 items.  I
> > have a script that kind of works, but it is making my items out of
> > order, as it is somehow grouping them in a strange way.
>
> >    var classNames = ['first', 'second', 'third'];
> >    $('#artistsColumns p').each(function(i){
> >            var n = Math.floor(i/10) % 3;
> >            $(this).addClass(classNames[n]);
> >    });
>
> >    // Now lets wrap those in some divs
> >    $('p.first').wrapAll('');
> >    $('p.second').wrapAll('');
> >    $('p.third').wrapAll('');
>
> > Basically each group of classes get wrapped with a "column" div, but,
> > once of the columns is getting too many times and the items are
> > getting the wrong classes.
>
> > Also, how can I write this so that I can continue to add new items and
> > it will keep my columns as even as possible?


[jQuery] Re: Building Columns From A List Of Items

2009-03-03 Thread Nic Hubbard

Would it be a better idea to use the .slice() function rather than
what I have?  Couldn't I just use the same math function to calculate
the number of items in each column?

On Mar 3, 11:59 am, Nic Hubbard  wrote:
> I understand now, and I appreciate your help.
>
> A new problem has arisen from this.  It seems that this loops through
> elements grouped in 3, rather than apply the class for the first
> column first, then the second one.
>
> Here is what I mean.  Say I have 9 p tags containing links.  This is
> how the script writes the classes:
>
> Content
> Content
> Content
> Content
> Content
> Content
> Content
> Content
> Content
>
> So, when I group those by class name, and add a column div around
> them, they are completely out of their original order.  What I really
> need to do is:
>
> Content
> Content
> Content
> Content
> Content
> Content
> Content
> Content
> Content
>
> This way, it will group them properly when I use the wrapAll function.
>
> Is there a way to do it this way?
>
> Thanks again for your help!
>
> On Mar 3, 11:02 am, brian  wrote:
>
> > On Tue, Mar 3, 2009 at 1:48 PM, Nic Hubbard  wrote:
>
> > > Should I keep the division by 10 on the Math function?
>
> > No, as i said, that's the problem. There's not only no need for it,
> > but it's giving you results you don't want. Quick: what's zero divided
> > by ten? And what's the remainder of that result divided by 3?
>
> > This should help to illustrate what's going on:
>
> > $('#artistsColumns p').each(function(i){
> >         var d = Math.floor(i/10);
> >         var n = d % 3;
> >         $(this).html('d:' + d + ' n:' + n + '' +
> > $(this).html());
> >         $(this).addClass(classNames[n]);
>
> > });


[jQuery] Re: Show/Hide Menu

2009-03-03 Thread Nic Hubbard

Hmm, it looks nice to me. :)

On Mar 3, 3:20 pm, Jack Killpatrick  wrote:
> great! but the important part: is it a nice or a bad puppy? 
>
> - Jack
>
> Nic Hubbard wrote:
> > Yes!  That is exactly what I was looking for!  I have implemented it
> > and it works perfectly, thank you!
>
> > On Mar 3, 9:54 am, Jack Killpatrick  wrote:
>
> >> Here's an example of a way to handle that:
>
> >>http://www.ihwy.com/Labs/demos/Current/image-hover-menu.aspx
>
> >> - Jack
>
> >> Nic Hubbard wrote:
>
> >>> Thanks.
>
> >>> This almost seems like it would work. But, since the element that the
> >>> hover is added to, and the element that is shown are different, by the
> >>> time you move your mouse from the hover element to the element that is
> >>> shown, your mouse moves out of the first element, and the shown div
> >>> disappears.
>
> >>> Essentially it needs to have the functionality of css dropdowns:
> >>>http://www.cssplay.co.uk/menus/final_drop.html
> >>> They stay out there until your mouse moves off of them.
>
> >>> On Mar 3, 12:14 am, Jack Killpatrick  wrote:
>
> >>>> You might want to try 
> >>>> .hover():http://docs.jquery.com/Events/hover#overout
>
> >>>> - Jack
>
> >>>> Nic Hubbard wrote:
>
> >>>>> I have a menu that is activated on mouseover a link.  The menu is a
> >>>>> hidden div which appears.  My problem now is how to remove/hide that
> >>>>> div when a user move their mouse off of the menu.  I have tried adding
> >>>>> a mouseout event to the div, but because there are child divs inside
> >>>>> that div, any mousing over them hides the parent div as well, which I
> >>>>> don't want.  I only want it to hide if the mouse is outside the parent
> >>>>> div, not anywhere within it.
>
> >>>>>    // - Show Artists Menu When Link moused over --
> >>>>>    $('a#Artists').mouseover(function() {
>
> >>>>>            // Show Our Artists Box
> >>>>>            $('#artistsBox').fadeIn('slow');
>
> >>>>>    });//end mouseover
>
> >>>>>    // - Add Stuff When Link moused over --
> >>>>>    $('#artistsBox').mouseover(function() {
>
> >>>>>            // Add a mouse out on our box
> >>>>>            $('#artistsColumns').mouseout(function() {
>
> >>>>>                    // Hide Our Artists Box
> >>>>>                    $('#artistsBox').fadeOut('slow');
>
> >>>>>            });//end mouseover
>
> >>>>>    });//end mouseover
>
> >>>>> 
> >>>>> links and stuff in here
> >>>>> 
>
> >>>>> Because the mouseout event is attatched to artistsBox, mousing over
> >>>>> artistsColumns hides the div as well, which I don't want.
>
> >>>>> Any ideas?


[jQuery] Re: Show/Hide Menu

2009-03-03 Thread Nic Hubbard

Yes!  That is exactly what I was looking for!  I have implemented it
and it works perfectly, thank you!

On Mar 3, 9:54 am, Jack Killpatrick  wrote:
> Here's an example of a way to handle that:
>
> http://www.ihwy.com/Labs/demos/Current/image-hover-menu.aspx
>
> - Jack
>
> Nic Hubbard wrote:
> > Thanks.
>
> > This almost seems like it would work. But, since the element that the
> > hover is added to, and the element that is shown are different, by the
> > time you move your mouse from the hover element to the element that is
> > shown, your mouse moves out of the first element, and the shown div
> > disappears.
>
> > Essentially it needs to have the functionality of css dropdowns:
> >http://www.cssplay.co.uk/menus/final_drop.html
> > They stay out there until your mouse moves off of them.
>
> > On Mar 3, 12:14 am, Jack Killpatrick  wrote:
>
> >> You might want to try .hover():http://docs.jquery.com/Events/hover#overout
>
> >> - Jack
>
> >> Nic Hubbard wrote:
>
> >>> I have a menu that is activated on mouseover a link.  The menu is a
> >>> hidden div which appears.  My problem now is how to remove/hide that
> >>> div when a user move their mouse off of the menu.  I have tried adding
> >>> a mouseout event to the div, but because there are child divs inside
> >>> that div, any mousing over them hides the parent div as well, which I
> >>> don't want.  I only want it to hide if the mouse is outside the parent
> >>> div, not anywhere within it.
>
> >>>    // - Show Artists Menu When Link moused over --
> >>>    $('a#Artists').mouseover(function() {
>
> >>>            // Show Our Artists Box
> >>>            $('#artistsBox').fadeIn('slow');
>
> >>>    });//end mouseover
>
> >>>    // - Add Stuff When Link moused over --
> >>>    $('#artistsBox').mouseover(function() {
>
> >>>            // Add a mouse out on our box
> >>>            $('#artistsColumns').mouseout(function() {
>
> >>>                    // Hide Our Artists Box
> >>>                    $('#artistsBox').fadeOut('slow');
>
> >>>            });//end mouseover
>
> >>>    });//end mouseover
>
> >>> 
> >>> links and stuff in here
> >>> 
>
> >>> Because the mouseout event is attatched to artistsBox, mousing over
> >>> artistsColumns hides the div as well, which I don't want.
>
> >>> Any ideas?


[jQuery] Re: Building Columns From A List Of Items

2009-03-03 Thread Nic Hubbard

I understand now, and I appreciate your help.

A new problem has arisen from this.  It seems that this loops through
elements grouped in 3, rather than apply the class for the first
column first, then the second one.

Here is what I mean.  Say I have 9 p tags containing links.  This is
how the script writes the classes:

Content
Content
Content
Content
Content
Content
Content
Content
Content

So, when I group those by class name, and add a column div around
them, they are completely out of their original order.  What I really
need to do is:

Content
Content
Content
Content
Content
Content
Content
Content
Content

This way, it will group them properly when I use the wrapAll function.

Is there a way to do it this way?

Thanks again for your help!

On Mar 3, 11:02 am, brian  wrote:
> On Tue, Mar 3, 2009 at 1:48 PM, Nic Hubbard  wrote:
>
> > Should I keep the division by 10 on the Math function?
>
> No, as i said, that's the problem. There's not only no need for it,
> but it's giving you results you don't want. Quick: what's zero divided
> by ten? And what's the remainder of that result divided by 3?
>
> This should help to illustrate what's going on:
>
> $('#artistsColumns p').each(function(i){
>         var d = Math.floor(i/10);
>         var n = d % 3;
>         $(this).html('d:' + d + ' n:' + n + '' +
> $(this).html());
>         $(this).addClass(classNames[n]);
>
> });


[jQuery] Re: Building Columns From A List Of Items

2009-03-03 Thread Nic Hubbard

Should I keep the division by 10 on the Math function?

On Mar 3, 10:08 am, brian  wrote:
> The division by 10 is your problem. Try:
>
> $(this).addClass(classNames[(i + 3) % 3]);
>
> On Tue, Mar 3, 2009 at 2:21 AM, Nic Hubbard  wrote:
>
> > I have a list of names wrapped in  tags that are sorted in
> > alphabetical order.  I am trying to build 3 even columns out of
> > these.  There are 63 items, so each column should have 21 items.  I
> > have a script that kind of works, but it is making my items out of
> > order, as it is somehow grouping them in a strange way.
>
> >        var classNames = ['first', 'second', 'third'];
> >        $('#artistsColumns p').each(function(i){
> >                var n = Math.floor(i/10) % 3;
> >                $(this).addClass(classNames[n]);
> >        });
>
> >        // Now lets wrap those in some divs
> >        $('p.first').wrapAll('');
> >        $('p.second').wrapAll('');
> >        $('p.third').wrapAll('');
>
> > Basically each group of classes get wrapped with a "column" div, but,
> > once of the columns is getting too many times and the items are
> > getting the wrong classes.
>
> > Also, how can I write this so that I can continue to add new items and
> > it will keep my columns as even as possible?


[jQuery] Re: Show/Hide Menu

2009-03-03 Thread Nic Hubbard

Thanks.

This almost seems like it would work. But, since the element that the
hover is added to, and the element that is shown are different, by the
time you move your mouse from the hover element to the element that is
shown, your mouse moves out of the first element, and the shown div
disappears.

Essentially it needs to have the functionality of css dropdowns:
http://www.cssplay.co.uk/menus/final_drop.html
They stay out there until your mouse moves off of them.

On Mar 3, 12:14 am, Jack Killpatrick  wrote:
> You might want to try .hover():http://docs.jquery.com/Events/hover#overout
>
> - Jack
>
> Nic Hubbard wrote:
> > I have a menu that is activated on mouseover a link.  The menu is a
> > hidden div which appears.  My problem now is how to remove/hide that
> > div when a user move their mouse off of the menu.  I have tried adding
> > a mouseout event to the div, but because there are child divs inside
> > that div, any mousing over them hides the parent div as well, which I
> > don't want.  I only want it to hide if the mouse is outside the parent
> > div, not anywhere within it.
>
> >    // - Show Artists Menu When Link moused over --
> >    $('a#Artists').mouseover(function() {
>
> >            // Show Our Artists Box
> >            $('#artistsBox').fadeIn('slow');
>
> >    });//end mouseover
>
> >    // - Add Stuff When Link moused over --
> >    $('#artistsBox').mouseover(function() {
>
> >            // Add a mouse out on our box
> >            $('#artistsColumns').mouseout(function() {
>
> >                    // Hide Our Artists Box
> >                    $('#artistsBox').fadeOut('slow');
>
> >            });//end mouseover
>
> >    });//end mouseover
>
> > 
> > links and stuff in here
> > 
>
> > Because the mouseout event is attatched to artistsBox, mousing over
> > artistsColumns hides the div as well, which I don't want.
>
> > Any ideas?


[jQuery] Show/Hide Menu

2009-03-02 Thread Nic Hubbard

I have a menu that is activated on mouseover a link.  The menu is a
hidden div which appears.  My problem now is how to remove/hide that
div when a user move their mouse off of the menu.  I have tried adding
a mouseout event to the div, but because there are child divs inside
that div, any mousing over them hides the parent div as well, which I
don't want.  I only want it to hide if the mouse is outside the parent
div, not anywhere within it.

// - Show Artists Menu When Link moused over --
$('a#Artists').mouseover(function() {

// Show Our Artists Box
$('#artistsBox').fadeIn('slow');

});//end mouseover


// - Add Stuff When Link moused over --
$('#artistsBox').mouseover(function() {

// Add a mouse out on our box
$('#artistsColumns').mouseout(function() {

// Hide Our Artists Box
$('#artistsBox').fadeOut('slow');

});//end mouseover

});//end mouseover



links and stuff in here


Because the mouseout event is attatched to artistsBox, mousing over
artistsColumns hides the div as well, which I don't want.

Any ideas?


[jQuery] Building Columns From A List Of Items

2009-03-02 Thread Nic Hubbard

I have a list of names wrapped in  tags that are sorted in
alphabetical order.  I am trying to build 3 even columns out of
these.  There are 63 items, so each column should have 21 items.  I
have a script that kind of works, but it is making my items out of
order, as it is somehow grouping them in a strange way.

var classNames = ['first', 'second', 'third'];
$('#artistsColumns p').each(function(i){
var n = Math.floor(i/10) % 3;
$(this).addClass(classNames[n]);
});

// Now lets wrap those in some divs
$('p.first').wrapAll('');
$('p.second').wrapAll('');
$('p.third').wrapAll('');

Basically each group of classes get wrapped with a "column" div, but,
once of the columns is getting too many times and the items are
getting the wrong classes.

Also, how can I write this so that I can continue to add new items and
it will keep my columns as even as possible?


[jQuery] Re: Apply class to range of child elements

2009-03-02 Thread Nic Hubbard

Hi Ricardo,

Could you explain why you did %4 for the n variable?

On Feb 26, 12:16 pm, ricardobeat  wrote:
> I like it cleaner:
>
> $('a').each(function(i){
>    var n = Math.floor(i/10) % 4;
>    $(this).addClass(
>       n == 0 ? 'first' :
>       n == 1 ? 'second' :
>       n == 2 ? 'third' :
>       n == 3 ? 'fourth' : '');
>
> });
>
> or
>
> var classNames = ['first', 'second', 'third', 'fourth'];
> $('a').each(function(i){
>    var n = Math.floor(i/10) % 4;
>    $(this).addClass(classNames[n]);
>
> });
>
> This also gives you support for infinite expansion. An index of 45
> will evaluate to class 'first', 51 to 'second', 85 to 'first' again
> and so on.
>
> cheers,
> - ricardo
>
> On Feb 26, 6:29 am, mkmanning  wrote:
>
> > And just as an exercise, here's the 'jQuery' way chained:
>
> > $('a').filter(':lt(10)').addClass('first').end().filter(':gt(9):lt
> > (10)').addClass('second').end().filter(':gt(19):lt(10)').addClass
> > ('third').end().filter(':gt(29)').addClass('fourth');
>
> > Not really any speed gain though.
>
> > On Feb 26, 1:21 am, mkmanning  wrote:
>
> > > It's possible. Here's a more traditional way:
>
> > >         $('a').each(function(i,link){
> > >             if(i<10){$(link).addClass('first');}
> > >             else if (i>9 && i<20){$(link).addClass('second');}
> > >             else if (i>19&&i<30){$(link).addClass('third');}
> > >                 else if (i>29&&i<40){$(link).addClass('fourth');}
> > >         })
>
> > > Here's a more 'jQuery' way:
> > >         $('a:lt(10)').addClass('first');
> > >         $('a:gt(9):lt(10)').addClass('second');
> > >         $('a:gt(19):lt(10)').addClass('third');
> > >         $('a:gt(29):lt(10)').addClass('fourth');
>
> > > Which is better? The first takes a little over half as long as the
> > > second.
>
> > > On Feb 25, 10:45 pm, Nic Hubbard  wrote:
>
> > > > I have a list of links, around 40 of them.  I want to apply classes to
> > > > groups of them.  So, items 1-10 I want to apply a class to, then
> > > > 11-20, then 21-30 and 31-40, each of these groups should have their
> > > > own class.
>
> > > > Is something like this possible?  I looked through the jQuery
> > > > selectors and could not find a solution.


[jQuery] Cycle Plugin and Loading Images

2009-03-02 Thread Nic Hubbard

I have a question about the Cycle plugin.

I have a slideshow with many large images.  Is it possible to preload
these or somehow load them at the time of the transition?  I am just
wanting to figure out a way so that all of my images don't have to
load at the same time and cause long page loads.

What about loading from a javascript array?


[jQuery] jCarousel Effects

2009-03-01 Thread Nic Hubbard

I am wanting to use jCarousel but I am wondering if the only option
for effects is to use the easing plugin?  Or, is there a way to just
simply specify the fade effect?


[jQuery] Re: Slideshow Using Ajax

2009-03-01 Thread Nic Hubbard

Actually, it looks like jCarousel might do what I want...

On Mar 1, 9:53 pm, mkmanning  wrote:
> @Nic, can you explain what you're trying to acheive? If you know the
> images' urls, then you can just cycle through them and update an img
> tag's src attribute for a slideshow.
>
> On Mar 1, 8:57 pm, Ami  wrote:
>
> > There is no way to load images in AJAX. AJAX is only for text (Like JS/
> > CSS/JSON/XML,...)
> > You can use AJAX to load the image source, and put it in ,
> > or 
>
> > On Mar 2, 5:53 am, Nic Hubbard  wrote:
>
> > > I have been searching for a jQuery slideshow plugin that can load in
> > > images using ajax.  But I am having a really hard time finding one.
>
> > > Does anyone have any recommendations for one?


[jQuery] Re: Slideshow Using Ajax

2009-03-01 Thread Nic Hubbard

Yes, I know the src URLs.

Basically I want the functionality of the jQuery cycle plugin, but
when you click the next button, it will load the next image src in
through ajax, or a js array.  The reason for this is, with the normal
slideshows and cycle plugins they load up all the images at the same
time.  I have a site that uses high quality images, and I wanted to
avoid long initial load times for those pages.

On Mar 1, 9:53 pm, mkmanning  wrote:
> @Nic, can you explain what you're trying to acheive? If you know the
> images' urls, then you can just cycle through them and update an img
> tag's src attribute for a slideshow.
>
> On Mar 1, 8:57 pm, Ami  wrote:
>
> > There is no way to load images in AJAX. AJAX is only for text (Like JS/
> > CSS/JSON/XML,...)
> > You can use AJAX to load the image source, and put it in ,
> > or 
>
> > On Mar 2, 5:53 am, Nic Hubbard  wrote:
>
> > > I have been searching for a jQuery slideshow plugin that can load in
> > > images using ajax.  But I am having a really hard time finding one.
>
> > > Does anyone have any recommendations for one?


  1   2   >