jilseego
jilseego

Reputation: 1103

jQuery: .load() invoked twice?

I am really confused with what's happening. My code is very basic yet the result seems to be very complex :-\

$j.ajaxSetup ({
    cache: false
});

var $img = $j('.infiniteCarousel-vid ul li img:not(.noimg)');
var loadUrl = "http://shorelinerenovations.com/wp-content/themes/Narm/videos/load_vid.php";

$img.click(function(){ 
    $j('.vid-preview').load(loadUrl);
}); 

Feel free to visit the page where I am implementing this: http://shorelinerenovations.com/project-1 . The styling is very buggy as of the moment so forgive me. When you click on one of the image previews at the very bottom, you'll see the video is being loaded twice :-\

Upvotes: 0

Views: 285

Answers (1)

StuperUser
StuperUser

Reputation: 10850

Is this script loaded and run twice?

Load() is in the click handler (the anonymous function you've passed to click()), if it is being run twice, it is probably being registered twice.

Upvotes: 1

Related Questions