我有这段jquery:
$('#team-members .team-thumb').on('click', function(e){
e.preventDefault();
var member = $(this).data('member');
$('#team-members .team-profiles').slideToggle();
teamSlider.reloadSlider({
startSlide: member,
pager: false,
adaptiveHeight: true
});
$('html,body').animate({
scrollTop: $("#team-profiles").offset().top},
'fast');
$('.bx-viewport').prepend('<div id="slide-me"></div>');
});
我如何使它只在此事件之前添加一次,以便在第二次单击时不会将其添加到 DOM:
$('.bx-viewport').prepend('<div id="slide-me"></div>');