[jQuery] Re: Simple .html problem in 1.4

2010-01-19 Thread seasoup
What does the responseText look like?

On Jan 18, 7:58 pm, Bruce MacKay br...@thomasbaine.com wrote:
 Hi folks,

 The following function works fine in jQ1.3, but not in jQ1.4

 function getArchive(pID){
      $.get(scripts/ajax_editor.asp?id=getArcepID=+pID+q= + new
 Date().getTime(),
      function(responseText){
          //console.log(responseText);
          $('#archive').html(responseText).show();
      });
      $('#archiveOn').hide();$('#archiveOff').show(5);

 };

 In both instances, the responseText is returned, but whereas it is
 injected into the div 'archive' and displayed when using jQ1.3, nothing
 happens when 1.4 is used.

 Any idea of where I should be looking for a solution?

 Thanks, Bruce


[jQuery] Shortest possible method of adding/removing class on mouseenter/leave without a plugin

2010-01-13 Thread seasoup
Is this it, or do you have something shorter?

$('#nav  li').each( function () {
var $this = $(this);
$this.bind('mouseenter mouseleave', function()
{ $this.toggleClass('hover') });
});

I thought hover would work, but it only does the mouseenter with one
parameter, instead of doing the same function for both enter and
leave.

$('#nav  li').each( function () {
var $this = $(this);
$this.hover(function() { $this.toggleClass('hover') });   //
only mouseover
});

which could be abstracted to a hoverClass plugin
$('#nav  li').hoverClass('hover');


[jQuery] Re: Shortest possible method of adding/removing class on mouseenter/leave without a plugin

2010-01-13 Thread seasoup
Hey MorningZ,

Yeah, sorry, the .each was in there because I actually have more
code in the $('#nav  li).each(...

CSS :hover doesn't work in ie6, ie7 on li nodes.

Josh Powell

On Jan 13, 11:00 am, MorningZ morni...@gmail.com wrote:
 i don't understand the .each part  jQuery is already going to do
 that

 $('#nav  li').bind('mouseenter mouseleave', function() { $
 (this).toggleClass('hover'); });

 *should* be equiv, although i must say that's untested

 and how about *zero* jQuery code and just using CSS's :hover pseudo?

 http://www.w3schools.com/css/pr_pseudo_hover.asp

 On Jan 13, 1:22 pm, seasoup seas...@gmail.com wrote:

  Is this it, or do you have something shorter?

  $('#nav  li').each( function () {
          var $this = $(this);
          $this.bind('mouseenter mouseleave', function()
  { $this.toggleClass('hover') });

  });

  I thought hover would work, but it only does the mouseenter with one
  parameter, instead of doing the same function for both enter and
  leave.

  $('#nav  li').each( function () {
          var $this = $(this);
          $this.hover(function() { $this.toggleClass('hover') });   //
  only mouseover

  });

  which could be abstracted to a hoverClass plugin
  $('#nav  li').hoverClass('hover');


[jQuery] Re: Having issues with selecthing $(this).find('.classname') with webkit browsers (Chrome/Safari)

2009-12-08 Thread seasoup
lets see the html.

On Dec 7, 12:34 pm, Leonard Teo teo.leon...@gmail.com wrote:
 Hi guys,

 I'm looking for a workaround... I'm having some issues with the
 following code:

         //Navbar hover
         $('.toplevel').hover(
                 function(event){
                         $(this).find('.secondlevelcontainer').fadeIn(500);    
 -- doesn't
 work in Safari/Chrome
                 }, function(event){
                         $(this).find('.secondlevelcontainer').fadeOut(500);   
 -- doesn't
 work in Safari/Chrome
                 }
         );      //navbar hover

 Basically, it doesn't work in Safari and Chrome. Works fine in Firefox
 and Internet Explorer.

 Is there a better way to do the above code that works cross platform?

 Thanks!

 Leonard


[jQuery] Re: Very Strange !!! The same HTML code works well, but append() it not !!!

2009-12-07 Thread seasoup
javascript cant read strings over line breaks.

   $(#tb_video).append(' \
 tr \
 tdinput
 type=checkbox //td \
 td' + d.name + '/td \
 td' + d.len + '/td \
 td' + d.size + '/td \
 tr ');

must be

   $(#tb_video).append('tr'+
 'tdinput type=checkbox 
 //td'+
 'td' + d.name + '/td'+
 'td' + d.len + '/td'+
 'td' + d.size + '/td'+
 'tr ');

On Dec 7, 6:30 pm, Eric Zhong ericiszhongwen...@gmail.com wrote:
 html
 head
     script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/
 jquery.js/script
     SCRIPT LANGUAGE=JavaScript
     !--
         $(function(){
 // /*
                         var html_video = ' \
                             table id=tb_all width=724px \
                                 tr \
                                     td valign=top \
                                         table id=tb_video
 class=tb_width \
                                             tr class=tb_head \
                                                 tdnbsp/td \
                                                 tdfilename/td \
                                                 tdlen(s)/td \
                                                 tdsize(KB)/td \
                                             /tr \
                                         /table \
                                     /td \
                                                                 /tr \
                             /table'

                         $(body).append( html_video );

                         var data =
                         [
                                 {name: 1, len: 432, size: 321},
                                 {name: 2, len: 54543, size: 432},
                                 {name: 3, len: 3243, size: 432},
                                 {name: 4, len: 543, size: 432},
                                 {name: 5, len: 543, size: 654},
                                 {name: 6, len: 654, size: 654},
                                 {name: 7, len: 765, size: 654},
                                 {name: 8, len: 765, size: 765},
                                 {name: 9, len: 53, size: 654}
                         ];

             var a = data;
             if ( a != null ){
                 for(var i=0; ia.length; i++){
                                         var d = a[i];
                     $(#tb_video).append(' \
                                         tr \
                                             tdinput
 type=checkbox //td \
                                             td' + d.name + '/td \
                                             td' + d.len + '/td \
                                             td' + d.size + '/td \
                                         tr ');
                 }
             }

                         $(#tb_video).closest(tr).append(' \
                                     td width=80px align=center
 style=vertical-align:top \
                                                                               
   input id=pl_bt_up type=button value=↑ / \
                                                                               
   input id=pl_bt_down type=button value=↓ /
 \
                                     /td ');
 // */
                 $(#pl_bt_up).click(function() {
                         var $all = $(#tb_video tr);
                 var $trs = $(#tb_video tr:has(input:checked));
                 if( $all.index($trs.get(0)) != 1 ){
                     $trs.each(function(){
                             $(this).prev().before($(this));
                     });
                 }
                 });

                 $(#pl_bt_down).click(function() {
                 var $all = $(#tb_video tr);
                 var $trs = $(#tb_video tr:has(input:checked));

                 if( $all.index( $trs.get($trs.length-1) ) !=
 $all.length-1 ){
                     for( i = $trs.length-1; i=0; i-- ) {
                         var $item = $( $trs.get(i) );
                         $item.insertAfter($item.next());
                     }
                 }
             });
         });
     --

     /SCRIPT
 /head
 body
 !--
     table id=tb_all width=724px
         tr
                         td valign=top
                                 table id=tb_video class=tb_width
                     tr class=tb_head
                         tdnbsp/td
                         tdfilename/td
                         tdlen(s)/td
                         tdsize(KB)/td
                     /tr
                     trtdinput 

[jQuery] Re: jQuery $this question - NEED HELP PLEASE!

2009-12-05 Thread seasoup
Let's step through it
 THE SCRIPT:

         this.vidPopUp = function(){

I take it that we're in an object at this point?


                 $(.vidList li).click(function(){

Give me all of li descendents of DOM nodes with a class of vidList
and add a click event on them

                         var vidLink = $(this).find(.vidMedia)

give me the first DOM node that is a descendent of the li clicked on
that has a class of vidMedia

                         $(body).append(div class='vidPopUp'/div);

Append a div with a class of vidPopUp to the body.  Incidentally, it
will be cleaner if you swap your quotes around:
$('body').append('div class=vidPopUp/div');

                         $(.vidPopUp).append(div class='vidClose')

Give me every DOM node with a class of vidPopUp.  The first time
this is clicked on it will be the div you just appended above, the
second time you click on something it will also append the above div,
and this will return both DOM nodes unless it has been removed by
then.  You're also only appending a part of a node... need a close
tag.


                         
 $(.vidClose).append(/callift/templates/calumet_custom/images/closeBtn.gif 
  + [CLOSE])

You're appending the text of the path to the image on the page, not
the actual image here.  If that is what you meant to do, then you
don't need the  +  it could just be one long string.  And again, you
are pulling up multiple DOM nodes with this.  The last three lines are
better done as one long append.
$('body').append('div class=vidPopUpdiv class=vidClose/callift/
templates/calumet_custom/images/closeBtn.gif [CLOSE]/div/div');


                         $(.vidPopUp).center();
Again, multiple DOM nodes, and you could have cached this and reused
it, $() is an expensive function.
var $vidPopUp = $('.vidPopUp');

                         $('.vidPopUp').expose({                               
           //fade background

Is this a plugin you wrote, or got from somewhere?  I'm not familiar
with it, however, you are selecting every DOM node on the page with a
class of vidPopUp, this will be multiple nodes after the first
click.

                                 api: true,
                                 color:'#000',
                                 opacity:'.8',
                                 closeOnClick:false,
                                 onLoad: function(event){
                                         $(.vidPopUp).fadeIn(400);
again, will select multiple nodes. and fade them all in
                                         $(.vidPopUp).append(vidLink);

selects multiple nodes again, and appends vidLink to all of them

                                                 }
                                         }).load();
                         $(.vidClose).click(function(){

every time an li with a class of vidList is click, you will create a
click event on every node with a class of vidClose.  Should be
using .live('click', ... instead.  Look up the documentation on it,
its very cool.

                                 $(.vidPopUp).fadeOut(400, function(){
                                         $(.vidClose).remove();
                                         });
                                 $(.vidPopUp).expose({}).close(); //unfade 
 bckrnd    
                         });
                 });    
         };

It's not a direct answer to your question, and I don't know without
more investigation what the answer is, but I hope this helped.

Josh Powell


[jQuery] Re: Basic Bind Question

2009-12-04 Thread seasoup
Got two more uses for ya.  Namespacing of events:

// set two click events with different namespaces
$('.button').bind('click.namespace1', function () {

}).bind('click.namespace2', function () {

});

//remove just one of them
$('.button').unbind('click.namespace1', function () {

});

and passing of data:

$('.button').bind('click', {'name': 'value'}, function (e) {
  console.log(e.data.name);  // logs value
});





On Dec 4, 10:41 am, Rey Bango r...@reybango.com wrote:
 Yep Karl's explanation was great. Also, you can leverage bind() to work
 with your own custom events in the case where you want to define
 something that needs to be triggered based on another action. Using the
 code from the docs, you can see what I'm talking about:

 $(p).bind(myCustomEvent, function(e, myName, myValue){
    $(this).text(myName + , hi there!);
    $(span).stop().css(opacity, 1)
                 .text(myName =  + myName)
                 .fadeIn(30).fadeOut(1000);
      });
 $(button).click(function () {
        $(p).trigger(myCustomEvent, [ John ]);
      });

 Rey...

 Charlie Griefer wrote:
  Hi Karl:

  Awesome!  Got it :)

  Thanks for the explanation and examples.

  Charlie

  On Fri, Dec 4, 2009 at 9:01 AM, Karl Swedberg k...@englishrules.com
  mailto:k...@englishrules.com wrote:

      Hey Charlie,

      methods such as .click() and .mouseover() are just convenience
      methods. They all use .bind() internally. One nice thing about
      .bind() is that you can use multiple event types with it. For
      example, instead of doing this:

      $('a')
        .mouseover(function() {
          var $link = $(this);
          // do something with $link
        })
        .mouseout(function() {
          var $link = $(this);
          // do something with $link
        });

      You can combine them and avoid some repetition:

      $('a')
        .bind('mouseover mouseout', function(event) {
          var $link = $(this);
          if (event.type == 'mouseover') {
            // do something with $link on mouseover
          } else {
            // do something with $link on mouseout
          }
        });

      --Karl

      
      Karl Swedberg
     www.englishrules.comhttp://www.englishrules.com
     www.learningjquery.comhttp://www.learningjquery.com

      On Dec 4, 2009, at 11:46 AM, Charlie Griefer wrote:

      Hi All:

      I've read over the docs, but don't quite understand what the
      bind() event provides versus just assigning a particular event
      handler to a selected element (or set of elements).

      For example, consider the code below.  What's the difference
      between the interaction with the p elements of class first,
      and the p elements of class second?  Isn't the second bit
      effectively binding a click event handler to a specific batch of
      p elements just as the first one is?

      Just not grokking it.  Would appreciate if anybody could enlighten me.

      script
      
  src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js;/script

      script type=text/javascript
          $(document).ready(function() {
              $('p.first').bind('click', function() {
                  alert($(this).text());
              });

              $('p.second').click(function() {
                  alert($(this).text());
              });
          });
      /script

      p class=firstA/p
      p class=firstB/p
      p class=firstC/p
      p class=firstD/p
      p class=firstE/p

      hr /

      p class=secondF/p
      p class=secondG/p
      p class=secondH/p
      p class=secondI/p
      p class=secondJ/p

      --
      Charlie Griefer
     http://charlie.griefer.com/

      I have failed as much as I have succeeded. But I love my life. I
      love my wife. And I wish you my kind of success.

  --
  Charlie Griefer
 http://charlie.griefer.com/

  I have failed as much as I have succeeded. But I love my life. I love my
  wife. And I wish you my kind of success.


[jQuery] Re: Problems injecting text into div classes

2009-11-25 Thread seasoup
$('.direction') returns a jQuery object that is similar to an array of
nodes.  $('.direction')[0] returns the first node in the jQuery
object, without any jQuery features... just the basic DOM node.  $
('.direction').eq(0).html  or $('.direction:eq(0)').html are what you
are looking for.  They return the jQuery object instead of the basic
DOM node.  You're also better off using single quotes around the html
string so you do not need to escape the quotes, but that is just a
style issue

$(.direction).eq(1).html('div class=direction_errThe Map cannot
be loaded./div');

On Nov 25, 3:25 pm, shaf shaolinfin...@gmail.com wrote:
 Hi Guys
 I have several div classes and I am trying to insert some html into
 one of them but firebug keeps telling me its not a function. Code
 below:

 div class=direction/div
 div class=direction/div
 div class=direction/div
 div class=direction/div

 $(.direction)[1].html(div class=\direction_err\The Map cannot
 be loaded./div);

 ERROR MSG:
 $(.directions_box)[id].html is not a function


[jQuery] Creating custom attributes in html

2009-04-14 Thread seasoup

I was wondering what jquery developers opinion of adding custom
attributes to html tags is, and what your basis is for these
opinions?  Why is it a good idea, or why is it a bad idea?  What I
mean is this:

div href= myType=foocontent/div

where 'myType' isn't in any specifications.  I've run into developers
who think this is a good idea, and those who think this is a bad idea
and I'd like to get a better sense of both sides of the argument.
Personally, I use them all of the time.  They are a great way to
preserve information for use with .live() in jQuery, among other
things, and since I append a long string to the DOM instead of
creating lots of little DOM nodes, I generally cannot use .data() to
save information on the individual nodes.

Example of a usage:

div name=foo myType=barclick/div
...
$('div[name=foo]').live('click', function () {
   console.log($(this).attr('myType'));
});

Example of why I cannot use .data():

var htmlString = 'table';
for (var a = 0; a  100; a++) {
htmlString += 'trtd name=clickme nodeId=filter'+ a
+'click/td/tr';
}
htmlString += '/table';
$('div[name=foo]').append(htmlString);
$('td[name=clickme]').live('click', function() {
console.log($(this).attr('nodeId'));
});

To debate the merits of using this kind of append, please go to:
http://www.learningjquery.com/2009/03/43439-reasons-to-use-append-correctly

What I'm looking for instead is a discussion of using custom
attributes in html.

Thanks,
Josh Powell


[jQuery] Re: Order Items. Please help me. Thank You.

2009-02-24 Thread seasoup

Hi Miguel, not sure if it will solve your problem, but I find it is
much faster to create a complete html string and then append it
instead of doing lots of appends, which are slow.

//this handles the li content
var li = 
$('li').addClass('Themes').html(t[0].text+'br /'
+friendlyLevels(t[1])+'br /'
+(t[2]==''?'':t[2]+'br /')
+'a href=#Remove class=RemoveRemove/a'
).appendTo(ol);
//now the inputs, this could also be done in 
another loop with an
array of names, if it gets longer; and the brackets in the name are
still a bad idea

$('input').attr({'type':'hidden','name':'Themes['+i
+'].Subject'}).val(t[0].value).appendTo(li);

$('input').attr({'type':'hidden','name':'Themes['+i
+'].LevelCsv'}).val(t[1].join()).appendTo(li);

$('input').attr({'type':'hidden','name':'Themes['+i
+'].Note'}).val(t[2]).appendTo(li);

is faster as

var html = 'li class=Themes + t[0].text + br / + friendlyLevels
(t[1]) + 'br /' +  (t[2]==''?'':t[2]+'br /') + 'a href=#Remove
class=RemoveRemove/a +
'input type=hidden name=Themes[' + i + '].Subject value=' + t
[0].value + ' +
'input type=hidden name=Themes[' + i + '].LevelCsv value=' +
t[1].join() + ' +
'input type=hidden name=Themes[' + i + '].Note value=' + t
[2].value + ';

$(ol).append(html);  // or $(html).appendTo(ol);


On Feb 24, 7:33 am, shapper mdmo...@gmail.com wrote:
 Hi,

 I think I did that ...

 I have this example working with Subjects and FriendlyLevels function
 to add the e correctly:http://www.27lamps.com/Beta/List/List4.html

 Then I tried to do the same but for 
 levels:http://www.27lamps.com/Beta/List/List5.html

 But I keep having errors.

 What am I missing?

 Sorry, but I am just starting with JQuery.

 Thank You,
 Miguel

 On Feb 23, 9:23 pm, mkmanning michaell...@gmail.com wrote:

  That's because you changed levels to an object, which you don't need
  to. Just use the original  var levels = $('input:checkbox:checked'),
  and then
   levels.each(function(){
                    levelsCsv.push({'text':this.value,'value':$
  (this).next().text()})
                  })

  On Feb 23, 9:37 am, shapper mdmo...@gmail.com wrote:

   Hello,

   I tried to make the change:
                   levels.each(function(){
                     
   levelsCsv.push({'text':this.value,'value':$(this).next().text()})
                   })

   But I get an error on Firebug:
   levels.each is not a function

   Am I doing something wrong?

   I also made a change on buildThemesList to use text and also to fix
   the problem on your code that adds e only when there are 3 items. It
   should be also applied when there are 2:

           $.each(themes,function(i,t){
              var li = $('li').addClass('Themes').html(t[0].text+'br /'
              +friendlyLevels(t[1].text)+'br /'
              +(t[2]==''?'':t[2]+'br /')
              +'a href=#Remove class=RemoveRemover/a'
           ).appendTo(ol);

     function friendlyLevels(levels) {
       if (levels.length  2) return levels.join('');
       var first = levels.slice(0, -1), last = levels.slice(-1);
       var friendly = first.join(', ');
       if (last) { friendly += ' e ' + last; }
         return friendly;
     }

   I am not completely sure that I am doing this right because I get the
   error before.

   Thank You,
   Miguel
   On Feb 20, 5:02 pm, mkmanning michaell...@gmail.com wrote:

levels.text = $('input[name=Levels]:checked + label');
levels.value = $('input[name=Levels]:checked');

Those don't get you the right values for the levels object, they both
return a jQuery object.
Accessing the levels object as this.value won't work either.

Try this:

levels.each(function(){
  levelsCsv.push({'text':this.value,'value':$(this).next().text()})

})

On Feb 20, 5:22 am, shapper mdmo...@gmail.com wrote:

 Hi,

 I followed your tips but I still have a few problems.
 The subject is working fine but when I do the same to the levels it
 does not work.

 I think the problem, but I am not sure, is in:
   levels.each(function(){
     levelCsv.push(this.value);//array to hold the levels
   });

 I changed everything else. I updated my 
 example:http://www.27lamps.com/Beta/List/List3.html

 Other problem I notice is that when two levels are added the word e
 is not added between the both.
 Only when 3 levels are added. On my first example I had a function
 that was doing it:http://www.27lamps.com/Beta/List/List.html

 I just don't know how to integrate this on your code.
 I don't need to use my FriendlyLevels example. I just need to have the
 e every time there is more then 1 level.

 How can I 

[jQuery] Re: please support :target

2009-02-24 Thread seasoup

It is possible to write your own selectors. There are a bunch of
tutorials around the web.

here is one:
http://www.coderanch.com/t/121354/HTML-JavaScript/Writing-custom-JQuery-Selectors

and here is another:
http://www.bennadel.com/blog/1457-How-To-Build-A-Custom-jQuery-Selector.htm

Hope they help!

On Feb 24, 6:42 am, dccrowley dccrow...@gmail.com wrote:
 http://www.w3.org/TR/css3-selectors/#target-pseudo

 :target makes it very easy to style a part of a page that has been
 scrolled to. It is not supported by all browsers but the css rules are
 easy to write. I wish something similar would be possible in jquery.

 :target { background: url(fade-yellow.gif) font-weight: bold; }

 MAybe it is possible. I can't find it though.


[jQuery] Re: can jQuery support drawing items on a CANVAS? (e.g. web-based UML tool)

2009-02-19 Thread seasoup

flash is the defacto method, but javascript can increasingly do
anything flash can do.

John Resig ported the processing language to javascript, though it
isn't jQuery.

http://ejohn.org/blog/processingjs/


On Feb 19, 5:11 pm, greghauptmann greg.hauptm...@gmail.com wrote:
 On Feb 20, 11:05 am, mumbojumbo madmediabl...@gmail.com wrote:

  Well,

  IE doesn't support Canvas for IE support you'd have to use iecanvas.js
  or something similar.

 Oh, overall what is the best/easiest approach to support multiple
 browsers including IE then?  Would it be in fact to avoid javascript
 and go to flash or a java applet?  (i.e. as a means to get cross-
 browser support)?


[jQuery] Re: Accessing a JSON property from an unknown variable?

2009-02-14 Thread seasoup

It's not really an associative array.  It is the property of an
object, there are two notations for getting at an objects properties:

foo.bar

and

foo['bar']

though you could even:

eval('foo.' + fooProp);

foo.bar is the preferred method, but if the property name has a space
in it or needs to be evaluated the second method is used.  It looks
like an associative array but it will not have any of the array
methods, nor a .length.  This gets really tricky when foo is an array:

var foo = [];
foo['bar'] = 'value';

has the array methods, but has a length of 0.  but if you

foo[1234] = 'value';

then you have an array of length 1235 and the first 1234 value are
undefined.

Josh Powell


On Feb 13, 4:36 pm, Nic Luciano adaptive...@gmail.com wrote:
 Oh wow, I didn't realize JSON would act like an associative array in that
 way...

 Thanks guys!

 On Fri, Feb 13, 2009 at 7:10 PM, Josh Nathanson 
 joshnathan...@gmail.comwrote:



  foo[fooProp] // returns barVal

  Is that what you mean?

  -- Josh

  -Original Message-
  From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
  Behalf Of Nic
  Sent: Friday, February 13, 2009 4:06 PM
  To: jQuery (English)
  Subject: [jQuery] Accessing a JSON property from an unknown variable?

  For instance,

  var foo = {
  bar: barVal,
  baz: bazVal
  }

  var fooProp = bar;

  How can I access barVal through fooProp?

  I know this isn't exactly jQuery group discussion but I figured since
  it was part of a jQuery system I could get away with it. Thanks!


[jQuery] Re: Order Items. Please help me. Thank You.

2009-02-11 Thread seasoup

You could remove the entire list everytime and regenerate it from
javascript.  Is Themes[0].Subject the actual name, or are you trying
to refer to a javascript object in an array with the attribute
'Subject' which contains the name you are looking for?  If it is the
latter, this won't work.  you'll need to create the html in javascript
and append it into the page.

$('liinput type=hidden name=' + Themes[0].Subject + '
value=A/li').appendTo($('#ThemesList'));

I'm actually not sure if jQuery handles appending a list item to a
list properly.  Probaby does.

On Feb 11, 1:19 pm, shapper mdmo...@gmail.com wrote:
 Hello,

 I am adding and removing a items from a list, using JQuery, which is
 rendered has follows:

 ol id=ThemesList
   li
     input type=hidden name=Themes[0].Subject value=A /
     input type=hidden name=Themes[0].Levels value=L1,L2 /
     input type=hidden name=Themes[0].Description value=Paper /
   /li
   li
     input type=hidden name=Themes[2].Subject value=B /
     input type=hidden name=Themes[2].Levels value=L1,L5 /
   /li
   li
     input type=hidden name=Themes[5].Subject value=D /
     input type=hidden name=Themes[5].Levels value=L2,L4 /
     input type=hidden name=Themes[5].Description value=Book /
   /li
 /ol

 Every time I add or remove a Theme I need to be sure that the list is
 ordered (name) starting with Themes[0].

 So basically I need to loop through each list item in list ThemesList.
 - In first list item all HIDDEN inputs names should start with Themes
 [0]
 - In second list item all HIDDEN inputs names should start with Themes
 [1]
 ...

 So in this example, Themes[2]. ... would become Themes[1]. ... and
 Themes[5]. ... would become Themes[2]. ...

 Could someone please help me out?

 I have no idea how to do this.

 Thanks,
 Miguel


[jQuery] Re: Question related to Javascript

2009-02-09 Thread seasoup

If you are using Prototype and jQuery you will need to do:

var $j =jQuery.noConflict();

otherwise the will be a conflict for the $.  Then, when you wan't to
do things in jQuery, do $j and when you want to do things in
Prototype, do $.

Is   $(imgDisplay0).src = imgs0Slideshow[start].image;  correct?

I believe this is correct for Prototype, and means the source of the
image with an id of imgDisplay0 is set to imgs0Slideshow[start].image

In jQuery, the same line is:

$('#imgDisplay0').attr('src', imgs0Slideshow[start].image);

With jQuery, you cannot access any of the DOM element attributes or
methods directly because they are stored in a jQuery collection that
is returned. Look at the jQuery documentation on the jQuery site, it
is quite extensive and will show you what you need.  If you need help
with Prototype code though, you should try the Prototype google group
instead.

On Feb 8, 11:52 pm, MH1988 m.lawrencehu...@gmail.com wrote:
 Would be great if someone could still help me out?

 On Feb 8, 10:01 pm, MH1988 m.lawrencehu...@gmail.com wrote:

  Sorry, just also to mention, I am integrating this within WordPress
  and I am using the jQuery framework for another gallery.

  On Feb 8, 9:58 pm, MH1988 m.lawrencehu...@gmail.com wrote:

   Thanks so much for the help. I'm afraid it still isn't working
   correctly. I tried [0] which to me means it initiates the very first
   image as soon as it preloads. For more details of how I am using this,
   I am actually using the Prototype script framework which makes this
   image gallery work.

   Is   $(imgDisplay0).src = imgs0Slideshow[start].image;  correct?

   I'm wondering if there is still something missing to make it work?
   Also, it would also be great if you could explain some of the things
   mentioned more simpler as I'm inexperienced.

   Many thanks.

   On Feb 8, 8:11 pm, seasoup seas...@gmail.com wrote:

Also, instead of saying

var imgs0Slideshow = new Array();
imgs0Slideshow[0] = new Object();

It's easier to just say

var imgs0Slideshow = [];
imgs0Slideshow[0] = {};

and that achieves the exact same thing.

On Feb 8, 1:10 am, seasoup seas...@gmail.com wrote:

 $(imgDisplay0_title).innerHTML = title;
 $(imgDisplay0_caption).innerHTML = caption;
 $(imgDisplay0_number).innerHTML = 1 of  + imgs0Slideshow.length +
  Articles;

 should be

 $(imgDisplay0_title).html(title);
 $(imgDisplay0_caption).html(caption);
 $(imgDisplay0_number).html('1 of ' + imgs0Slideshow.length + '
 Articles');

 or

 $(imgDisplay0_title).text(title);
 $(imgDisplay0_caption).text(caption);
 $(imgDisplay0_number).text('1 of ' + imgs0Slideshow.length + '
 Articles');

 or

 $(imgDisplay0_title).get(0).innerHTML = title;
 $(imgDisplay0_caption).get(0).innerHTML = caption;
 $(imgDisplay0_number).get(0).innerHTML = 1 of  +
 imgs0Slideshow.length +  Articles;

  or

 $(imgDisplay0_title)[0].innerHTML = title;
 $(imgDisplay0_caption)[0].innerHTML = caption;
 $(imgDisplay0_number)[0].innerHTML = 1 of  + imgs0Slideshow.length
 +  Articles;

 .html('text'); is the standard jQuery way to do add html, but is
 slower then .text which is the jQuery way to add plain text, which is
 slower then .innerHTML, but not by significant amounts unless you are
 in a big loop.  .html() also handles removing events from DOM Elements
 that are written over this way which prevents circular references that
 can cause memory leaks.  but, if speed is a big factor and you don't
 have any events doing .get(0) or [0] work.

 The problem is that $() returns a jQuery collection not a DOM object
 with the .innerHTML method.  .get(0) or [0] will return the first
 element in the jQuery collection which is the DOM node you are looking
 for with the innerHTML method.

 Hope that helps.

 Josh Powell

 On Feb 7, 10:10 pm, MH1988 m.lawrencehu...@gmail.com wrote:

  I hope I am able to still receive assistance even though this isn't
  jQuery 100% and what I have is an image gallery I am using. The only
  thing I need to work out is how to make sure the initial title and
  captions appear when you load the webpage?

  script type='text/javascript'
  var imgs0Slideshow = new Array();
  var imgs0;
  imgs0Slideshow[0] = new Object();
  imgs0Slideshow[0].image = ;
  imgs0Slideshow[0].title = ;
  imgs0Slideshow[0].caption =  shshshshshsh;
  imgs0Slideshow[1] = new Object();
  imgs0Slideshow[1].image = ;
  imgs0Slideshow[1].title = Array;
  imgs0Slideshow[1].caption =  shshshshs;
  imgs0Slideshow[2] = new Object();
  imgs0Slideshow[2].image = ;
  imgs0Slideshow[2].title = ;
  imgs0Slideshow[2].caption =  shshshsh;
  var start = 0;
  imgs0 = new MudFadeGallery('imgs0', 'imgDisplay0', imgs0Slideshow,
  {startNum: start, preload: true, autoplay: 4

[jQuery] Re: Question related to Javascript

2009-02-08 Thread seasoup

$(imgDisplay0_title).innerHTML = title;
$(imgDisplay0_caption).innerHTML = caption;
$(imgDisplay0_number).innerHTML = 1 of  + imgs0Slideshow.length +
 Articles;

should be

$(imgDisplay0_title).html(title);
$(imgDisplay0_caption).html(caption);
$(imgDisplay0_number).html('1 of ' + imgs0Slideshow.length + '
Articles');

or

$(imgDisplay0_title).text(title);
$(imgDisplay0_caption).text(caption);
$(imgDisplay0_number).text('1 of ' + imgs0Slideshow.length + '
Articles');

or

$(imgDisplay0_title).get(0).innerHTML = title;
$(imgDisplay0_caption).get(0).innerHTML = caption;
$(imgDisplay0_number).get(0).innerHTML = 1 of  +
imgs0Slideshow.length +  Articles;

 or

$(imgDisplay0_title)[0].innerHTML = title;
$(imgDisplay0_caption)[0].innerHTML = caption;
$(imgDisplay0_number)[0].innerHTML = 1 of  + imgs0Slideshow.length
+  Articles;

.html('text'); is the standard jQuery way to do add html, but is
slower then .text which is the jQuery way to add plain text, which is
slower then .innerHTML, but not by significant amounts unless you are
in a big loop.  .html() also handles removing events from DOM Elements
that are written over this way which prevents circular references that
can cause memory leaks.  but, if speed is a big factor and you don't
have any events doing .get(0) or [0] work.

The problem is that $() returns a jQuery collection not a DOM object
with the .innerHTML method.  .get(0) or [0] will return the first
element in the jQuery collection which is the DOM node you are looking
for with the innerHTML method.

Hope that helps.

Josh Powell


On Feb 7, 10:10 pm, MH1988 m.lawrencehu...@gmail.com wrote:
 I hope I am able to still receive assistance even though this isn't
 jQuery 100% and what I have is an image gallery I am using. The only
 thing I need to work out is how to make sure the initial title and
 captions appear when you load the webpage?

 script type='text/javascript'
 var imgs0Slideshow = new Array();
 var imgs0;
 imgs0Slideshow[0] = new Object();
 imgs0Slideshow[0].image = ;
 imgs0Slideshow[0].title = ;
 imgs0Slideshow[0].caption =  shshshshshsh;
 imgs0Slideshow[1] = new Object();
 imgs0Slideshow[1].image = ;
 imgs0Slideshow[1].title = Array;
 imgs0Slideshow[1].caption =  shshshshs;
 imgs0Slideshow[2] = new Object();
 imgs0Slideshow[2].image = ;
 imgs0Slideshow[2].title = ;
 imgs0Slideshow[2].caption =  shshshsh;
 var start = 0;
 imgs0 = new MudFadeGallery('imgs0', 'imgDisplay0', imgs0Slideshow,
 {startNum: start, preload: true, autoplay: 4});

 var title = (imgs0Slideshow[0].title) ? imgs0Slideshow[0].title : No
 Title;
         var caption = (imgs0Slideshow[0].caption) ? imgs0Slideshow
 [0].caption : No caption;
         $(imgDisplay0_title).innerHTML = title;
         $(imgDisplay0_caption).innerHTML = caption;
         $(imgDisplay0_number).innerHTML = 1 of  + imgs0Slideshow.length +
  Articles;
         $(imgDisplay0).src = imgs0Slideshow[start].image;

 /script

 The entire Gallery works correctly but I am not sure if the last part
 of the script is structured correctly. When it is first loaded, the
 first image does appear but without it's title and captions and I want
 to show it.


[jQuery] Re: Question related to Javascript

2009-02-08 Thread seasoup

Also, instead of saying

var imgs0Slideshow = new Array();
imgs0Slideshow[0] = new Object();

It's easier to just say

var imgs0Slideshow = [];
imgs0Slideshow[0] = {};

and that achieves the exact same thing.

On Feb 8, 1:10 am, seasoup seas...@gmail.com wrote:
 $(imgDisplay0_title).innerHTML = title;
 $(imgDisplay0_caption).innerHTML = caption;
 $(imgDisplay0_number).innerHTML = 1 of  + imgs0Slideshow.length +
  Articles;

 should be

 $(imgDisplay0_title).html(title);
 $(imgDisplay0_caption).html(caption);
 $(imgDisplay0_number).html('1 of ' + imgs0Slideshow.length + '
 Articles');

 or

 $(imgDisplay0_title).text(title);
 $(imgDisplay0_caption).text(caption);
 $(imgDisplay0_number).text('1 of ' + imgs0Slideshow.length + '
 Articles');

 or

 $(imgDisplay0_title).get(0).innerHTML = title;
 $(imgDisplay0_caption).get(0).innerHTML = caption;
 $(imgDisplay0_number).get(0).innerHTML = 1 of  +
 imgs0Slideshow.length +  Articles;

  or

 $(imgDisplay0_title)[0].innerHTML = title;
 $(imgDisplay0_caption)[0].innerHTML = caption;
 $(imgDisplay0_number)[0].innerHTML = 1 of  + imgs0Slideshow.length
 +  Articles;

 .html('text'); is the standard jQuery way to do add html, but is
 slower then .text which is the jQuery way to add plain text, which is
 slower then .innerHTML, but not by significant amounts unless you are
 in a big loop.  .html() also handles removing events from DOM Elements
 that are written over this way which prevents circular references that
 can cause memory leaks.  but, if speed is a big factor and you don't
 have any events doing .get(0) or [0] work.

 The problem is that $() returns a jQuery collection not a DOM object
 with the .innerHTML method.  .get(0) or [0] will return the first
 element in the jQuery collection which is the DOM node you are looking
 for with the innerHTML method.

 Hope that helps.

 Josh Powell

 On Feb 7, 10:10 pm, MH1988 m.lawrencehu...@gmail.com wrote:

  I hope I am able to still receive assistance even though this isn't
  jQuery 100% and what I have is an image gallery I am using. The only
  thing I need to work out is how to make sure the initial title and
  captions appear when you load the webpage?

  script type='text/javascript'
  var imgs0Slideshow = new Array();
  var imgs0;
  imgs0Slideshow[0] = new Object();
  imgs0Slideshow[0].image = ;
  imgs0Slideshow[0].title = ;
  imgs0Slideshow[0].caption =  shshshshshsh;
  imgs0Slideshow[1] = new Object();
  imgs0Slideshow[1].image = ;
  imgs0Slideshow[1].title = Array;
  imgs0Slideshow[1].caption =  shshshshs;
  imgs0Slideshow[2] = new Object();
  imgs0Slideshow[2].image = ;
  imgs0Slideshow[2].title = ;
  imgs0Slideshow[2].caption =  shshshsh;
  var start = 0;
  imgs0 = new MudFadeGallery('imgs0', 'imgDisplay0', imgs0Slideshow,
  {startNum: start, preload: true, autoplay: 4});

  var title = (imgs0Slideshow[0].title) ? imgs0Slideshow[0].title : No
  Title;
          var caption = (imgs0Slideshow[0].caption) ? imgs0Slideshow
  [0].caption : No caption;
          $(imgDisplay0_title).innerHTML = title;
          $(imgDisplay0_caption).innerHTML = caption;
          $(imgDisplay0_number).innerHTML = 1 of  + imgs0Slideshow.length 
  +
   Articles;
          $(imgDisplay0).src = imgs0Slideshow[start].image;

  /script

  The entire Gallery works correctly but I am not sure if the last part
  of the script is structured correctly. When it is first loaded, the
  first image does appear but without it's title and captions and I want
  to show it.


[jQuery] Re: Using selectors successfully...?

2009-02-08 Thread seasoup

In firefox, to see the changed html markup click on the page and do
ctrl-A to select all and then right click and View Selection
Source.  This also work if you just highlight the element you want to
see the source of.

On Feb 7, 10:05 pm, brian bally.z...@gmail.com wrote:
 On Sun, Feb 8, 2009 at 12:37 AM, gberz3 gbe...@gmail.com wrote:

  I'm just glad it only took 2 hours, and not 2 weeks.  I always tend to
  think outside the box.  Unfortunately, I often find myself inside
  another box just beside the original box.  Are there any sorts of
  explicit documentation that warns against gotchas of this nature?
  Thanks for the hand-holding all.  You guys rock!

 I think of it less as hand-holding as ants mutually forming a bridge.

 Wait -- all the ants make it across in the end, right?!


[jQuery] Re: 'JQuery' tag is not working at all

2009-02-01 Thread seasoup

it should be jQuery

little 'j', capital 'Q', little 'uery

Don't you just hate those typos?

On Feb 1, 12:53 am, Bluesapphire michealg...@gmail.com wrote:
 Hi!
    This is continuation of my previous message. I also get following
 error in FireBug.

 JQuery(document).ready(function(){

 JQuery is not definedhttp://localhost/main/vibersol/shipping/admin/country.php
 Line 132

 Thanks

 On Feb 1, 1:32 pm, Bluesapphire michealg...@gmail.com wrote:

  Hi!
      Iam using JQuery 1.3. $ tag is working fine. But when I try to
  use jquery plugin'jqGrid'. It gives error. As I think, this plugin is
  using 'JQuery' and my system is not recognising  this tag [JQuery].
  Following is the error, generated by Firebug.

  jQuery(modwin).jqDrag is not a 
  functionhttp://localhost/main/vibersol/shipping/main/js/jqGrid/grid.common.js
  Line 66

  Can some one guide me, how to solve this problem.

  NOTE:  Iam running default example of JQGRID.

  Thanks in advance


[jQuery] Re: Making Web Game- Need Hitpoint XP histogram/line graph

2009-01-31 Thread seasoup

flot

http://code.google.com/p/flot/



On Jan 31, 7:06 am, TrixJo tri...@gmail.com wrote:
 Hi there, I have been using Yahoo UI for the past couple of years and
 finally jumped ship and have come over to JQuery mainly because of all
 of the amazing things I am seeing!

 I am making a simple web game.  Users can level their avatars and
 engage in combat.

 Therefore, I require a horizontal histogram for the player's health
 meter and XP meter.

 Stats are stored in mySQL (LAMP)

 I have googled for a number of plugins and haven't been able to find a
 simple one that allows for horizontal line bars for the situation I
 require.

 Anyone know of any?

 thanks


[jQuery] Array Plugin

2009-01-28 Thread seasoup

Does anyone know of a plugin that duplicates Prototypes array
methods.  The closest I've found is the Rich Array Plugin.

http://plugins.jquery.com/project/rich-array

Any others?


[jQuery] Re: jquery not working at all after upgrade to 1.3.1

2009-01-23 Thread seasoup

Well, one issue might be that you are using onload in the body tag why
not use the jQuery ready function that you are already using above?

$(document).ready(function(){
  $('#gid3').flexigrid();
  DynarchMenu.setup('hmenu_01',{
context: true,
electric: 500,
tooltips: true
  });
  FormUtil.focusOnFirst('ttr01_con0');
  DynarchMenu.setup('hmenu_02',{
electric: true
  });
  FormUtil.focusOnFirst(document)
});

Same with the unload in the body tag.

$(document).unload(function(){
  $('#gid3').flexDestroy();
}
On Jan 23, 9:04 am, Jay leffu...@hotmail.com wrote:
 Unfortunately, no, classified type site.  Here is code though with
 details removed that may be problematic. There are 2 function using
 jquery, flexigrid, and a function I wrote called flexDestroy.

 This is the same error I get when I was building the app and the id,
 gid3 in this case, did not exist on the page.  It does exist, but is
 hidden. I tried unhiding it and it didnt change anything. I can toggle
 between 1.2.6 and 1.3.1 and watch as it works, then doesn't work.

 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
 htmlheadtitle/titlescript type=text/javascript
 language=JavaScript
 function columnMove(order,scope){
             var params = ;
             if(scope != null)
             {
               params += page_scope= + scope;
             }
             $.ajax({
             type: GET,
             url: ,
             data: params
             });
           };;
 /script
 /scriptscript type=text/javascript language=JavaScript$
 (document).ready(function(){$('#gid3').flexigrid();});

 /script
 /headbody onload=DynarchMenu.setup('hmenu_01',{ context: true,
 electric: 500, tooltips: true });FormUtil.focusOnFirst
 ('ttr01_con0');DynarchMenu.setup('hmenu_02',{ electric:
 true });FormUtil.focusOnFirst(document) onunload=$
 ('#gid3').flexDestroy();

 /body/html

 On Jan 23, 11:35 am, Mike Alsup mal...@gmail.com wrote:

   I have various jquery apps.  In 1.3.1 I get the error $
   ('#id3').functionName is not a function.

   I switch to 1.2.6 and everything works fine.  Anyone else running into
   this?

  Can you please post a link that demonstrates the problem you're having?


[jQuery] Re: Looping JSON Data

2009-01-21 Thread seasoup

or...

$.each(theList.list,function (a,b) {
  alert (b.id + ',' + b.name);
})


On Jan 21, 7:30 pm, Ami aminad...@gmail.com wrote:
 I think that this what R U searching for:

 var theList={list:[
 {id:15,name:Testing,description:test,owner:1,active:1,featured:0,machinename:testing},
 {id:16,name:Testing,description:test,owner:1,active:1,featured:0,machinename:testing},
 {id:17,name:Testing,description:test,owner:1,active:1,featured:0,machinename:testing}
 ]};

 theList=theList['list'];
 $.each(theList,function (a,b,c)
 {
 alert (b.id + ',' + b.name);

 })

 On Jan 22, 4:46 am, blockedmind blockedm...@gmail.com wrote:

  I have data recieved by ajax function of jquery like:
  {list:[
  {id:17,name:Testing,description:test,owner:1,active:1,featured:0,machinename:testing},
  {id:16,name:Another
  List,description:Another,owner:1,active:1,featured:0,machinename:another-
  list},
  {id:15,name:Listenin
  Adı,description:Yeah.,owner:1,active:1,featured:0,machinename:listenin-
  adi},
  ]};

  how can i print each list in a loop? i tried many variations,
  couldn't get the result.


[jQuery] .live help needed

2009-01-16 Thread seasoup

I'm playing around with the new .live functionality.  it seems very
cool.

I have a page that gets refreshed with ajax with a .live getting set
for a list of links every time, so I need to call .die but .dies
doesn't seem to be working...

$('a[name=prioritya]').die('click', currFxn);
$('a[name=prioritya]').live('click', currFxn);

I don't think it matters what currFxn does, but it is a defined
function.  Any idea why .die isn't working?

Secondly, if I call $('a[name=prioritya]').die('click'); does that
remove all live 'click' events from the page, or just those registered
to a[name=prioritya]?

Thanks,
Josh Powell


[jQuery] Re: Passing vars to function

2009-01-12 Thread seasoup

untested, but the point is you can pass an object as the second
parameter of the .bind() function.  Doesn't work with the shortcuts as
far as I know.  Then, you can access those object in the event.data
property of the event passed into the function.

$(#artigos_listagem li).mouseover(function(e){
var orgBg = $(this).css('background');
$(this).css({
background: #aa
});
});
$(#artigos_listagem li).bind('mouseout', { 'orgBg' :
orgBg}, function(e){
$(this).css({
background: e.data.orgBg
});
});

I'm also not quite sure what you are attempting... it looks like those
li are getting a mouseover/mouseout  function that sets the background
to one color when rolling over and to another when rolling off.  If
that is the case:

$(#artigos_listagem li).toggle(function() {
  $(this).css({'background':'#aa'});
},
function() {
  $(this).css({'background':'#aa'});
})

If the colors aren't known beforehand, since you are setting it
dynamically on li's with different background colors then you could
save the current background color as a custom attribute using .attr()
or as data on the object using .data()

http://docs.jquery.com/Internals/jQuery.data


[jQuery] Equivalent of the Prototype Create.Class()

2009-01-06 Thread seasoup

I'm converting some Prototype javascript and have almost completed it,
but am running into an issue with the Class.Create() Prototype method.

In prototype:

var DatePicker = {};
DatePicker = Class.create();
DatePicker.prototype = {
  initialize:function(triggerElement, formElement) { ...

allows the above to be called like this:

var myPicker = new DatePicker($('aDate'),$('testDate'));

Is there a way in jQuery to either simulate the above or do what it
intends, which is to have multiple DatePickers on the same page?

Thanks!


[jQuery] Re: Using jQuery.noConflict() with Prototype/Scriptaculous

2009-01-06 Thread seasoup

noConflict was designed specifically with prototype in mind :)

The easiest way to do both jQuery and proto is to do:

var $j = jQuery.noConflict();

and use $j instead of $ for jQuery.

$j('#id'), for example.

On Jan 6, 10:23 pm, Magnificent
imightbewrongbutidontthin...@gmail.com wrote:
 Hi Erik, thanks for the reply.  I've been messing with things and I
 tried replacing my calls to local versions of prototype/scriptaculous
 to use google:

 script src=http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/
 prototype.js type=text/javascript/script
 script src=http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.2/
 scriptaculous.js type=text/javascript/script

 And it seems to be working now.  Does anyone know if there's a known
 issue using jquery's noConflict() with prototype/scriptaculous?  I'm
 wondering if the (older) local version I was using was the culprit.
 It looks like it.


[jQuery] Re: Equivalent of the Prototype Create.Class()

2009-01-06 Thread seasoup

Well, found it. FWIW...

lowpro has a jquery plugin $.kreate() that ports Prototype Class.Create
().

On Jan 6, 7:12 pm, seasoup seas...@gmail.com wrote:
 I'm converting some Prototype javascript and have almost completed it,
 but am running into an issue with the Class.Create() Prototype method.

 In prototype:

 var DatePicker = {};
 DatePicker = Class.create();
 DatePicker.prototype = {
   initialize:function(triggerElement, formElement) { ...

 allows the above to be called like this:

 var myPicker = new DatePicker($('aDate'),$('testDate'));

 Is there a way in jQuery to either simulate the above or do what it
 intends, which is to have multiple DatePickers on the same page?

 Thanks!


[jQuery] Re: Image rollover using jQuery

2008-11-30 Thread seasoup

plugin?  How about the native .hover?

$('img').hover(function() {
  $(this).attr('src',path + '' + $('this).attr('id') + '_over.gif';
},
function() {
  $(this).attr('src',path + '' + $('this).attr('id') + '_off.gif';
});

That will make every image on the page a rollover, changing the src of
the image to the id + _over.gif or _off.gif of the image in
whatever directory you have defined path to be.  Instead of using the
ID you could look at the src of the image and add '_over just in front
of the .gif and take it out for the other hover.  However you want to
do it.  Then change the selector to be whatever group of images you
want to have rollovers.  Maybe $('img.rollover') which would be all
images with the class rollover.


On Nov 30, 1:14 am, Ray M [EMAIL PROTECTED] wrote:
 Hello,

 Are there any existing jQuery plugin which can provide similar image
 rollover functions such as the one provided by Dreamweaver?

 Thanks.

 Ray


[jQuery] Re: Double right-click, anyone?

2008-11-30 Thread seasoup

I'd also like to chime in that double-right click is probably not very
good UI design.  No one expects to have to double right click
something and people will probably be even more pissed that the
context menu is gone.  People like that thing.  Why do you seek to
disable it?  I'm curious.

On Nov 30, 6:40 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote:
 Have you ever tried capturing the right-click event in Opera?

 It has an additional level of security whereby each client must expressly
 set the user preferences allowing a website to capture the right-click event
 and stop the right-click bubble.

 The project I worked on last year had a right-click requirement which would
 not play well with Opera.

 There is a user-friendly aspect of this too, as some users don't WANT their
 browser-specific context menus to be taken away.

 This is why I recommended the CTRL-Click.

 As regards the Mac, I haven't tested that.  Are you sure a Mac option-click
 is interpreted as button 2?

 JK

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On

 Behalf Of ricardobeat
 Sent: Sunday, November 30, 2008 6:31 PM
 To: jQuery (English)
 Subject: [jQuery] Re: Double right-click, anyone?

 returning false from the handler should cancel the context menu on
 Opera and other browsers. And apparently on Macs the event for a Ctrl
 +click carries the 'right-click' identifier (e.button = 2).

 cheers,
 - ricardo

 On Nov 30, 4:07 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote:
  If I might make a suggestion.

  Right-click context menus are inherently not cross-platform compatible, as
  Opera will not cancel the default right click popup.

  Any any Mac users without a right mouse button are screwed.

  I personally suggest using CTRL-Click.  This works on a Mac testing for
 the
  e.MetaKey property on the click event (CTRL-Click and Option-Click)

  And instead of a double-right-click, you could just bind to the standard
  dblclick event, and test for e.MetaKey==true.

  JK

  -Original Message-
  From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On

  Behalf Of ricardobeat
  Sent: Sunday, November 30, 2008 9:24 AM
  To: jQuery (English)
  Subject: [jQuery] Re: Double right-click, anyone?

  I didn't test it in IE... no cookie.

  Apparently the 'mousedown' event was at random not carrying the
  property that tells us what button was clicked, a triple click was
  needed. I switched to mouseup and it seems to work fine, I also had
  forgotten to clear the timeout and set the var to false when the
  double click happened. Check out the new version:

 http://jsbin.com/iyegu/

  cheers,
  - ricardo

  On Nov 30, 8:32 am, TheBlueSky [EMAIL PROTECTED] wrote:
   I forgot to mention also that I disabled the context menu with the
   code
   $('html').bind(contextmenu, function(e) {return false;});

   and if I didn't do that, the context menu will appear and every right-
   click then will fire the double-click event in IE. I guess that's
   because in IE the double-click event won't fire until the time out
   duration finishes and in FF it's the opposite, i.e. the event won't
   fire after the time out duration!

   On Nov 30, 2:10 pm, TheBlueSky [EMAIL PROTECTED] wrote:

Thanks for the code... but I couldn't manage to make it work at all in
IE and in FF the only time it worked is if I replaced $('body') with $
('html)! Any idea how to make it work with a specific element; e.g.
and image with id=myImage, because when I tried $('#myImage') it
didn't work as well.

By the way, for IE I replaced console.log() with alert(), but no
success.

On Nov 29, 10:58 pm, ricardobeat [EMAIL PROTECTED] wrote:

 A quick implementation:

 $('body').unbind('mousedown').mousedown(function(e){
var rightclick = (e.which)
? (e.which == 3)
: (e.button == 2);
var t = $(this);
if (rightclick) {
console.log('rightclick');
if (t.data('rightclicked')) {
   console.log('double click!');
} else {
t.data('rightclicked',true);
setTimeout((function(t){ return function(){ t.data
 ('rightclicked',false); } })(t), 300);
};
};

 });

 - ricardo

 On Nov 29, 10:20 am, TheBlueSky [EMAIL PROTECTED] wrote:

  Hi everyone,
  Does anyone has code, implementation, plug-in or whatever to
 detect
  double right-click? I'm searching and trying for couple of days
 now
  without any result.
  Appreciate any help.- Hide quoted text -

 - Show quoted text -- Hide quoted text -

- Show quoted text -


[jQuery] Re: avoid inserting twice

2008-11-29 Thread seasoup

or you can test inside the bind function:

if ($('#header').next().('attr','id') != new) {
  $('#header').after('div id=newtester/div');
}

On Nov 29, 7:34 am, Dave Methvin [EMAIL PROTECTED] wrote:
 Do you only want the button to work once? If that is the case, use .one
 () instead of .bind().


[jQuery] Re: Draggable() doesn't work with table rows?

2008-11-28 Thread seasoup

That's different.  The tr/tr doesn't need to leave the table, if
you could make a tr draggable, you'd have to drop it in another table
at the least

On Nov 27, 9:43 pm, René [EMAIL PROTECTED] wrote:
 Actually, sortable() lets you drag rows between tables, so I don't
 think it's impossible.

 On Nov 27, 4:34 pm, seasoup [EMAIL PROTECTED] wrote:

  I don't think you can drag table rows... it would remove them from the
  table...

  On Nov 27, 3:11 pm, René [EMAIL PROTECTED] wrote:

   I can drag and sort lists.
   I can sort tables.
   I can drag entire tables.

   But I can't drag individual table rows. Anyone know how to do it?
   Here's some sandbox code:

   ul id=list
   li id=a_1 class=drag1The/li
   li id=a_2 class=drag1slow/li
   li id=a_3 class=drag1green/li
   li id=a_4 class=drag1turtle/li
   /ul

   table id=table
   tbody id=rows
   tr id=a_1 class=drag2tdThe/td/tr
   tr id=a_2 class=drag2tdquick/td/tr
   tr id=a_3 class=drag2tdbrown/td/tr
   tr id=a_4 class=drag2tdfox/td/tr
   /tbody
   /table

   script type=text/javascript src=http://ajax.googleapis.com/ajax/
   libs/jquery/1.2.6/jquery.min.js/script
   script type=text/javascript src=http://ajax.googleapis.com/ajax/
   libs/jqueryui/1.5.2/jquery-ui.min.js/script
   script type=text/javascript

   $(document).ready(function() {
   $('.drag1').draggable();// WORKS
   //  $('#list').sortable();  // WORKS
   //  $('#rows').sortable();  // WORKS
   //  $('#table').draggable();// WORKS
   //  $('#rows').draggable(); // DOESN'T WORK  -- ?
   $('.drag2').draggable();// DOESN'T WORK  -- ?
   //  $('#a_1').draggable();  // DOESN'T WORK  -- ?
   });

   /script


[jQuery] quote standards

2008-11-28 Thread seasoup

I've started using a single quote inside of all $() when quotes are
needed because it makes creating DOM elements much simpler. $('a
href=/path/a') or $('div id=anId/div and for consistency
doing $('#anId').   Anyone else doing the same thing?

Josh Powell


[jQuery] Re: button is null

2008-11-28 Thread seasoup

show us the code that generates the error.

On Nov 28, 1:53 pm, sergiomedinag [EMAIL PROTECTED] wrote:
 Hi!

 I've just made a jQuery plugin that validates a form and shows a
 tooltip to see the strings accepted for the field. Everything works
 fine, except when I switch tabs in firefox+firebug I get an error
 saying that button is null. It only shows that error when I use the
 tooltip (When I comment the line where I attach the tooltip the error
 is gone) . I guess that is some sort of events handling issues. Have
 you ever get that error?

 Thanks.


[jQuery] Re: Error while printing the JSON content after evaluating!!!!

2008-11-28 Thread seasoup

Heya, happy to help.  I have a few questions though.

1) Can/do you use firebug and console.log, it provides more
information.

2) How come you are putting parenthesis around req.responseText?

3) Can you show us the req.responseText?

Thanks,
Josh Powell

On Nov 28, 5:31 pm, aarti [EMAIL PROTECTED] wrote:
 Hi,

 I am getting error while trying to print the content of json string.
 My servlet is getting evaluated as it is alerting the next statement
 immediately after eval line in the code.

 0] alert(req.responseText);
 1] doc_json = eval('('+ req.responseText+')');
 2] alert(eval successful);
 3] alert(doc_json.feed.channels[0].name);

 It gives me alert upto 2] line as eval successful. Immediately after
 that I am getting error as doc_json undefined.
 I tested my json string, it is fine too.
 Can anybody please tell me what could be the problem?

 Thanks.


[jQuery] Re: error option for jQuery.ajax

2008-11-27 Thread seasoup

Your getting an error in that code because you need a comma after the
success:function(){},

Also, make sure there is no comma after the last method in the object
or IE throws an error.

Josh Powell

On Nov 26, 11:51 pm, WebAppDeveloper [EMAIL PROTECTED] wrote:
 Hi,

 I have the following code below where I'm trying to dynamically check if an
 AJAX request error occurs. If an error occurs, do something; otherwise, do
 something else (if it's a success). But according to jQuery.com, they say
 You can never have both an error and a success callback with a request.
 And that's why I'm getting an error when running the code below. Is there a
 way to solve this?

 $(document).ready(function() {
 $.ajax({
type: GET,
url: SomeProcessPage.cfm,
data: FirstName=JerryLastName=Young,
success: function(data) {
 $(data).appendTo(#myDivId);
}
error: function(XMLHttpRequest, textStatus, errorThrown){
  $(#msg).ajaxError(function(event, request, settings){
$(this).append(liError requesting page  + settings.url + 
 /li);
  });
}
   });});

 --
 View this message in 
 context:http://www.nabble.com/error-option-for-jQuery.ajax-tp20711274s27240p2...
 Sent from the jQuery General Discussion mailing list archive at Nabble.com.


[jQuery] Re: Disable/Enable jQuery Added Events

2008-11-27 Thread seasoup

use .data to store a boolean variable on the DOM element, then in the
click function check that variable to see if it is enabled or not.

Josh Powell

On Nov 27, 12:46 am, Neil Craig [EMAIL PROTECTED] wrote:
 Something I would like to do is to add several events handlers to an
 element and control the firing by enabling  disabling it. For
 example:

 jQuery(.sample).click(function() { // do something }).disable();

 Clicking should not fire the event until jQuery(.sample).enable()
 has been called.

 Have anyone done something similar?


[jQuery] Re: How to pass loop increment to Jquery

2008-11-27 Thread seasoup

jQuery automatically iterates through jQuery collections for you:

$(function(){
$(.show).hover(function(){
$(.show_details).hide(slow);
},
function(){
$(.show_details).show(slow);
})

});

That code will iterate through all DOM objects with a class of 'show'
and hide/show all objects with a class of 'show_details'.  To get
fancy

Josh Powell

On Nov 27, 1:36 pm, Sai Krishna [EMAIL PROTECTED] wrote:
 I dont know where am I doing mistake here. Could somebody point out?

 $(document).ready(function(){
 $(.show).hover.each( function(){
 $(.show_details).hide(slow);
 },
 function(){
 $(.show_details).show(slow);
 })

 });

 On Nov 28, 1:10 am, Sai Krishna [EMAIL PROTECTED] wrote:

  thank you Ill try that

  On Nov 28, 12:36 am, ajpiano [EMAIL PROTECTED] wrote:

   you'd have to tweak that i kind of missed your structure slightly, but
   the idea is to just use a class and let jquery handle the iterating...
   --adam

   On Nov 27, 2:35 pm, ajpiano [EMAIL PROTECTED] wrote:

you can use jquery's .each() which is passed the loop index but to be
honest the best thing to do is to use a class and replace al that code
with

$(.show_details)
.hover(function() {
$(this).show(slow);},function() {

$(this).hide(slow);

});

--adam

On Nov 27, 2:20 pm, Sai Krishna [EMAIL PROTECTED] wrote:

 Hi,
 I've my PHP code generating  rows using certain loop conditons, And
 I'd like to show/hide a div overlay on mouseover and mouseout of a
 text link generated in each row respectively.  I wrote the following
 code. this seems to be show div overlay of last row. That is because I
 wrote the function in document.ready. I dont think Jquery lets us put
 javascript in HTML code, So how can I make my code work  in such a
 case?

 $(document).ready(function(){
 var i= $(#count).val();
 for(j=0;ji;j++){
 var k = #show_details+j;
 var refer = #show +j;
 $(k).hide();

 $(refer).mouseover(function(){
 $(k).show(slow);
 });
 $(refer).mouseout(function(){
 $(k).hide(slow);
 });
 }

 });


[jQuery] Re: Why keyCode into keyup event is disable

2008-11-27 Thread seasoup

Couple of things, 1) I highly suggest using json format to code
javascript.  Keeps things object oriented.  2) What are you attempting
to do with the ).attr(id

var myObj = {
  initform : function() {
 // To find every input field into myform and attach mykeyupfct
  $([EMAIL PROTECTED]'password']:visible,input
[EMAIL PROTECTED]'text']:visible).keyup(function()  {
mykeyupfct(this);
  });
}

to run:

myObj.initForm();


On Nov 27, 9:41 am, Soledad [EMAIL PROTECTED] wrote:
 I'm trying to use the folowing code

 !-- ---
 HTML botom of the page
  --
 scriptinitform()/script

 /***
 Javascript
 ***/
 function initform() {
 // To find every input field into myform and attach mykeyupfct
 $([EMAIL PROTECTED]'password']:visible,input
 [EMAIL PROTECTED]'text']:visible).attr(id,function(){
 $(this).keyup(function()  {mykeyupfct(this);});
 })

 }

 function mykeyupfct(myfield) {
 var sid=#+myfield.id
 var skey
 $(sid).keyup(function(e) {
 skey = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
 alert(never alert :  + skey);

 });

 alert(always alert but no skey for +sid);

 }

 Im also tryinng :
 $(sid).bind('keyup', function(e) {skey=e.keyCode; alert(skey); })
 but it's the same problem

 Thank's a lot for your help

 A beginner jQuery
 Soledad


[jQuery] Re: Validation

2008-11-27 Thread seasoup

put  'return result' inside of the success method.  Everything outside
of the ajax call is done sequentially, so its returning before the
ajax call comes back.  Actually, you may need to put the ajax call
outside of validator.addmethod and call validator.addmethod inside of
the success.

On Nov 27, 8:29 am, Fledder [EMAIL PROTECTED] wrote:
 hi,

 I'm using the jQuery Validation plugin for a big project and I'm
 loving it. I am however getting desperate trying to solve a particular
 issue. I've hunted for a solution for days now and tried everything I
 could think of, but it seems I coded myself into a deadlock. I'm
 hoping you can have a quick look at my code, it's only a little bit :)

 I'm developing a user registration form with quite some advanced
 validation. So far it works just fine, apart from one thing: remotely
 checking if the username does not exist already. Here's my code:

 // extend the validation plugin to do remote username dupe checking
 jQuery.validator.addMethod('usernameCheck', function(username) {
 var postURL = ?= $basepath; ?user/json_username_check/ +
 username + / + new Date().getTime();
 $.ajax({
 type: POST,
 url: postURL,
 success: function(msg) {
 result = (msg=='TRUE') ? true : false;
 }
 });
 return result;

 }, '');

 The problem is that I cannot return the result of the Ajax call back
 to the Validator. The Ajax call itself works fine, I can see that
 using Firebug. I've been advised to not use this low level jQuery Ajax
 call, but to use the remote option of the validator plugin instead.

 However, the reason I'm not using the remote selector from the
 Validation plugin is that my backend (Code Igniter) does not accept
 params in the format ?name=value. It will block all those. Code
 Igniter expects this: /name/value. It is possible to tell Code Igniter
 to use query strings, but that will break my entire application.
 Therefore, I am forced to use the $.ajax call.

 In my research somewhere I found somebody saying that asynchronous
 calls inside an addmethod do not work. I figured explicitly setting
 the async = false in the Ajax request (not shown above) would help,
 but it doesn't. The Ajax request itself works fine but I have no way
 to return the result of it to the Validator plugin. With remote not
 being an option and AddMethod not working, I have no idea what to do
 next. I don't mean to sound lazy, but rewriting or hacking the plugin
 itself beats my purpose of reusing and saving time.

 I've been so productive in producing forms thanks to this plugin but
 spending so much time on this little part got me quite depressed. I
 hope you can give me some advise, I would be very grateful.

 Thanks!

 Ferdy


[jQuery] Re: Draggable() doesn't work with table rows?

2008-11-27 Thread seasoup

I don't think you can drag table rows... it would remove them from the
table...


On Nov 27, 3:11 pm, René [EMAIL PROTECTED] wrote:
 I can drag and sort lists.
 I can sort tables.
 I can drag entire tables.

 But I can't drag individual table rows. Anyone know how to do it?
 Here's some sandbox code:

 ul id=list
 li id=a_1 class=drag1The/li
 li id=a_2 class=drag1slow/li
 li id=a_3 class=drag1green/li
 li id=a_4 class=drag1turtle/li
 /ul

 table id=table
 tbody id=rows
 tr id=a_1 class=drag2tdThe/td/tr
 tr id=a_2 class=drag2tdquick/td/tr
 tr id=a_3 class=drag2tdbrown/td/tr
 tr id=a_4 class=drag2tdfox/td/tr
 /tbody
 /table

 script type=text/javascript src=http://ajax.googleapis.com/ajax/
 libs/jquery/1.2.6/jquery.min.js/script
 script type=text/javascript src=http://ajax.googleapis.com/ajax/
 libs/jqueryui/1.5.2/jquery-ui.min.js/script
 script type=text/javascript

 $(document).ready(function() {
 $('.drag1').draggable();// WORKS
 //  $('#list').sortable();  // WORKS
 //  $('#rows').sortable();  // WORKS
 //  $('#table').draggable();// WORKS
 //  $('#rows').draggable(); // DOESN'T WORK  -- ?
 $('.drag2').draggable();// DOESN'T WORK  -- ?
 //  $('#a_1').draggable();  // DOESN'T WORK  -- ?
 });

 /script


[jQuery] Re: style selector (noob question)

2008-11-26 Thread seasoup

I don't think jQuery is designed to get an attribute from a class.
The code you wrote

div class=myclass /
...
var color = $(.myclass).css(background-color);

works by pulling the background color from the DOM object.  A
different hack that would work in one line:

$('div/div').addClass('myclass').css('background-color');

That would create a div, add a class to it, and fetch the background
color.


On Nov 26, 4:40 pm, Craig [EMAIL PROTECTED] wrote:
 Hi, does anyone know if it's possible to extract a style attribute
 from a style (and not an element)?
 For instance:
 style
 .myclass { background-color:white; }
 /style

 I have some legacy javascript that takes colors as parameters to
 functions and i'd like to be able to define those in a style sheet and
 then 'extract' the colors from that.

 I can only get it to work if I do something like this:
 div class=myclass /
 ...
 var color = $(.myclass).css(background-color);

 any ideas?
 Craig.


[jQuery] Re: style selector (noob question)

2008-11-26 Thread seasoup

ok, found a plugin for you:

http://flesler.webs.com/jQuery.Rule/



On Nov 26, 4:40 pm, Craig [EMAIL PROTECTED] wrote:
 Hi, does anyone know if it's possible to extract a style attribute
 from a style (and not an element)?
 For instance:
 style
 .myclass { background-color:white; }
 /style

 I have some legacy javascript that takes colors as parameters to
 functions and i'd like to be able to define those in a style sheet and
 then 'extract' the colors from that.

 I can only get it to work if I do something like this:
 div class=myclass /
 ...
 var color = $(.myclass).css(background-color);

 any ideas?
 Craig.


[jQuery] Re: trying to act on certain DIV's and not others

2008-11-26 Thread seasoup

I'm not sure exactly what it is you are trying to do, so can't answer
with exact code but this code will make all divs have a click event
that will hide all divs except the one you clicked on.

$('div').click(function(){
   $('div').not($(this)).hide();
});

Try thinking in terms of all of the selector options instead of just
ids.  When clicking on an a tag with a class of className, the
following code will hide all divs except for the div with and index of
3.

$('.className a').click(function() {
   $('div').not($('div :eq(3)').hide();
});

Hopefully, you can adapt the above logic to what you need.  The above
code also hasn't been tested, so might not work without some
adjustment.

On Nov 26, 5:47 pm, David Andrews [EMAIL PROTECTED] wrote:
 Hey Steve,

 I think regex is possible in the selector so using \\S* as your wildcard..

 $('#contact_\\S*').each();

 Sorry haven't tested the above - but hope it helps you out.

 Dave

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of [EMAIL PROTECTED]
 Sent: 26 November 2008 16:18
 To: jQuery (English)
 Subject: [jQuery] trying to act on certain DIV's and not others

 Hi folks,
 apologies if this is a completely noob question. I wish to close
 (hide) and number of div's whilst leaving others open. I considered the
 possibility that it might be feasible in Jquery to act on div's with a
 certain pattern in the id name. Not sure if this is true tho; for example

 div id-=contact_blah
 div id=contact_yak
 div id=nothanks

 so that the first two div's would be subject to being hidden, and the third
 left alone.

 I wish essentially to have a series of links toggle the visibility of some
 div's, but when a link is clicked and a div is unhidden, - all other divs to
 hide.

 Any ideas?

 best wishes and thanks

 Steve / Nibb


[jQuery] Re: Change text on toggle effect

2008-11-26 Thread seasoup

I think something like this is what you are looking for.  It adds a
click function to the elements with view and hide classes, which shows/
hides the text, uses end to get back the initial object, next to get
the next one and show/hide it and finally hides itself.  It should
work, but I didn't test it.

$('.view').click(function(){
  $(this).prev(.more).hide().end().prev().show().end().hide();
});

$('.hide').click(function(){
  $(this).prev(.more).show().end().next().show().end().hide();
});