こんにちは私はこのコードを使用しています:
jQuery(document).ready(function(){
var number = 1;
///////////////////////////////////////////////////
/* The button to see the single portfolio items */
jQuery('.cover a').unbind("click").click(function (coverclick){
coverclick.preventDefault();
coverclick.stopPropagation();
coverclick.stopImmediatePropagation();
number ++;
/* Get the link */
var coverlink = jQuery(this).attr('href');
jQuery('.loadmask').show();
jQuery('.loadmask-msg').show();
jQuery('.upperdiv').animate({height : 'hide', opacity : 'hide', easing: 'EaseOutBounce'},'slow', function(){ jQuery('.upperdiv').html('');});
jQuery('.upperdiv').load(coverlink+' .loading_div');
jQuery('.upperdiv').ajaxComplete(function() {
var slideClass = 'all_project_images' + number;
var dentroClass = '.' + slideClass;
jQuery('html,body').stop().animate({
scrollTop: jQuery(this).offset().top},
'slow');
jQuery('.post_nav_portfolio').show();
jQuery('.slideshow ul').removeClass().addClass(slideClass);
jQuery(dentroClass).stop(false,true).responsiveSlides({
auto: true,
nav: true,
speed: 500});
jQuery('.upperdiv').animate({height : 'show', opacity : 'show', easing: 'EaseInBounce'},'slow');
jQuery('.loadmask').hide();
jQuery('.loadmask-msg').hide();
jQuery('.cover').hover(function(){
jQuery(this).children('.mimo_portfolio_image').stop().animate({opacity : 0.5},'fast');
}, function(){
jQuery(this).children('.mimo_portfolio_image').stop().animate({opacity : 1},'fast');
});
jQuery("a[rel^='prettyPhoto']").prettyPhoto();
jQuery('.slideshow').hover(function(){
jQuery(this).children('.rslides_nav').show('slow');
}, function(){
jQuery(this).children('.rslides_nav').hide('slow');
});
console.log(dentroClass);
});
return false;
});
});
ポートフォリオアイテムを読み込んで表示するには、読み込みしてうまく機能しますが、console.log(dentroClass);で重複の問題が発生します。
最初にクリックすると変数が1回、2回目のクリックが2回、3回のクリックが3回、すべての関数がクリックの回数を繰り返し、5回目のクリックの場合は関数が5回繰り返されることがわかります。
私はon()で作業しています。およびOFF(); およびbind(); 解放する(); しかし、何も機能しません。