Есть такой код: [js]msep.ajaxui = { users: [], userInfo: [], html: "", links: [], newLinks: false, secondCheck: 0, photo: 1, num: 0, mouseover: 0, init: function(opt) { this.html = $(document.body).innerHTML; this.mouseover = opt['mouseover']; if (!this.tooltip_box) this.tooltip_box = msep.core.tooltip.newBox(opt); }, getUsers: function() { var self = this; if (self.secondCheck == 0 || (self.secondCheck > 0 && self.html != $(document.body).innerHTML)) { self.secondCheck += 1; self.html = $(document.body).innerHTML; getByAttribute(getById('global_content'), 'a', 'href', new RegExp("/profile/([^\/]+)$")).each(function(el) { var url = el.getAttribute('href'); if (url_match = url.match(new RegExp("/profile/([^\/]+)$"))) { if (!self.users.in_array(url_match[1])) { self.newLinks = true; self.users.splice(0, 0, url_match[1]); } } }); if (self.secondCheck == 0 || (self.secondCheck > 0 && self.newLinks)) { self.newLinks = false; var users_validate = new Request.JSON( { url: msep.core.baseUrlRaw+'ajax-user-informer/validate', method: 'post', data: { 'ajaxui_users': self.users.toString(), format : 'json' }, onComplete: function(jsonObj) { if (jsonObj != null && typeof(jsonObj) != "undefined") { for (var user in jsonObj.ajaxui_users) { if (jsonObj.ajaxui_users.hasOwnProperty(user)) { self.userInfo[user] = jsonObj.ajaxui_users[user]; } } (function() { getByAttribute(getById('global_content'), 'a', 'href', new RegExp("/profile/([^\/]+)$")).each(function(el) { var url = el.getAttribute('href'); if (url_match = url.match(new RegExp("/profile/([^\/]+)$"))) { self.addTips(el, url_match[1]); } }); })(); } } }).send(); } (function() { getByAttribute(getById('global_content'), 'a', 'href', new RegExp("/profile/([^\/]+)$")).each(function(el) { var url = el.getAttribute('href'); if (url_match = url.match(new RegExp("/profile/([^\/]+)$"))) { self.addTips(el, url_match[1]); } }); })(); } this.getUsers.delay(100, this); }, addTips: function(el, match) { var self = this; if (!isNaN(parseInt(match.substr(0, 1)))) match = match+"_user"; if (self.userInfo[match]) { if (self.mouseover == 0) { var tag_match = !el.firstChild.tagName; } else if (self.mouseover == 1) { var tag_match = (el.firstChild.tagName && !el.firstChild.tagName.match(/a/i)); } else { var tag_match = true; } if (el.getAttribute('alt') != 'ajaxui' && el.firstChild && tag_match) { el.setAttribute('alt', 'ajaxui'); if (self.userInfo[match]['button']['message'] == "" && self.userInfo[match]['button']['friend'] == "" && self.userInfo[match]['html'] == "" && self.userInfo[match]['photo'] == "") return; var mutual_html = ""; if (self.userInfo[match]['mutual']['total'] > 0) { mutual_html = "<tr><td style='font-weight: bold;' valign='top'>Общие друзья</td><td style='text-align: right' valign='top'><a href='"+msep.core.baseUrlRaw+"profile/"+self.userInfo[match]['username']+"'>("+self.userInfo[match]['mutual']['total']+")</a></td></tr><tr><td style='padding: 10px 0 5px 0;' colspan='2'>"; self.userInfo[match]['mutual']['friends'].each(function(friend) { mutual_html += friend['photo']; }); mutual_html += "</td>"; } var buttons_html = ""; if (self.userInfo[match]['button']['message'] != "" || self.userInfo[match]['button']['friend'] != "") { buttons_html += "<tr><td colspan='2' style='text-align: right; padding-top: 5px;'>"+self.userInfo[match]['button']['friend']+self.userInfo[match]['button']['message']+"</td></tr>"; } if (self.userInfo[match]['html'] != "" && self.userInfo[match]['photo'] != "") { msep.core.tooltip.register(this.tooltip_box, el, "<table cellpadding='0' cellspacing='0' style='width: 100%;'><tr><td valign='top' style='width: 200px;'><img src='"+self.userInfo[match]['photo']+"' style='max-width: 200px;' /></td><td valign='top' style='padding-left: 10px;'><table cellpadding='0' cellspacing='0'>"+mutual_html+self.userInfo[match]['html']+buttons_html+"</table></td></tr></table>"); } else if (self.userInfo[match]['photo'] != "") { msep.core.tooltip.register(this.tooltip_box, el, "<table cellpadding='0' cellspacing='0' style='width: 100%;'><tr><td valign='top' style='width: 200px;'><img src='"+self.userInfo[match]['photo']+"' style='max-width: 200px;' /></td><td valign='top'><table cellpadding='0' cellspacing='0'>"+mutual_html+buttons_html+"</table></td></tr></table>"); } else if (self.userInfo[match]['html'] != "") { msep.core.tooltip.register(this.tooltip_box, el, "<table cellpadding='0' cellspacing='0' style='width: 100%;'>"+mutual_html+self.userInfo[match]['html']+buttons_html+"</table>"); } self.num++; } } Smoothbox.bind(); } };[/js] Он выводит информацию о пользователе. Она открывается сразу без задержки. Если мышкой вести по нескольким то открывается мгновенно и многие уже жалуются. Подскажите пожалуйста где тут можно поставить задержку в 1сек. Буду очень благодарен если вы мне поможете! Спасибо.
Да пральна он все сказал. setTimeout на наведении и clearTimeout на убирании Только это что за код вообще? Самописный или какой-то класс готовый?
блин я php только начал учить JS вообще не знаю, ткните носом после чего куда поставить. Просто правда не понимаю я этот JS (((
Invision Аналога sleep в яваскрипте нет. Можно как сказал asik - одно событие инициализирует таймер, который после своего выполнения запускает другую функцию
ты будешь рад, когда твоя девушка будет говорить это)) а по теме. запусти простой код, например, вот отсюда http://javascript.ru/settimeout . попробуй поменять разные параметры и поймёшь, как работает эта функция. потом добавь её в свой класс. а так с наскока сказать: "добавь в строку 42 'echo 111;' и будете тебе счастье" не получится.