הרשם שאלות ותשובות רשימת חברים לוח שנה הודעות מהיום

חזור   הוסטס - פורום אחסון האתרים הגדול בישראל > עיצוב גראפי, תכנות על כל שפותיו וקידום ושיווק אתרים > פורום תיכנות

   
|!|

השב
 
כלים לאשכול תצורת הצגה
ישן 29-10-10, 22:37   # 1
hi_sorie
חבר וותיק
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
מיקום: רחובות
גיל: 38
הודעות: 1,339

hi_sorie לא מחובר  

HTML קוד:
var texts = new Array("בלה בלה 1","בלה בלה 2","בלה בלה 3","בלה בלה 4","בלה בלה 5","בלה בלה 6");
var inout = true;
var curr;
var fade = 350;

	$('#cares ul li').mouseover(function() {
		
		// get the on li num and add 1 ( start at 0 )
		ItemNum = $(this).index()+1;

		if ((inout) && (curr != ItemNum)){
		inout = false;
		// set off all li;
		$('#cares ul li').each(function() {
			$(this).attr('class', "cares_li2");
		});
		// set on the curr li
		$(this).fadeOut(fade).attr('class', "cares_li1").fadeIn(fade);
		
$(document).ready(function() {
		
		// change the side pic
		$(".cares_si").fadeOut(fade).attr('src', wb_url+"/templates/home_temp/images/cares_si"+ItemNum+".png").fadeIn(fade);
		$(".cares_si").attr('title', texts[ItemNum-1]);
		$(".cares_si").attr('alt', texts[ItemNum-1]);
		$(".cares_si").simpletooltip();
		
		
		// change the text on the pic
		$("#cares_white_line").fadeOut(fade).html(texts[ItemNum-1]).fadeIn(fade);
		
		curr = ItemNum;
		inout = true;
		}
	});
});


  Reply With Quote
ישן 30-10-10, 01:53   # 2
benb
חבר בקהילה
 
benb's Avatar
 
מיני פרופיל
תאריך הצטרפות: Apr 2010
הודעות: 138

benb לא מחובר  

ציטוט:
נכתב במקור על ידי hi_sorie צפה בהודעה
HTML קוד:
var texts = new Array("בלה בלה 1","בלה בלה 2","בלה בלה 3","בלה בלה 4","בלה בלה 5","בלה בלה 6");
var inout = true;
var curr;
var fade = 350;

	$('#cares ul li').mouseover(function() {
		
		// get the on li num and add 1 ( start at 0 )
		ItemNum = $(this).index()+1;

		if ((inout) && (curr != ItemNum)){
		inout = false;
		// set off all li;
		$('#cares ul li').each(function() {
			$(this).attr('class', "cares_li2");
		});
		// set on the curr li
		$(this).fadeOut(fade).attr('class', "cares_li1").fadeIn(fade);
		
$(document).ready(function() {
		
		// change the side pic
		$(".cares_si").fadeOut(fade).attr('src', wb_url+"/templates/home_temp/images/cares_si"+ItemNum+".png").fadeIn(fade);
		$(".cares_si").attr('title', texts[ItemNum-1]);
		$(".cares_si").attr('alt', texts[ItemNum-1]);
		$(".cares_si").simpletooltip();
		
		
		// change the text on the pic
		$("#cares_white_line").fadeOut(fade).html(texts[ItemNum-1]).fadeIn(fade);
		
		curr = ItemNum;
		inout = true;
		}
	});
});


אני חושב שבגלל הפונקציה של FADEIN FADEOUT כי אם אתה עובר מהר אז יש תור של פונקציות שמחכות לרוץ ולעשות את האפקט והן כל פעם שואלות THIS? ואז זה מריץ את מספר הפעמים שהפונקציה רצה על האלמנט שאתה מצביע עליו כעת.
  Reply With Quote
ישן 30-10-10, 15:01   # 3
IgalSt
מנהל פורום, עסק רשום
 
IgalSt's Avatar
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
מיקום: המרכז
גיל: 38
הודעות: 1,432
Send a message via Skype™ to IgalSt

IgalSt לא מחובר  

ראיתי כמה דברים לא כ"כ "נכונים" בקוד שלך, ראה הערות שלי:
HTML קוד:
	$('#cares ul li').mouseover(function() {
		
		// get the on li num and add 1 ( start at 0 )
		ItemNum = $(this).index()+1; //use ++ and when adding +1

		if ((inout) && (curr != ItemNum)){
		inout = false;
		// set off all li;
		$('#cares ul li').each(function() {  //there is no need for "each" here
			$(this).attr('class', "cares_li2"); //using "addClass"/"removeClass" is more "reader friendly"
		});
ובקשר לבעיה עצמה:
לדגעתי עליך לעבוד עם ה-callback של fadeOut/fadeIn
ככל הנראה אתה מבצע שינויים לפני שהאנימציה הסתיימה ולכן הכל נדפק.
ראה בריפרנס של fadeOut/fadeIn אפשרות לביצוע callback בגמר האנימציה.
לדוגמא ככה:
HTML קוד:
$('....').fadeIn(100, function(){
  $(this).fadeOut(500,function(){
    alert('end of animation');
  });
});
  Reply With Quote
השב

חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים)
 


חוקי פירסום
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is מופעל
סמיילים הם מופעל
[IMG] קוד מופעל
קוד HTML מכובה

קפיצה לפורום


כל הזמנים הם GMT +2. הזמן כעת הוא 19:53.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ