[jQuery] Re: number of elements with a specific CSS class

2009-03-28 Thread Macsig

so easy ;)

thank you man

On Mar 28, 10:33 pm, Marco Elisio Oliveira Jardim
 wrote:
> A simple
>
> $('#slider .navigation li').length;
>
> will make it. ;)
>
> _
> Lois Griffin: I’m a naughty girl and I need a spanking!
> Peter Griffin: And I'm a paladin with 18 charisma and 97 hit-points, I can
> use my helm of disintegration and do 1d4 damage as my half-mage elf wields
> his +5 holy avenger.
> Lois Griffin: Wait a minute, paladins can’t use the helm of disentegration!
> Peter Griffin: oh — In that case then I’m a black guy.
>
> On Sun, Mar 29, 2009 at 02:24, macsig  wrote:
>
> > Hello guys,
> > is there a way to know how many element have a specific CSS class?
> > I have a list and I need to know how many items it contains.
> > I guess it should be omething like:  $('#slider .navigation li'). ...
> > Thanks


[jQuery] Re: number of elements with a specific CSS class

2009-03-28 Thread Marco Elisio Oliveira Jardim
A simple

$('#slider .navigation li').length;

will make it. ;)


_
Lois Griffin: I’m a naughty girl and I need a spanking!
Peter Griffin: And I'm a paladin with 18 charisma and 97 hit-points, I can
use my helm of disintegration and do 1d4 damage as my half-mage elf wields
his +5 holy avenger.
Lois Griffin: Wait a minute, paladins can’t use the helm of disentegration!
Peter Griffin: oh — In that case then I’m a black guy.



On Sun, Mar 29, 2009 at 02:24, macsig  wrote:

>
> Hello guys,
> is there a way to know how many element have a specific CSS class?
> I have a list and I need to know how many items it contains.
> I guess it should be omething like:  $('#slider .navigation li'). ...
> Thanks


[jQuery] Re: click(function() works only once per page load?

2009-03-28 Thread Ricardo

Your click handler only applies to the elements matching
".ajax_homes_primary_img" at the time the click() function is called.
When you replace it, the new element has no event listeners attached.
You can either rebind the event every time you modify it, or use the
'live' function, which uses event delegation: http://docs.jquery.com/Events/live

That's as simple as changing $(".ajax_homes_primary_img").click
(function(){ to $(".ajax_homes_primary_img").live('click', function()
{...

cheers,
- ricardo

On Mar 28, 10:32 am, "Mr.Zeph"  wrote:
> Hi,
>
> I'm brand new to jQuery, and so far I love it! I don't know ajax from
> a cumquat and yet, here I am ajaxing around merrily, even if clumsily.
> I've run into a situation where I have a grid of images, one which is
> to be the default, or the main image. When I click the radio button,
> it correctly triggers, retrieves a page, server side that does the
> database update (correctly), then deletes the current contents of a
> tbody, and sucks in a new one (pure HTML, no json, or xml, or
> whatever). By all appearances it loads correctly, but for some reason,
> selecting another radio button fails to trigger the .click() function,
> I've tested this by using a simple alert(). I've gone through the
> archives here, and I can't discern much from the docs, but maybe I'm
> missing some key concepts that would have helped me fine tune my
> search.
>
> Is there something that I might be missing? All code (yes! that's ALL
> of it! I love jQuery!) is included below and suggestions are highly
> appreciated.
>
> // User clicked the "make primary image" radio button
> $(".ajax_homes_primary_img").click(function() {
>         //$(".ajax_homes_primary_img");
>
>         // Get and keep the table the same height so that it doesn't collapse
> on reload
>         var tblHeight = $('#homes_image_grid > tbody').height();
>         $('#homes_image_grid').css('height', tblHeight);
>
>         // Retrieve the value of the primary_image radio button, and the
> property record's ID
>         var img_id =  $(this).val();
>         var prop_id = $('#property_id_field').val();
>
>         // Hide the current records (just looks cool)
>         var tblRows = $('#homes_image_grid > tbody > tr');
>         tblRows.fadeOut('slow');
>
>         // Let's update the database table with the value of the radio button
>         $.ajax({
>                 url: '/homes/admin/index.cfm?
> fuseaction=ajax_property_images_update&property_id='+ prop_id
> +'&image_id=' + img_id,
>                 cache: false,
>                 success: function(html){
>
>                         // Clear the tbody out so as to not confuse with 
> element IDs
>                         tblRows.remove();
>                 }
>         });
>
>         // Now let's fetch the new data and append it to the tbody we just
> cleared out.
>         $.ajax({
>                 url: '/homes/admin/index.cfm?
> fuseaction=ajax_property_images_get&property_id=' + prop_id,
>                 cache: false,
>                 success: function(html){
>                         $("#homes_image_grid > tbody").append(html);
>                 }
>         });
>
> });


[jQuery] number of elements with a specific CSS class

2009-03-28 Thread macsig

Hello guys,
is there a way to know how many element have a specific CSS class?
I have a list and I need to know how many items it contains.
I guess it should be omething like:  $('#slider .navigation li'). ...
Thanks


[jQuery] Re: Why isn't there any list widget?

2009-03-28 Thread Zach

Sorry, that site is a bad example. I was referring to the list of
links on the site. I can't just use CSS because I want the list to be
dynamically generated with addItem() and removeItem() methods, and I
also want items to be selectable.

On Mar 29, 12:30 am, brian  wrote:
> On Sat, Mar 28, 2009 at 11:30 PM, Zach  wrote:
>
> > I've searched extensively for a jquery widget that allows me to add/
> > remove items to a list, set font size, etc. For an example of what I
> > mean, see here:
>
> >http://www.webresourcesdepot.com/dnspinger/
>
> What are we supposed to be looking at? Is there supposed to be some
> dynamic list style-changer thingy? I don't see it.
>
> Maybe what you're looking for is simply plain CSS.


[jQuery] Re: Why isn't there any list widget?

2009-03-28 Thread brian

On Sat, Mar 28, 2009 at 11:30 PM, Zach  wrote:
>
> I've searched extensively for a jquery widget that allows me to add/
> remove items to a list, set font size, etc. For an example of what I
> mean, see here:
>
> http://www.webresourcesdepot.com/dnspinger/
>

What are we supposed to be looking at? Is there supposed to be some
dynamic list style-changer thingy? I don't see it.

Maybe what you're looking for is simply plain CSS.


[jQuery] Re: retrieving DOM element with specific CSS class

2009-03-28 Thread Marco Elisio Oliveira Jardim
The jQuery('some_selector') method will retrieve an array of objects, no
matter how many items exists with that selector.

In your case you should use something like this:

jQuery('#slider.navigation a.selected')[0].id;
^^ (you
missed the array position of the element)


_
Lois Griffin: I’m a naughty girl and I need a spanking!
Peter Griffin: And I'm a paladin with 18 charisma and 97 hit-points, I can
use my helm of disintegration and do 1d4 damage as my half-mage elf wields
his +5 holy avenger.
Lois Griffin: Wait a minute, paladins can’t use the helm of disentegration!
Peter Griffin: oh — In that case then I’m a black guy.



On Sat, Mar 28, 2009 at 22:46, macsig  wrote:

>
> Hello guys, I'm trying to make some changes to the coda slider effect
> on jqueryfordesigners.com
> Basically what I want is changing the buttons every time I move from a
> panel to an other one.
>
>
> I have the code below:
>
> 
>  
>FIRST
>SECOND
>THIRD
>  
> ...
> 
>
> and the link to the current panel have the class 'selected'
>
> Here the question: how can I retrieve the id of the link with the
> class 'selected'?
>
> I guess it should be something like:  $('#slider .navigation').find
> ('a').XXX('selected').id but I don't know how to put in place of XXX.
>
>
> Thanks
>
>
> Sig
>
>
>
>


[jQuery] Re: Removing Single Option from Select

2009-03-28 Thread iceangel89

THANKS!

On Mar 27, 8:00 pm, Pierre Bellan  wrote:
> Hi,
> you select your select :
>
> $('#myselect');
>
> then u find the option with the value -1 :
>
> $('#myselect').find('option[value=-1]')
> or
> $('#myselect option[value="-1"]');
>
> finally you removed it
> $('#myselect option[value="-1"]').remove();
>
> Pierre
>
> 2009/3/27 iceangel89 
>
>
>
> > How can i remove a single option (with value -1, if possible) from a
> > select?


[jQuery] Re: Call for contributors: A simple, fast and flexible grid/spreadsheet component.

2009-03-28 Thread Zachariah

Well, so far my lesson from that project has been 'do the other things
first until you find the right grid'.
It's a really big project, so I've had plenty keeping me busy in the
mean time.

What I do know is that making a grid out of a normal table severely
limited my ability to do creative things with it - not all things that
have data that falls into a grid, should sort like a grid, etc, looks
like a perfect table.

One implementation that would be exceptionally useful to me that I see
your grid fitting into would be a dataset that gets loaded in the
background so that pagination to the next 'page' of results in the
grid get cached in javascript... in the background.
if the 'next page' worth of data has been loaded, the grid immediately
uses the data upon a next event. If it has not, then it waits for an
ajax request for the info to be returned. The next hurdle would be
sorting those columns, as it would only be able to sort using just
what it has retrieved if it retrieved the entire set, otherwise it
would have to do an ajax call to allow the server-side to return the
dataset pre-sorted (using sql). Any thoughts on any of that?

The main point of the above example is that your grid, seeing as its
dataset is in javascript (arrays) and not in the DOM, I feel this
would be easier for me to implement, and the implementation could make
faster decisions about what to do next based on it's current cache of
data vs what the server said was left. Am I barking up the right tree
here?

I see what you mean about the need for docs and solid ground -
hopefully this discussion will arouse interest.

The fact that you are not just creating a giant table in the DOM, and
instead showing only what is necessary should be enough to peek an
adept ajaxer's interest.
I'd be all over helping you build this, however I'm not so much a
javascript ninja yet. I'll be playing with it here, and will certainly
offer my thoughts and experiences with it.

-Zachariah

On Mar 27, 4:14 pm, Tin  wrote:
> Zachariah,
>
> Thanks for the word of encouragement!  Do you have any feedback/
> lessons learned from your application?
> I've made a lot of progress recently in terms of adding a DataView to
> drive the grid and optimizing the core loop, but formalizing the API
> and writing the documentation haven't been moving very fast.
> Unfortunately, without that documentation, a lot of people seem to be
> dismissing it at first glance without realizing what makes SlickGrid
> different.
>
> +Michael
>
> On Mar 27, 4:24 am, Zachariah  wrote:
>
> > Michael,
>
> > I am incredibly impressed with the speed of this grid. Last month I
> > began a search for the right grid, and I didn't find it. For my
> > application, I needed formatting flexibility that tables could not
> > offer, and large data-set handling that make most other grids studder.
> > I've been using jquery for quite sometime and yet have never been
> > compelled to post in the forums until now (as I always found my answer
> > before I did). I truly hope an incarnation of SlickGrid makes it into
> > jquery ui and therefore gets all the love and attention necessary to
> > make it the star it deserves to become.
>
> > -Zachariah


[jQuery] Why isn't there any list widget?

2009-03-28 Thread Zach

I've searched extensively for a jquery widget that allows me to add/
remove items to a list, set font size, etc. For an example of what I
mean, see here:

http://www.webresourcesdepot.com/dnspinger/

Could anyone point me in the right direction?


[jQuery] [JQuery UI] Styles

2009-03-28 Thread iceangel89

i am wondering how can i create a button like the open dialog button
in http://jqueryui.com/themeroller/ when i copy and paste the source
for the button from the jqueryui site, i dun get the right positioning
without editting the css. am i missing something?

Open Dialog

inline style="" are added by me. is there a documentation to tell me
how i can replicate those buttons/link styles? trial and error is
taking some time


[jQuery] Re: Using $.get with preload page seems to strip JavaScript

2009-03-28 Thread pthesis

Just to clarify and update...

I've attempted to use the LiveQuery plugin (see code below) so that
elements that don't exist yet (that are getting retrieved via $.get)
get bound to the 'click' event, but that didn't change anything.

HTML pre-load page: test.html
Content page loaded via $.get: test.php

The JavaScript code I'm trying to get to work enables the "color theme
switcher" link on the top-right portion of the page. The code is:

jQuery('#switcher_wrapper > div').livequery('click', function() {
   jQuery(this).siblings().removeClass();
   jQuery(this).addClass('clr_picked');
  if(this.id == 'org_blk') {
 jQuery('#left').removeClass().addClass('org_blk');
 jQuery('#right').removeClass().addClass('org_blk');
 jQuery('#content').removeClass().addClass('content_org');
 jQuery('body').removeClass();
 jQuery('#subtitle').removeClass();
 jQuery('#about').removeClass();
 jQuery('#comments').removeClass();
 jQuery('#blog').attr("src","feed.html");
  }
  if(this.id == 'org_solid') {
 jQuery('#left').removeClass().addClass('org_solid');
 jQuery('#right').removeClass().addClass('org_solid');
 jQuery('#content').removeClass().addClass('content_org');
 jQuery('body').removeClass();
 jQuery('#subtitle').removeClass();
 jQuery('#about').removeClass();
 jQuery('#comments').removeClass();
 jQuery('#blog').attr("src","feed.html");
  }
  if(this.id == 'org_grad') {
 jQuery('#left').removeClass().addClass('org_grad');
 jQuery('#right').removeClass().addClass('org_grad');
 jQuery('#content').removeClass().addClass('content_org');
 jQuery('body').removeClass();
 jQuery('#subtitle').removeClass();
 jQuery('#about').removeClass();
 jQuery('#comments').removeClass();
 jQuery('#blog').attr("src","feed.html");
  }
  if(this.id == 'blk_blk') {
 jQuery('#left').removeClass().addClass('blk_blk');
 jQuery('#right').removeClass().addClass('blk_blk');
 jQuery('#content').removeClass().addClass('content_blk');
 jQuery('body').removeClass().addClass('blk_bg_solid');
 jQuery('#subtitle').removeClass().addClass('blk_bg_solid');
 jQuery('#about').removeClass().addClass('blk_bg_solid');
 jQuery('#comments').removeClass().addClass('blk_bg_solid');
 jQuery('#blog').attr("src","feed_blk.html");
  }
});


There are a couple of other jQuery and even Prototype events that
aren't working on the page, but hopefully I can figure those out on my
own after I get one working.


Thanks in advance for your help.

On Mar 28, 1:08 pm, pthesis  wrote:
> Hi guys,
>
> I want to display a simple "Loading..." image while my page loads.
> I've got it halfway working athttp://pranshuarya.com/test.html.  The
> problem is that once the page gets loaded, the JavaScript
> functionality in it doesn't work (even though the files are getting
> loaded).  You'll know what I mean if you compare what gets loaded to
> the main page (http://pranshuarya.com).
>
> The approach I'm taking is to call the following function via  onload"loadSite()">
>
> function loadSite(){
>         jQuery.get("test.php", function(data) {
>                 jQuery(document).ready(function() {
>                         jQuery('#loader').hide();
>                         jQuery('body').prepend(data);
>                 });
>      });
>
> }
>
> So test.html loads up, displays the preloader image, fetches test.php
> via $.get, and once the DOM is ready, hides the preloader and prepends
> the contents of test.php to  of test.html.  All the JavaScript
> functions are in test.html, not test.php.  Test.php contains only PHP
> and HTML code.
>
> I'm not even sure if this is the right approach to do what I want.
> I'm just experimenting since I haven't been able to find any solid
> documentation on it.  Is $.get the right function or should I use
> something else?
>
> Any help would be greatly appreciated.
>
> Thanks,
> pthesis.


[jQuery] Re: scrollto and jumping

2009-03-28 Thread kevinm

Turns out I had something else impacting the click. so put a
preventDefault()  (had the return false already) and that cured it.

On Mar 26, 9:39 am, Ariel Flesler  wrote:
> In case James comment doesn't do for you, please provide a demo.
>
> --
> Ariel Fleslerhttp://flesler.blogspot.com
>
> On Mar 24, 11:27 pm, kevinm  wrote:
>
> > I have a vertical scrolliing area and inside the first area I have an
> >  link that when clicked calls scrollto to scroll the main vertical
> > area.
>
> > What is happening is that the link is jumping to the link, then it
> > scrolls.
>
> > Any thoughts
>
> > Thanks
> > Kevin


[jQuery] retrieving DOM element with specific CSS class

2009-03-28 Thread macsig

Hello guys, I'm trying to make some changes to the coda slider effect
on jqueryfordesigners.com
Basically what I want is changing the buttons every time I move from a
panel to an other one.


I have the code below:


  
FIRST
SECOND
THIRD
  
...


and the link to the current panel have the class 'selected'

Here the question: how can I retrieve the id of the link with the
class 'selected'?

I guess it should be something like:  $('#slider .navigation').find
('a').XXX('selected').id but I don't know how to put in place of XXX.


Thanks


Sig





[jQuery] Re: next and previous links with thumbs on mouseover

2009-03-28 Thread Mike Alsup

> Want to know if it's possible to show thumbs attached prev/next
> anchors when I put the mouse over these navigation links. It would
> work like a preview tooltip for next/prev images.

That's not something that the Cycle plugin will do for you.  However,
you could probably use the before/after callbacks to drive the
appropriate behavior for a tooltip plugin, such as cluetip.


[jQuery] Re: jquery form plugin problem

2009-03-28 Thread Mike Alsup

> I'm trying to use the form plugin from malsup.org to submit a form
> with ajax, but it does not seem to work with options.
>
> This works:
>
>                             $("#loginform").ajaxSubmit(function(obj,
> statusText) {
>                                     alert(obj);
>                             });
>
> This does not work (nothing happens):
>
>                             $("#loginform").ajaxSubmit({
>                                 dataType: "json",
>                                 success: function(obj, statusText) {
>                                     alert(obj);
>                                 }
>                             });
>


Well there must be more to the story than what you're telling us.  The
code you've shown above looks fine.  Perhaps there is a problem with
the json response.



> Oh, and by the way. Is there any way to get access to the request in
> the 'success' function - to obtain status codes, content-type header
> etc.?


No, not in the success function.  But you can use the 'complete'
function to get access to the xhr.

complete: function(xhr, status) {
  ...
}


[jQuery] Re: Thickbox half-works.

2009-03-28 Thread embra

Just read the release notes for JQuery 1.3 as I was having a similar
issue:

"The '@' in [...@attr] has been removed. Deprecated since 1.2 this old
syntax no longer works. Simply remove the @ to upgrade."

The thickbox code on line 78 uses @rel to find all the gallery items
with the same rel tag. If you remove the @ symbol it works with JQuery
1.3.2.

On Mar 27, 12:57 am, Devin  wrote:
> Switching to an older version of jquery fixed the problem right
> away.   Thank you so much!
>
> Resolved.
>
> On Mar 26, 9:44 am, Bert  wrote:
>
>
>
> > Thickbox gives this error with the latest JQuery version. use version
> > 1.2.6, worked for me that way.
>
> > greetzwww.twitter.com/Be_Bert
>
> > On 25 mrt, 15:46, Devin  wrote:
>
> > > This is my code.   The problem I'm having is that when I click the
> > > thumbnail all I see the loading bar.  It just hangs there animated.
> > > Interestingly if I take the rel tag out of the images it works, but it
> > > doesn't show the previous and next options in the thickbox.
>
> > > Suggestions?
>
> > > 
> > > 
> > >   
> > >    > > script>
> > >