Re: [jQuery] jQuery Validation request

2009-11-03 Thread Bart van Uden

Hi Richard,

I also live in the Netherlands and ran into the same problem. I couldn't
find an answer online so i decided to write some addon methods myself.
I added the following two methods to the validator and that did the trick.

$.validator.addMethod(maxNL, function(value, element, param) {
var val = value.replace(,, .);
return this.optional(element) || val = param;
}, jQuery.validator.format(Vul hier een waarde in kleiner dan of gelijk aan
{0}.));

$.validator.addMethod(minNL, function(value, element, param) {
var val = value.replace(,, .);
return this.optional(element) || val = param;
}, jQuery.validator.format(Vul hier een waarde in groter dan of gelijk aan
{0}.));

It doesn't do much more than replace a comma with a period and validate the
new value.
Hope this helps.
Note that this probably doesn't work for numbers greater than 1000 with
formatting (for example, 1.000,00). In that case you have to switch the
period for a comma and the comma for a period.

Greets,
Bart


Richard-330 wrote:
 
 
 Hi,
 
 I was working with validation, but am having problems using the method
 max for maximal numbers. I live in Holland and for us the decimal
 character is a comma, and I can use comma's for validating the max
 value of a field.
 Could someone please make an addon like numberDE for max? So i can
 check comma's.
 
 Thanks!
 
 Richard
 
 

-- 
View this message in context: 
http://old.nabble.com/jQuery-Validation-request-tp25995270s27240p26160052.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Quick question, basic stuff

2009-08-26 Thread Bart

Hi all,

In a HTML document I'm having a few divs with the same class. In each
of this divs is nested an unordered list with inside the list items
some anchors. I'm trying to find a certain jquery expression which
says I want link#3 from div#2. I've tried;

$(div.pic:eq(1) ul li a:eq(2)).hide();

which doesn't seem to work... I think because you can't have :eq()
twice as selector. How would I make this work?


[jQuery] Re: Quick question, basic stuff

2009-08-26 Thread Bart

Thanks! I'll try that, just for my knowledge, any other ways?

On Aug 26, 12:50 pm, Paolo Chiodi chiod...@gmail.com wrote:
 one way could be $('div.pic:eq(1)').find('ul li a:eq(2))

 Paolo



 On Wed, Aug 26, 2009 at 12:17 PM, Bartyourps3playsps1ga...@gmail.com wrote:

  Hi all,

  In a HTML document I'm having a few divs with the same class. In each
  of this divs is nested an unordered list with inside the list items
  some anchors. I'm trying to find a certain jquery expression which
  says I want link#3 from div#2. I've tried;

  $(div.pic:eq(1) ul li a:eq(2)).hide();

  which doesn't seem to work... I think because you can't have :eq()
  twice as selector. How would I make this work?


[jQuery] Scrolling between images in list item

2009-07-20 Thread Bart Schutte

Hi all,

I have a few images and 2 anchors sitting in a list item. In the list
item there's only one picture visible at a time and the 2 anchors are
used to scroll back and forth trough the pictures in such a way that
if the last image is reached the first one displays again and ofcourse
the other way around.

I've tried to figure out a way to achieve this with jQuery but not
with success up til now. Here's what I have so far;

$(li img:not(:first-child)).hide();
$(li a.next).click(function()
{
$(this).hide().next().show();
});

This works at first but when it reaches the last image it starts
trashing my HTML because it's not limited to images only... This seems
rather simple to make, anyone who can help me out?

Appreciated :)


[jQuery] Superfish

2009-05-02 Thread Bart

'Hello, i'm using the Superfish menu just recently. It works almost
like a charm. Exept if i open in other browser then IE it shows
bullets
in front of the menu items. For example open in let's say Firefox;
www.7evenfashion.nl/webshop. Now to see the difference in IE.
I'd like to get rid of these dots.
Is this in the .js or .css and the next question is it in joomla css
or
superfish css if in css.
I'm a noob, no ict background, self learned joomla etc. in 2 month by
reading forums and google. Help would be mutch appreciated.


[jQuery] Re: first child

2009-04-09 Thread bart

Thank you all very much for replying. Mauricio's code worked for me :)

var el = $('#continer *:first').is('h2');
alert(el); // returns true if first child is H2, false otherwise

Again, thanks! :)

On Apr 7, 10:04 pm, Eric Garside gars...@gmail.com wrote:
 I think I understand what you want. Try this:

 $('#content :first-child')[0].tagName.toLowerCase(); // Will return
 a if it's an anchor, div for a div, img for an image tag, etc.

 On Apr 7, 12:37 pm, Mauricio \(Maujor\) Samy Silva

 css.mau...@gmail.com wrote:
   var $el = xx.is('h2'); //if it indeed matches a h2, returns true?

  
  var el = $('#continer *:first').is('h2');
  alert(el); // returns true if first child is H2, false otherwise.

  Maurício


[jQuery] first child

2009-04-07 Thread bart

Hello all,

Let's say I'd have a div#content and I'd like to figure out what the
first child of this div is. It could be an anchor, a paragraph, a
heading who knows... I know the :first-child selector but this doesn't
do what I want to accomplish as it just filters within the matched
selector for the first child.

Ultimately I'd like to figure out what element this first-child is. I
can do this with .is() right?

var $el = xx.is('h2'); //if it indeed matches a h2, returns true?

Anyone willing to help out?


[jQuery] html to text

2009-03-26 Thread bart

I'm pulling html from each td tag which resides in the tablerow of a
table like so;

$('table tr td').each(function()
{
$('div').text($(this).html()).appendTo('#jaheur');
});

For each match it creates a div which holds the HTML in text format. I
noticed that it transformed a line break br / to br (without the
slash) what causes this behavior? Does this only happen with self
closing tags? Can I prevent it all together?


[jQuery] Re: html to text

2009-03-26 Thread bart

I have a HTML document with some hardcoded content in it. This content
needs to be moved to a database so I have jQuery helping me with some
html manipulation left and right to batch some queries. As I want to
insert valid xhtml into the database br won't do. But I understand
that how these self closing tags are handled in browser specific? It
would make more sense to me if the browser would just handle HTML
syntax according to the specified doctype...

On Mar 26, 4:33 pm, Martijn Houtman martijn.hout...@gmail.com wrote:
 On Mar 26, 2009, at 4:19 PM, bart wrote:

  For each match it creates a div which holds the HTML in text format. I
  noticed that it transformed a line break br / to br (without the
  slash) what causes this behavior? Does this only happen with self
  closing tags? Can I prevent it all together?

 I believe XHTML is the only version that enforces a break element to  
 be self-closed. The rest accept (or even define) br, rather than  
 br /. Browsers (luckily?) are very forgiving, so they rewrite br /
   to br internally. That is probably why you get them back like that.

 Exactly why would you want to prevent the browser from rewriting it?

 Regards,
 --
 Martijn.


[jQuery] Re: Fire up on field focus

2009-03-19 Thread bart

Isn't the entire idea behind auto_complete_ that it actually needs
input before it can complete anything for you?

On Mar 19, 10:37 am, Mr.Rech andrea.ricip...@gmail.com wrote:
 Hi,
 on the autocomplete demo-page I've noticed many examples that set
 minChars option to 0, giving the impression that they will fire up
 as soon as each input field gets the focus. However, they don't, and I
 have to type in at least one character to get the autocompletion
 working. Now, since I'd really need to autocomplete fields when they
 get focus, I'm wondering if I can get this in any way. Is autocomplete
 expected to support this feature at any time in the future? If
 autocomplete doesn't support this at all, how can I get a similar
 result?

 TIA,
  Andrea


[jQuery] Unbind by Function Reference

2009-03-19 Thread bart

I've followed Karl Swedberg's article on rebinding events at
learningjquery.com. The theory behind this technique is clear to me
and I've got a working example.

function addItemFinal()
{
var $href = $('table caption a').attr('href');
var $rawmaandjaar = $href.split('');
var $maand = $rawmaandjaar[0].split('=');
var $jaar = $rawmaandjaar[1].split('=');

$.get('includes/inc/ajax/fetchtable.php', { maand: $maand[1], jaar:
$jaar[1] }, function(data)
{
$('div#agendawrapper').html(data);
$('table caption a').unbind('click', addItemFinal).bind('click',
addItemFinal);
});
return false;
}

$('table caption a').bind('click', addItemFinal);

The code in the function is pretty simple, it takes the href attribute
and extracts some variables from it. With the variables it makes a GET
request and in the callback it rebinds again.

However is there more than one anchor in the caption and with the
current code it just takes table caption a whereas this should be
the actual link you clicked. I guess I should pass something to the
function but it's used as a reference so I'm not sure how to achieve
this...

Someone who can help out?


[jQuery] Re: Unbind by Function Reference

2009-03-19 Thread bart

Thank you for your answer. With a search on the jquery site I can't
find the documentation on how to use the function or see an example..
Why is that?

On Mar 19, 3:40 pm, ricardobeat ricardob...@gmail.com wrote:
 Since jQuery 1.3 you can use the live() function, so you don't need to
 rebind the events.

 Just set $('table caption a').live('click', addItemFinal) once in $
 (document).ready() and all anchors added to the doc afterwards that
 match this selector will fire the function on click.

 live() uses what is called 'event 
 delegation':http://www.robertnyman.com/2008/05/04/event-delegation-with-javascript/

 In your code, you could simply use $('table caption a').unbind
 ('click') if there are no other event listeners you want to preserve.

 cheers,
 - ricardo

 On Mar 19, 9:33 am, bart b...@ivwd.nl wrote:

  I've followed Karl Swedberg's article on rebinding events at
  learningjquery.com. The theory behind this technique is clear to me
  and I've got a working example.

  function addItemFinal()
  {
          var $href = $('table caption a').attr('href');
          var $rawmaandjaar = $href.split('');
          var $maand = $rawmaandjaar[0].split('=');
          var $jaar = $rawmaandjaar[1].split('=');

          $.get('includes/inc/ajax/fetchtable.php', { maand: $maand[1], jaar:
  $jaar[1] }, function(data)
          {
                  $('div#agendawrapper').html(data);
                  $('table caption a').unbind('click', 
  addItemFinal).bind('click',
  addItemFinal);
          });
          return false;

  }

  $('table caption a').bind('click', addItemFinal);

  The code in the function is pretty simple, it takes the href attribute
  and extracts some variables from it. With the variables it makes a GET
  request and in the callback it rebinds again.

  However is there more than one anchor in the caption and with the
  current code it just takes table caption a whereas this should be
  the actual link you clicked. I guess I should pass something to the
  function but it's used as a reference so I'm not sure how to achieve
  this...

  Someone who can help out?


[jQuery] [JQueryUI] Sortable, rebind event?

2009-03-17 Thread bart

Hi all,

I have a div which I've set a sortable to, the sortable items in the
div are images.

$(div#pics_new).sortable(
{
axis: 'x',
cursor: 'move',
opacity: 0.7, //0.01 - 1
placeholder: 'newplace',
forcePlaceholderSize: true,
update: SetOrder
});

On document.ready the div is loaded empty and the images are
dynamically being add to it. I experience the sortable __does__ work
this way, but a lot worse than how it would if the images were there
right from the start. Does this too have something to do with
rebinding events? Because the images weren't there on load?


[jQuery] Re: Adding images from one div to another (this is pretty simple..)

2009-03-17 Thread bart

Thanks adelf :) I've got it to work now

On Mar 13, 3:40 pm, adelf adel.f...@gmail.com wrote:
 $(div#images_all a:has(img)).click(function()
 {
  if($(this).data('added')) return false;

  $($(this).html()).appendTo(div#images_select).dblclick( function()
 { $(this).remove(); } );

  $(this).data('added', 1);

  return false;

 });

 I did not test this code, but it should work. Anyway the idea should
 be clear

 On Mar 13, 1:39 am, bart b...@ivwd.nl wrote:

  Hi all,

  I've built something with which you can click an image in one div and
  with the click add it to another. Check an example 
  on;http://www.vliegendepijl.nl/pages/test/pictest.html

  Adding an image from one div to the other works. But as an additional
  feature I'd like to also be able to remove images from the second div,
  the removal should occur on doubleclicking an image. I've tried
  something myself which doesn't work right now... I guess I figure why
  but I'm still not familiar enough with javascript/jQuery to fix it
  myself.

  Also any image can be added as many times as you like just by clicking
  it, what if I'd want a check on that? So that if the image that is
  about to be added already exists in the div it won't be added another
  time..

  Anyone who can help me with this? Thanks :)


[jQuery] Re: [JQueryUI] Sortable, rebind event?

2009-03-17 Thread bart

Sorry, didn't know that. I've placed it over there :)

On Mar 17, 12:46 pm, Richard D. Worth rdwo...@gmail.com wrote:
 You may want to ask over here:

 http://groups.google.com/group/jquery-ui

 - Richard

 On Tue, Mar 17, 2009 at 6:32 AM, bart b...@ivwd.nl wrote:

  Hi all,

  I have a div which I've set a sortable to, the sortable items in the
  div are images.

  $(div#pics_new).sortable(
  {
         axis: 'x',
         cursor: 'move',
         opacity: 0.7, //0.01 - 1
         placeholder: 'newplace',
         forcePlaceholderSize: true,
         update: SetOrder
  });

  On document.ready the div is loaded empty and the images are
  dynamically being add to it. I experience the sortable __does__ work
  this way, but a lot worse than how it would if the images were there
  right from the start. Does this too have something to do with
  rebinding events? Because the images weren't there on load?


[jQuery] Adding images from one div to another (this is pretty simple..)

2009-03-12 Thread bart

Hi all,

I've built something with which you can click an image in one div and
with the click add it to another. Check an example on;
http://www.vliegendepijl.nl/pages/test/pictest.html

Adding an image from one div to the other works. But as an additional
feature I'd like to also be able to remove images from the second div,
the removal should occur on doubleclicking an image. I've tried
something myself which doesn't work right now... I guess I figure why
but I'm still not familiar enough with javascript/jQuery to fix it
myself.

Also any image can be added as many times as you like just by clicking
it, what if I'd want a check on that? So that if the image that is
about to be added already exists in the div it won't be added another
time..

Anyone who can help me with this? Thanks :)


[jQuery] Re: blur(). not working good enough

2009-03-11 Thread bart

Wow. Thank you so much for this explanation, I really appreciate it :)

On Mar 10, 5:35 pm, mkmanning michaell...@gmail.com wrote:
 'el' and 'spn' variables are both so we can cache the jQuery object
 and save having to do the traversal again later in the function; this
 is generally a good practice from a performance perspective. The 'spn'
 variable chains the hide() method to the selector, since the selector
 still returns the jQuery object; this gets us the span element and
 hides it at the same time.

 We then use the find() method on variable 'el' (which is the li
 element) to get the input with a class of '.wtf' and assign it to the
 'edit' variable.

 If this is the first time a user has double-clicked the li, then the
 result of that selector will be an empty jQuery object (which will
 then have a length of 0; the jQuery object is array-like). We check
 for that with a ternary statement, assigning the result to the 'edit'
 variable: if we found the input, then we just assign 'edit' to itself,
 since that's the input, or if we don't find the input we:

 1. create it using $('input') //note the , that tells jQuery to
 create an element
 2. we assign attributes to it with .attr() //in this case the type
 attribute of text
 3. we add the 'wtf' class with .addClass()
 4. we append the element to the 'el' variable (the LI in the DOM),
 using appendTo() //we use appendTo as it allows us to retain the input
 element and continue chaining jQuery methods
 5. we chain the blur() method for handling the onblur event, passing
 an anonymous function to it. As this function is bound to the input we
 created, the keyword 'this' inside the function refers to that input.
 We use the 'spn' variable (the cached SPAN), adding the .text() method
 and passing it the value of the input. As with hiding the span
 originally, we can hide the input and get its text value at the same
 time by wrapping it with $() as $(this).hide().val(). (If we had just
 wanted the value, we could have simply said 'this.value' without
 having to resort to jQuery). We then chain the show() method to the
 'spn' to make it visible again.

 Steps 1-5 above are just to create the input and assign the onblur
 event handler and callback.

 The last part of the dblcick function assigns the text of the SPAN to
 the input's value, calls the show() method (if we just created the
 input it will already be visible when we append it to the LI, so show
 will just be a no-op, doing nothing). In order to ensure that the
 input is focused, we access the actual element with [0], the first
 (and only) element in the jQuery object (remember it's array-like, so
 you can access its members with [n] notation), and then call the focus
 () method on it. Note that the latter is different than the jQuery
 focus() method, which attaches an onfocus() event handler,
 whereas .focus() on the input element itself simply focuses it (same
 for blur())

 Hope that's all clear :)

 On Mar 10, 7:54 am, bart b...@ivwd.nl wrote:

  Thank you both for posting :)

  mkmanning, your code works very well! I'm still somewhat of a noob
  with jQuery syntax, care to explain your code a little more thorough?

  //The children of the matched element -filtered down to the span
  element- get hidden, what does the , spn part do exactly?
  var el = $(this), spn = el.children('span').hide();

  //look for the textfield with the wtf class inside the span
  var edit = el.find('input.wtf');

  //check for edit variable (in other words if a textfield was found in
  the span). If not append one with a type=text attribute to the span
  if the blur event is fired on the textfield, something happens but you
  lost me there
  edit = edit.length0?edit:$('input').attr('type','text').addClass
  ('wtf').appendTo(el).blur(function()
  {
          spn.text($(this).hide().val()).show();

  });

  //??
  edit.val(spn.text()).show()[0].focus();

  On Mar 10, 1:15 am, mkmanning michaell...@gmail.com wrote:

   Typo: last line should be:

   edit.val(spn.text()).show()[0].focus();

   otherwise you'll grab text outside the span.

   On Mar 9, 5:07 pm, mkmanning michaell...@gmail.com wrote:

A couple of notes. Rather than create and then re-create the input and
span with every double-click and constantly reattach the blur event,
you can just create the input once, and then show/hide the span/input.

Here's a suggested refactoring:

//turn all titles into textfields
$('ul li').dblclick(function(){
        var el = $(this), spn = el.children('span').hide();
        var edit = el.find('input.wtf');
        edit = 
edit.length0?edit:$('input').attr('type','text').addClass
('wtf').appendTo(el).blur(function(){
                spn.text($(this).hide().val()).show();
        });
        edit.val(el.text()).show()[0].focus();

});

On Mar 9, 5:00 pm, Hector Virgen djvir...@gmail.com wrote:

 Try focusing the text field right after it is created by calling

[jQuery] Re: blur(). not working good enough

2009-03-10 Thread bart

Thank you both for posting :)

mkmanning, your code works very well! I'm still somewhat of a noob
with jQuery syntax, care to explain your code a little more thorough?

//The children of the matched element -filtered down to the span
element- get hidden, what does the , spn part do exactly?
var el = $(this), spn = el.children('span').hide();

//look for the textfield with the wtf class inside the span
var edit = el.find('input.wtf');

//check for edit variable (in other words if a textfield was found in
the span). If not append one with a type=text attribute to the span
if the blur event is fired on the textfield, something happens but you
lost me there
edit = edit.length0?edit:$('input').attr('type','text').addClass
('wtf').appendTo(el).blur(function()
{
spn.text($(this).hide().val()).show();
});

//??
edit.val(spn.text()).show()[0].focus();

On Mar 10, 1:15 am, mkmanning michaell...@gmail.com wrote:
 Typo: last line should be:

 edit.val(spn.text()).show()[0].focus();

 otherwise you'll grab text outside the span.

 On Mar 9, 5:07 pm, mkmanning michaell...@gmail.com wrote:

  A couple of notes. Rather than create and then re-create the input and
  span with every double-click and constantly reattach the blur event,
  you can just create the input once, and then show/hide the span/input.

  Here's a suggested refactoring:

  //turn all titles into textfields
  $('ul li').dblclick(function(){
          var el = $(this), spn = el.children('span').hide();
          var edit = el.find('input.wtf');
          edit = edit.length0?edit:$('input').attr('type','text').addClass
  ('wtf').appendTo(el).blur(function(){
                  spn.text($(this).hide().val()).show();
          });
          edit.val(el.text()).show()[0].focus();

  });

  On Mar 9, 5:00 pm, Hector Virgen djvir...@gmail.com wrote:

   Try focusing the text field right after it is created by calling focus()
   directly on the element. That's the only way to make sure blur is fired 
   when
   the user clicks somewhere else.

   -Hector

   On Mon, Mar 9, 2009 at 4:18 PM, bart b...@ivwd.nl wrote:

Hi all,

I've set something up which runs at
   http://www.vliegendepijl.nl/pages/test/

As you can see it's an unordered list with some list items in it. If
you doubleclick the list item the text in it is being replaced by a
textfield with the same value in it. This works like it should, no
problems.

Now what I'd like to have is that as soon as the field is not focussed
anymore (blur?) it's should go back to the text in the list item again
only then with the updated info (assuming the textfield value has been
changed). This is the point where it doesn't behave as I'd like it to.

When I doubleclick the first and immediately after that the second
they're both left open, so I guess the blur(). method is not
completely doing the trick. How can I improve my code so that there
can be no more than one textfield open?

Safari 3.2.1 (mac os 10.5) gets it right as it is now, the rest of
browsers I've tested on all work like I've described. (firefox, opera,
camino, chrome, IE)


[jQuery] blur(). not working good enough

2009-03-09 Thread bart

Hi all,

I've set something up which runs at http://www.vliegendepijl.nl/pages/test/

As you can see it's an unordered list with some list items in it. If
you doubleclick the list item the text in it is being replaced by a
textfield with the same value in it. This works like it should, no
problems.

Now what I'd like to have is that as soon as the field is not focussed
anymore (blur?) it's should go back to the text in the list item again
only then with the updated info (assuming the textfield value has been
changed). This is the point where it doesn't behave as I'd like it to.

When I doubleclick the first and immediately after that the second
they're both left open, so I guess the blur(). method is not
completely doing the trick. How can I improve my code so that there
can be no more than one textfield open?

Safari 3.2.1 (mac os 10.5) gets it right as it is now, the rest of
browsers I've tested on all work like I've described. (firefox, opera,
camino, chrome, IE)


[jQuery] Re: $.post() callback

2009-03-07 Thread bart

Thanks for your reply.I reviewed the code and it was a structure
problem, I've set a few things up differently and now it works.
Thanks :)

On Mar 6, 10:01 am, James james.gp@gmail.com wrote:
 I don't see any issues with the code you posted. I suggest try
 removing some code from inside-out to debug. Start by removing the
 AJAX portion. Does it still follow through on the href? If not, it's
 the AJAX. Is so, something else is wrong. Remove the confirm, and
 test. Etc.

 On Mar 6, 2:56 am, bart b...@ivwd.nl wrote:

  Hi all,

  I'm running into some trouble using the jquery $.post function. I'm
  using it in my CMS to delete a page record and after the deletion to
  display the updated page with the just deleted page removed ofcourse.
  Needless to say AJAX comes in handy here because of the page refresh.

  Here's my code;

  $(document).ready(function(){

  $('p.editblock a.del').click(function()
  {
          var table_id = $(this).parent().parent().attr('id').split('_');

          if(confirm(Are you sure?))
          {
                  $.post('includes/inc/ajax/handledelete.php', { table: 
  table_id[0],
  id: table_id[1] }, function(data)
                  {
                          $('#sitewrapper').html(data);
                  });
          }

          return false;

  });
  });

  So the php file handles the delete query with the database and in the
  callback I'm replacing all the #sitewrapper html with the output of
  the php file. This does work, and the page does get displayed properly
  (with the deleted item removed) but after that the code stops working.

  So if I'd want to delete another one it won't function, it doesn't
  even take the false; statement for the link instead of that it just
  follows the location of the href. If I do a refresh in the browser it
  works again but only for once to fall in the old pattern again...

  Anyone who can help me with this?


[jQuery] $.post() callback

2009-03-06 Thread bart

Hi all,

I'm running into some trouble using the jquery $.post function. I'm
using it in my CMS to delete a page record and after the deletion to
display the updated page with the just deleted page removed ofcourse.
Needless to say AJAX comes in handy here because of the page refresh.

Here's my code;

$(document).ready(function(){

$('p.editblock a.del').click(function()
{
var table_id = $(this).parent().parent().attr('id').split('_');

if(confirm(Are you sure?))
{
$.post('includes/inc/ajax/handledelete.php', { table: 
table_id[0],
id: table_id[1] }, function(data)
{
$('#sitewrapper').html(data);
});
}

return false;
});

});

So the php file handles the delete query with the database and in the
callback I'm replacing all the #sitewrapper html with the output of
the php file. This does work, and the page does get displayed properly
(with the deleted item removed) but after that the code stops working.

So if I'd want to delete another one it won't function, it doesn't
even take the false; statement for the link instead of that it just
follows the location of the href. If I do a refresh in the browser it
works again but only for once to fall in the old pattern again...

Anyone who can help me with this?


[jQuery] slideToggle(); odd and even click

2009-02-06 Thread bart

I have a navigation which consists of a few ul's placed within one and
the same parent; a div.

All but the first list item of these unordered lists get hidden and
the first acts as a trigger to either show or hide the underlying
li's. All this happens with a little animation by making use of
slideToggle();

As a little extra I'd like only one list to be open at a time. So if
list1 is open and I click on list3, list1 should close and list3
should open. This is where the toggle get's a little confused because
once you've clicked odd on it, it expects an even click which never
get's triggered because the clicking of any other lists already
triggers the closing.

Anyone a good tut/link/idea how to tackle this?


[jQuery] noob question

2009-01-30 Thread bart

Somehow I don't get the concept of get() right. The following
expression gives an error;

$('p.fl').get(0).css('background', 'red');

Now what I'm trying to do here is select the first paragraph from all
the paragraphs with a class of fl. After that I'm just trying to get
a visual id by making it red but it's more about grabbing the element
really. There's probably a very good reason why this doesn't work but
what I understand from documentation this should work?

This ultimate goal is to hide a paragraph based on it's index. This
index is gotten from a clicked link. So far I've got this, but it's
stuck on the get() part.

$('a.leesmeer').click(function()
{
var nmbr = $('a.leesmeer').index(this);
$('p.fl').get(nmbr).hide();
$('div.case').get(nmbr).show();
return false;
});


[jQuery] Re: [Cycle Plugin]

2009-01-29 Thread bart

Thanks for all your help Mike, it's working now!

Might I suggest that you put this code example on your site where you
actually mention the callbacks? It would've done the trick for me if
it was there when I first read it :) Might be stating the obvious but
it certainly wouldn't hurt people who are not too well known in JS.

Thanks again!


[jQuery] [Cycle Plugin] Callback

2009-01-28 Thread bart

Hi all,

I'm using the cycle plugin for a slideshow I'm building. With the
slideshow comes a counter which shows which image it is that is
currently being viewed, for example 4/11.

I have a manual navigation with the slides so a link 'previous' or
'next' should be clicked to advance through the slideshow. Cycle works
very well with a manual navigation since you can use 'next:' and
'prev:'.

At the moment the problem is that the counter increments after a
'after: callback'. So it doesn't matter whether you click next or
previous the counter always adds up after a transition is complete,
whereas it should distract when the previous link is being clicked.

Is there a way to have the callback function know whether it should
add up or distract?


[jQuery] [Cycle Plugin]

2009-01-28 Thread bart

Hi all,

I'm building a slideshow in HTML and the cycle plugin helps me out
with making it look smooth. My slideshow has manual controls, it has
previous and next anchors to go back and forth the slides. This all
works, no sweat.

However I also have a counter which indicates at which slide you are.
Starts with 1 and with a click of next it should go +1 and with a
click of previous it should go -1. I've set this up with making use of
the after callback, so that a function increments the counter with 1
after the transition is complete, easy enough too.

But what now happens is that +1 occurs every time a slide passes by
whether you go back or forth, it doesn't matter. Whereas this should
be -1 when you click previous and +1 when you click next. Is there a
way to let the function know it should add up or distract?

The documentation says that the before and after callback methods are
passed three arguments:
1. the DOM element for the slide that is being transitioned in (same
as this)
2. the DOM element for the slide that is being transitioned out
3. the options object

my guess is that should help, but it's not too well documented how
this works or what a code example of this would be.

Any thoughts?


[jQuery] Tabindex not working in Firefox on load of page

2009-01-07 Thread Bart

I've written some code to be able to set the tabindex automatically in
our pages.

It looks like this:

$(document).ready(function() {
var el = $(.fieldsetDiv);
if (el.children().length == 0) {
el.remove();
}
//setting tabindex automatically
var totalDivs = 4;
var divNumber = 1;
$('form').each(function() {
$('.fieldsetDiv').each(function() {
var fieldNumber = 0;
$(':input', this).not('input[type=hidden]').each
(function() {
var $input = $(this);
if (fieldNumber == 0) { $input.attr(tabIndex,
divNumber); }
else { $input.attr(tabIndex, divNumber +
(fieldNumber * totalDivs)); }
fieldNumber++;
});
divNumber++;
});
});
});

It works as expected in IE, Safari, and Chrome but not in Firefox. In
Firefox when I load the page the focus is on the field with tabIndex =
1, but if I push on tab the focus does not go to the next field in
the taborder. The focus goes instead to the next field that does not
have a taborder specified.
If I manually put the focus on the first field of the form all works
well.

Did someone else experienced something like this in Firefox?


[jQuery] Re: [ANNOUNCE] Toaster plugin

2008-06-10 Thread Bart Hermans
Can you check it in IE6?
The layout looks a bit weird.
And it doesn't stick to the bottom/top when you scroll, but maybe that's an
IE thing?

Nice plugin, I will definitely use it!

On Tue, Jun 10, 2008 at 07:22, h3 [EMAIL PROTECTED] wrote:


 I've just committed some changes to the trunk:

 http://www.haineault.com/media/examples/jquery-ui-toaster/demo/

 - refactored using $.widget
 - tested/fixed for IE7 (using a virtual machine XP ..)
 - added support for custom effect when user manually hide (hide)
 - added onHide callback
 - added ui-toaster-closable style
 - updated changelog

 and it's smaller :)

 I haven't tested it extensively and I don't think I'll have time to do
 it soon, but I will accept bug reports and try to fix them

 Thanks Andy

 regards

 On Jun 9, 10:01 am, Andy Matthews [EMAIL PROTECTED] wrote:
  I'd be happy to help you test when you're ready. This is nicely done.
 
  -Original Message-
  From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
 
  Behalf Of h3
  Sent: Monday, June 09, 2008 8:42 AM
  To: jQuery (English)
  Subject: [jQuery] Re: [ANNOUNCE] Toaster plugin
 
  I don't even tried it in IE yet.. but I plan to make it 100% compatible
 at
  least for IE 7+ for the 0.1 release
 
  After that I will propose it as an official jQuery plugin (or UI
  plugin) and move the repository/documentation to the right place
 
  Thanks for the feedback
 
  On Jun 9, 9:18 am, Andy Matthews [EMAIL PROTECTED] wrote:
   By the way...
 
   This plugin is REALLY nice when it works. Very well done. Now if you
   can just make sure it works in IE7, I might put this into production.
 
   -Original Message-
   From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED]
   On
 
   Behalf Of h3
   Sent: Sunday, June 08, 2008 10:31 PM
   To: jQuery (English)
   Subject: [jQuery] [ANNOUNCE] Toaster plugin
 
   I've just released a toaster plugin
 
   Project page:http://code.google.com/p/jquery-ui-toaster/
 
   It's inspired by Miksago's experimental toaster plugin that was no
   longer
  maintained:
 http://code.google.com/p/jquery-ui/source/browse/branches/experim
  enta...
   aster.js
 
   Note: It's beta release and it have been tested only on Firefox and
   Konqueror yet, so it's most likely broken under IE and probably work
   fine under Safari.
 
   Feedbacks and comments are more than welcome!



[jQuery] Re: Jquery browse dialog

2008-05-29 Thread Bart Hermans
You can't do that with the file input control.
You'll have to use Java or ActiveX.

On Thu, May 29, 2008 at 12:05 AM, Fred [EMAIL PROTECTED] wrote:


 Hi guys, I have to open a browse dialog window that allows selection
 of multiple files, basically for selection of multiple files to
 upload. Any ideas?
 Thanks.



[jQuery] jQuery Corner problem

2008-05-29 Thread Bart Hermans
I'm trying to use the corner plugin (http://www.malsup.com/jquery/corner) to
create rounded corners on a div.
First I display a div that covers the whole page and has a black,
transparent background.
Then I show another div, white background, centered on the screen.
So it's a kind of popup.
The problem is that when I just use $(...).corner(), nothing happens.
But if I color the corners with $(...).corner(cc:#000), I can see the
corner, but it's black.
Is there something wrong with the following code?

$(#overlay_bg).width($(document).width());
 $(#overlay_bg).height($(document).height());

$(#overlay_fg).width(400);
$(#overlay_fg).center();
$(#overlay_fg).corner();

$(#overlay_bg).show();
$(#overlay_fg).slideDown(slow);

Thanks for checking!


[jQuery] Re: jQuery Corner problem

2008-05-29 Thread Bart Hermans
Hi Mike,

Thanks for your quick reply.
I can see that your example works, but there are some problems with it.

The background div has to be positioned absolute, because it overlays the
actual site beneath it.
If you do that with your example, the foreground div will also be
transparent.

So I used the following html:

body
div id=overlay_bg/div
div id=overlay_fg/div
(rest of the site)
/body

Now, the background is transparent, but the foreground isn't.
And I can't get the corners to work like this.

On Thu, May 29, 2008 at 3:05 PM, malsup [EMAIL PROTECTED] wrote:


  First I display a div that covers the whole page and has a black,
  transparent background.
  Then I show another div, white background, centered on the screen.
  So it's a kind of popup.
  The problem is that when I just use $(...).corner(), nothing happens.
  But if I color the corners with $(...).corner(cc:#000), I can see the
  corner, but it's black.

 Hard to say without seeing the whole page, but a very simple test case
 using your code works fine:

 http://www.malsup.com/jquery/corner/test4.html

 Mike



[jQuery] Re: jQuery Corner problem

2008-05-29 Thread Bart Hermans
Yeah, but then the foreground div is still transparent.
The website will 'shine' through.


On Thu, May 29, 2008 at 4:44 PM, malsup [EMAIL PROTECTED] wrote:


  The background div has to be positioned absolute, because it overlays the
  actual site beneath it.
  If you do that with your example, the foreground div will also be
  transparent.

 I see what you mean now.  With the way your markup is structured there
 is no way for the corner plugin to figure out what the right color is
 for the corners.  It walks the ancestor tree looking for an element
 that has a background color defined.  But you should be able to
 achieve the same look by nesting the divs like this:

 http://www.malsup.com/jquery/corner/test4.html?v2

 Mike



[jQuery] Re: jQuery Corner problem

2008-05-29 Thread Bart Hermans
I've already spent hours trying to get the styles right, so I've kind of
given up. :)
I found another solution (http://www.spiffycorners.com) and that seems to
work correctly.
I will definitely use the corners plugin for other div's on my site but just
not for this one... :)
Mike, thanks a lot for your help!

On Thu, May 29, 2008 at 5:57 PM, malsup [EMAIL PROTECTED] wrote:


  Yeah, but then the foreground div is still transparent.
  The website will 'shine' through.

 Not if you set your styles correctly.



[jQuery] Re: checkbox manipulation and toggle()

2008-05-29 Thread Bart Hermans
Actually, this is a standard implementation in html: use the label tag.

On Thu, May 29, 2008 at 8:16 PM, jquertil [EMAIL PROTECTED] wrote:


 Hello...

 short version: how do I exclude an element in my selector expression?


 long version:

 you know those checkboxes in windows where you can actuyally click the
 label to check the box?

 I'm recreating this with a toggle() like this:

 DIV id=CheckContainerINPUT type=checkbox id=Check/ Click
 here/div


$(#CheckContainer).toggle(
function(){ $('#Check')[0].checked=true;},
function(){ $('#Check')[0].checked=false;}
);

 All fine and dandy as you click the DIV to toggle the checkbox. But
 try to click the checkbox itself and the darn thing won't work.

 I think the solution is in using the right sleector, like some kind
 of :not or !:input or something ???
 Ii DONT want to have to add a span element around the label to assign
 the click to, I'd like to just exclude the checkbox.