bftarane
سه شنبه 01 بهمن 1392, 12:56 عصر
سلام.
من سعی کردم یه افکت با استفاده از jquery ایجاد کنم که در لینک زیر می تونید ببینید
http://jsfiddle.net/kfru6/5
منتها متوجه شدم مثلاً سایت رو که باز می کنم و یه مدت کاری باهاش ندارم دوباره میام سراغش اون زمانبندی که در نظر گرفته بودم واسه اومدن و رفتن عکس ها به هم ریخته مثلاً 2 تا عکس با هم ظاهر می شن در صورتی که اول باید یکی و بعد از یه مدت کوتاه دیگری بیاد.
این مشکل رو چطور میشه حل کرد؟
این کدهای جی کوئریش هست
$(document).ready(function () {
repeatfunction();
text();
repeatfunction2()
});
function expandpicwrapper() {
$("#picwrapper").animate({ height: 171 });
}
setInterval("repeatfunction2()", 2000);
setInterval("text()", 27000);
function text() {
$('#b').hide();
$('#o').hide();
$('#r1').hide();
$('#n').hide();
$('#a1').hide();
$('#m').hide();
$('#a2').hide();
$('#d').hide();
$('#a3').hide();
$('#r2').hide();
$('#dot').hide();
$('#i').hide();
$('#r3').hide();
$('#b').fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
$('#o').delay(1000).fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
$('#r1').delay(2000).fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
$('#n').delay(3000).fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
$('#a1').delay(4000).fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
$('#m').delay(5000).fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
$('#a2').delay(6000).fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
$('#d').delay(7000).fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
$('#a3').delay(8000).fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
$('#r2').delay(9000).fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
$('#dot').delay(10000).fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
$('#i').delay(11000).fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
$('#r3').delay(12000).fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
}
setInterval("repeatfunction()",17000);
function repeatfunction() {
var toggleWidth3 = $("#picThree").width() == 10 ? "400px" : "10px";
var toggleHeight3 = $("#picThree").height() == 10 ? "200px" : "10px";
var toggleWidth1 = $("#picOne").width() == 10 ? "309px" : "10px";
var toggleWidth2 = $("#picTwo").width() == 10 ? "309px" : "10px";
var toggleHeight1 = $("#picOne").height() == 10 ? "190px" : "10px";
var toggleHeight2 = $("#picTwo").height() == 10 ? "261px" : "10px";
$('#picOne').fadeIn("slow").animate({ left: "300px", top: "120", width: toggleWidth1, height: toggleHeight1 }, 3000).delay(1000).animate({ left: "450" }, 1000).fadeOut(function () {
$(this).css('top', 50);
$(this).css('left', 380);
$(this).css('width', 10);
$(this).css('height', 10);
});
$('#picThree').delay(10000).fadeIn("slow").animate({ left: "300px", top: "120px", width: toggleWidth3, height: toggleHeight3 }, 3000).delay(1000).animate({ top: "200" }, 1000).fadeOut(function () {
$(this).css('top', 50);
$(this).css('left', 380);
$(this).css('width', 10);
$(this).css('height', 10);
});
$('#picTwo').delay(5000).fadeIn("slow").animate({ left: "300px", top: "120px", width: toggleWidth2, height: toggleHeight2 }, 3000).delay(1000).animate({ left: "100" }, 1000).fadeOut(function () {
$(this).css('top', 50);
$(this).css('left', 380);
$(this).css('width', 10);
$(this).css('height', 10);
});
}
function repeatfunction2() {
$('.glow1').fadeIn("slow").animate({ left: "480px", top: "295px" }, "slow").fadeOut(function () {
$(this).css('left', 0);
$(this).css('top', 255);
});
$('.glow2').fadeIn("slow").delay(1000).animate({ left: "400px", top: "285px" }, "slow").fadeOut(function () {
$(this).css('left', 5);
$(this).css('top', 290);
});
$('.glow3').fadeIn("slow").animate({ left: "20px", top: "255px" }, "slow").fadeOut(function () {
$(this).css('left', 380);
$(this).css('top', 310);
});
$('.glow4').fadeIn("slow").delay(1000).animate({ left: "50px", top: "290px" }, "slow").fadeOut(function () {
$(this).css('left', 480);
$(this).css('top', 350);
});
}
خیلی ممنون میشم پاسخ بدید.
من سعی کردم یه افکت با استفاده از jquery ایجاد کنم که در لینک زیر می تونید ببینید
http://jsfiddle.net/kfru6/5
منتها متوجه شدم مثلاً سایت رو که باز می کنم و یه مدت کاری باهاش ندارم دوباره میام سراغش اون زمانبندی که در نظر گرفته بودم واسه اومدن و رفتن عکس ها به هم ریخته مثلاً 2 تا عکس با هم ظاهر می شن در صورتی که اول باید یکی و بعد از یه مدت کوتاه دیگری بیاد.
این مشکل رو چطور میشه حل کرد؟
این کدهای جی کوئریش هست
$(document).ready(function () {
repeatfunction();
text();
repeatfunction2()
});
function expandpicwrapper() {
$("#picwrapper").animate({ height: 171 });
}
setInterval("repeatfunction2()", 2000);
setInterval("text()", 27000);
function text() {
$('#b').hide();
$('#o').hide();
$('#r1').hide();
$('#n').hide();
$('#a1').hide();
$('#m').hide();
$('#a2').hide();
$('#d').hide();
$('#a3').hide();
$('#r2').hide();
$('#dot').hide();
$('#i').hide();
$('#r3').hide();
$('#b').fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
$('#o').delay(1000).fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
$('#r1').delay(2000).fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
$('#n').delay(3000).fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
$('#a1').delay(4000).fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
$('#m').delay(5000).fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
$('#a2').delay(6000).fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
$('#d').delay(7000).fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
$('#a3').delay(8000).fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
$('#r2').delay(9000).fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
$('#dot').delay(10000).fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
$('#i').delay(11000).fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
$('#r3').delay(12000).fadeIn().animate({ top: "50" }).delay(14000).fadeOut(function () {
$(this).css('top', 0);
});
}
setInterval("repeatfunction()",17000);
function repeatfunction() {
var toggleWidth3 = $("#picThree").width() == 10 ? "400px" : "10px";
var toggleHeight3 = $("#picThree").height() == 10 ? "200px" : "10px";
var toggleWidth1 = $("#picOne").width() == 10 ? "309px" : "10px";
var toggleWidth2 = $("#picTwo").width() == 10 ? "309px" : "10px";
var toggleHeight1 = $("#picOne").height() == 10 ? "190px" : "10px";
var toggleHeight2 = $("#picTwo").height() == 10 ? "261px" : "10px";
$('#picOne').fadeIn("slow").animate({ left: "300px", top: "120", width: toggleWidth1, height: toggleHeight1 }, 3000).delay(1000).animate({ left: "450" }, 1000).fadeOut(function () {
$(this).css('top', 50);
$(this).css('left', 380);
$(this).css('width', 10);
$(this).css('height', 10);
});
$('#picThree').delay(10000).fadeIn("slow").animate({ left: "300px", top: "120px", width: toggleWidth3, height: toggleHeight3 }, 3000).delay(1000).animate({ top: "200" }, 1000).fadeOut(function () {
$(this).css('top', 50);
$(this).css('left', 380);
$(this).css('width', 10);
$(this).css('height', 10);
});
$('#picTwo').delay(5000).fadeIn("slow").animate({ left: "300px", top: "120px", width: toggleWidth2, height: toggleHeight2 }, 3000).delay(1000).animate({ left: "100" }, 1000).fadeOut(function () {
$(this).css('top', 50);
$(this).css('left', 380);
$(this).css('width', 10);
$(this).css('height', 10);
});
}
function repeatfunction2() {
$('.glow1').fadeIn("slow").animate({ left: "480px", top: "295px" }, "slow").fadeOut(function () {
$(this).css('left', 0);
$(this).css('top', 255);
});
$('.glow2').fadeIn("slow").delay(1000).animate({ left: "400px", top: "285px" }, "slow").fadeOut(function () {
$(this).css('left', 5);
$(this).css('top', 290);
});
$('.glow3').fadeIn("slow").animate({ left: "20px", top: "255px" }, "slow").fadeOut(function () {
$(this).css('left', 380);
$(this).css('top', 310);
});
$('.glow4').fadeIn("slow").delay(1000).animate({ left: "50px", top: "290px" }, "slow").fadeOut(function () {
$(this).css('left', 480);
$(this).css('top', 350);
});
}
خیلی ممنون میشم پاسخ بدید.