[JavaScript] Funktion auf Klasse

Dieses Thema im Forum "Webentwicklung" wurde erstellt von SidDasFaultier, 3. Februar 2012 .

  1. 3. Februar 2012
    Funktion auf Klasse

    Hey Rushler,

    ich habe ein Script nun möchte ich aber nicht das bei mouseover eines li-Elementes die funktion eintritt sondern bei einem "a"-tag der in einem "li"-tag drinne ist...das "li" tag hat auch noch eine klasse "item-101".

    Das weiteren soll nicht $(this) angesprochen werden sondern ein "div" mit der klasse "navi-1".

    Code:
    //When mouse is removed
    $("li").mouseout(function(){
    $(this).stop().animate({height:'50px'},{queue:false, duration:600, easing: 'easeOutBounce'})
    });
    Könnt ihr mir da weiterhelfen?
     
  2. 3. Februar 2012
    AW: Funktion auf Klasse

    Code:
    $('li a').mouseout(
     function(event) {
     $('div.navi-1').stop().animate(...)
     }
    );
    so?!
     
  3. 3. Februar 2012
    AW: Funktion auf Klasse

    und wenn das li die klasse "item-101" hat dann...

    Code:
    $('li.item-101 a').mouseout(
     function(event) {
     $('div.navi-1').stop().animate(...)
     }
    );
    
    ?

    --> Funktioniert! Danke!
     
  4. 3. Februar 2012
    AW: Funktion auf Klasse

    Also ich will noch die "Line-Height" bei mousover auf 12px setzen und bei mousout auf 0px setzen zusätzlich zur "height".

    Code:
     //When mouse rolls over
     $('li.item-102 a').mouseover(function(){
     $('div.navi-1').stop().animate({height:'34px'},{queue:false, duration:800, easing: 'easeOutBounce'})
     });
     
     //When mouse is removed
     $("li.item-102 a").mouseout(function(){
     $('div.navi-1').stop().animate({height:'0'},{queue:false, duration:800, easing: 'easeOutBounce'})
     });
    
    habs schon in allen möglichen veriationen versucht komm aber nicht dahinter...wenn ich etwas hinzufüge funktioniert mein script nicht mehr -.-
     
  5. 3. Februar 2012
    AW: Funktion auf Klasse

    Probier es an stelle von line-height mal mit lineHeight oder 'line-height oder "line-height"
     
  6. 3. Februar 2012
    AW: Funktion auf Klasse

    oder du erstellt den effekt mit css3-transitions, die jquery ohne plugin ja (noch?) verweigert

    http://murdoc.eu/rr/expand.html
     
  7. Video Script

    Videos zum Themenbereich

    * gefundene Videos auf YouTube, anhand der Überschrift.