user2021298
user2021298

Reputation: 21

AJAX: live function trouble

i'm trying to do a shopping cart animation with jquery, to do that i've a script that on the mouseover event load a div :

$('#cart > .heading a').live('mouseover',function() {
    $('#cart').load('index.php?route=module/cart #cart > *');
    $('#cart').addClass('active');  
});
$('#cart').mouseleave(function() {
    $('#cart').removeClass('active');
});

but the problem is that with the "live" function the tag does'nt work anymore.

Upvotes: 2

Views: 100

Answers (2)

Johan
Johan

Reputation: 35213

live() has been replaced by on():

Deprecated: 1.7, Removed: 1.9

Try an event delegated approach:

$('#cart').on('mouseover','.heading a',function() {
//etc

Upvotes: 1

Kriss
Kriss

Reputation: 435

Try to use:

$('#cart > .heading a').on('mouseover',function() {
  $('#cart').load('index.php?route=module/cart #cart > *');
  $('#cart').addClass('active');  
});
$('#cart').mouseleave(function() {
  $('#cart').removeClass('active');
});

Upvotes: 0

Related Questions