Right at the start:

$('[class^=Round_gen]').filter(function(){
return /Round_gen[0-9]+/.test( $(this).attr('class') );
}).each(function(){
  // at this point $(this) is a single element
  var $this = $(this);
  var params = $(this).attr('rel').split(':');
  etc, etc.

  /*** you don't need this, it's only if you need the number in the
className var n = $(this).attr('class').match(/[0-9]+/); ***/

didn't have time to look through the rest of the code though.




On Sep 23, 11:10 pm, jeremyBass <[EMAIL PROTECTED]> wrote:
> Hello, ok... so thou yes it works... and I am thankful for you guys
> for helping, it through a monkey wrench into the fallowing code... may-
> be some one could give me a hand on "this" ... (thats was the area of
> issues before :-)
>
> here is the code with the changes as suggested above...
>
> $('[class^=Round_gen]').filter(function(){
> return /Round_gen[0-9]+/.test( $(this).attr('class') );}).each(function(){
>
>   var n = $(this).attr('class').match(/[0-9]+/);
>         $(this).each(function() {var $this = $(this);
>                 var params = $(this).attr('rel').split(':');
>                 $(this).flash({flashvars: {
>                         right_off : ['' + params[4] + ''],
>                         left_off : ['' + params[5] + '']
>                         .join(' ')
>         }}, { version: 8 }, function(htmlOptions) {
>
>                 htmlOptions.src = params[0];
>                 htmlOptions.width = params[1];
>                 htmlOptions.wmode = params[3];
>                 htmlOptions.style = "";
>                 this.innerHTML = '<div 
> class="clear_children">'+this.innerHTML+'</
> div>';
>                 htmlOptions.height = this.firstChild.offsetHeight;
>                 $this.addClass('').prepend($.fn.flash.transform(htmlOptions));
> ////////////////////////////////////////////////////////////
> //////there is probly a better way to target come back to (try not to
> use .clear_childern) swicth to $this????
> ////////////////////////////////////////////////////////////
>                 $
> (this).contents("[nodeType=1]").not(".clear_children").addClass("sizeME");
>                 var self = this;
>
>                 function doSomething() {
>                    var NEWheight =  self.childNodes[1].offsetHeight;
>                    $
> (this).contents("[nodeType=1]").not(".clear_children").height(NEWheight
> +'px');
>                 };
> ////////////////////////////////////////////////////////////
> ////////////////////////////////////////////////////////////
>                 var resizeTimer = null;
>                 $(window).bind('resize', function() {
>                         if (resizeTimer) clearTimeout(resizeTimer);
>                         resizeTimer = setTimeout(doSomething, 3);
>                         });
>                 });
>         });
>
> });
>
> this was the way it was.... Which worked...
>
> $('.Round2').each(function() {var $this = $(this);
>                 var params = $(this).attr('rel').split(':');
>                 $(this).flash({flashvars: {
>                         right_off : ['' + params[4] + ''],
>                         left_off : ['' + params[5] + '']
>                         .join(' ')
>         }}, { version: 8 }, function(htmlOptions) {
>
>                 var $this = $(this);
>                 var params = $(this).attr('rel').split(':');
>                 htmlOptions.src = params[0];
>                 htmlOptions.width = params[1];
>                 htmlOptions.wmode = params[3];
>                 htmlOptions.style = "";
>                 this.innerHTML = '<div 
> class="clear_children">'+this.innerHTML+'</
> div>';
>                 htmlOptions.height = this.firstChild.offsetHeight;
>
> $this.addClass('').prepend($.fn.flash.transform(htmlOptions));
> ////////////////////////////////////////////////////////////
> //////there is probly a better way to target come back to (try not to
> use .clear_childern) swicth to $this????
> ////////////////////////////////////////////////////////////
> $
> ('.Round2').contents("[nodeType=1]").not(".clear_children").addClass("targetME2");
> var self2 = this;
> function doSomething2() {
>    var NEWheight2 =  self2.childNodes[1].offsetHeight;
>    $
> ('.Round2').contents("[nodeType=1]").not(".clear_children").height(NEWheight2+'px');};
>
> ////////////////////////////////////////////////////////////
> ////////////////////////////////////////////////////////////
> var resizeTimer2 = null;
> $(window).bind('resize', function() {
>     if (resizeTimer2) clearTimeout(resizeTimer2);
>     resizeTimer2 = setTimeout(doSomething2, 3);
>     });
>
> });
> });
>
> The short of it is that I was needing to have the first child element
> be the same height and it's next sibling... I worked hard to get it
> going and I did... the problem the whole time was that I was not able
> to target the first child and change the height based on the offset
> height of the first child's next sibling... but the way I have it
> above did work... and was promising... but with the suggest changes I
> can't see a way to fix it as "this" was the issue the first time
> around... any ideas on this?
>
> thank you for the help
> jeremyBass
>
> On Sep 23, 5:16 pm, ricardobeat <[EMAIL PROTECTED]> wrote:
>
> > There is no need for quotes as everything is already a string.
>
> > Jeremy, you need to understand what's going on:
>
> > $('[class^=Round_gen]').filter(function(){
> > // checks for any element where the 'class' attribute starts with
> > 'Round_gen'
>
> >     return /Round_gen[0-9]+/.test( $(this).attr('class') );
> > // 'test' is a method of the regular expression, that will test this
> > element's attribute 'class' against it, returning true or false. there
> > is no attribute called 'Round_gen'
>
> > }).each(function(){
>
> >      var n = $(this).attr('class').match(/[0-9]+/);
> >          // again, we are testing the CLASS attribute against the
> > regex, this will return the matched part (i.e the numbers in the
> > classname)
>
> >  //in here you also want your code for each element, $(n) is not gonna
> > do anything as n is just a number, use $(this)
>
> > });
>
> > hope it's clearer now!
>
> > - ricardo
> > On Sep 23, 6:13 pm, tlphipps <[EMAIL PROTECTED]> wrote:
>
> > > Just need some quotes around the class name (I forgot to include some
> > > quotes in my example too)
>
> > > This should work:
> > > $("[class^='Round_gen']")
>
> > > On Sep 23, 4:04 pm, jeremyBass <[EMAIL PROTECTED]> wrote:
>
> > > > So tring to get this going  I did
>
> > > > var n = '';
> > > > $('[class^=Round_gen]').filter(function(){
> > > >     return /Round_gen[1-9][0-9]+/.test( $(this).attr('Round_gen') 
> > > > );}).each(function(){
>
> > > >      var n = $(this).attr('Round_gen').match(/[0-9]+/);
>
> > > > });
>
> > > >  $('.Round_gen'+n+'').each(function() {...ect
>
> > > > and Got it picking up .Round_gen only ... not Round_gen9 or
> > > > Round_gen99
>
> > > > I think I'm close
> > > > thanks for the help...
> > > > jeremyBass
>
> > > > On Sep 23, 11:49 am, jeremyBass <[EMAIL PROTECTED]> wrote:
>
> > > > > So let say the class was named Round_gen9
>
> > > > > I'd replace
>
> > > > > $('.Round_gen9'').each(function() {....etc
>
> > > > > with
>
> > > > > $('[class^=Round_gen]').filter(function(){
> > > > >     return /Round_gen[0-9]+/.Round_gen( $(this).attr('Round_gen') 
> > > > > );}).each(function(){
>
> > > > >      var n = $(this).attr('Round_gen').match(/[0-9]+/);
> > > > >          // the number after 'class' for current element});
>
> > > > >  $('n').each(function() {....etc
>
> > > > > nothing is showing up... so I don't think this is fully right (I mean
> > > > > what I wrote)
> > > > > ideas??
>
> > > > > Thanks for the help here...
> > > > > jeremyBass
>
> > > > > On Sep 23, 11:26 am, ricardobeat <[EMAIL PROTECTED]> wrote:
>
> > > > > > Using [class^=class] is your best bet, the other option is to loop
> > > > > > over all the possibilities and that is a no-go. Coupled with the
> > > > > > filter function this will give you all elements with classX where X 
> > > > > > is
> > > > > > a number:
>
> > > > > > $('[class^=class]').filter(function(){
> > > > > >     return /class[0-9]+/.test( $(this).attr('class') 
> > > > > > );}).each(function(){
>
> > > > > >      var n = $(this).attr('class').match(/[0-9]+/); // the number
> > > > > > after 'class' for current element
>
> > > > > > });
>
> > > > > > hope this helps.
>
> > > > > > - ricardo- Hide quoted text -
>
> > - Show quoted text -

Reply via email to