-1

As title says, is there any issue?

for example, i use them this way:

$("abbr.timeago").livequery(function() {
    $(this).timeago();
});

$("#btnPhoto").livequery(function() {
    createUploader();
});

$("#inputTagline").livequery(function () {
    $(this).charCount();
});;

EDIT enter image description here My web page alone uses up 100k memory.
Provided page contents are generated by ajax, does anyone of you know how to solve the .timeago() problem? I really appreciate that. Thanks

UPDATE Now i can get rid of livequery by @Linas answe below. Any better answers are welcome!

Community
  • 1
  • 1
Loonb
  • 1,068
  • 5
  • 18
  • 30
  • 4
    Possible duplicate [livequery performance](http://stackoverflow.com/questions/4818020/livequery-performance). – juan.facorro Nov 20 '12 at 02:45
  • Better delegate / live, but what is your project? It always depends on your needs. – Dimitris Damilos Nov 20 '12 at 02:56
  • why downvote? i just want opinion T_T ..... jquery.timeago(); needs livequery to detect dynamically generated element. that's why i use it. i know about jquery.on but it needs some events to occur eg, "click". – Loonb Nov 20 '12 at 10:42

1 Answers1

0

I am working on similar project as yours, and i also use time ago plugin, so i was facing same issue as you do right now.

What i did is i made a helper function, which does various stuff like updates time, removes unused content and so on. So instead of using livequery i simply call that helper function when i update any content on my page and so saving a lot of memory.

EDIT It's just a very simple function that you create for your self:

function helper(){
   //update all time that exists on current page
   //just put same class name in each time object for example class="time_ago"
   //now it will update each object with class "time_ago"
   $(".time_ago").timeago();
   //now do some other stuff like remove old content unbind events and so on here...
}

And every time you use some kind of function which updates your content via ajax after it just call helper() and it will take care of things that you need, no need to worry about plugins, and their performance since you have full control over your script.

Linas
  • 4,380
  • 17
  • 69
  • 117
  • I can't get what helper function you are using, please don mind to give a short example. XD btw, i guess: you call the helper function to update "blablabla" when jquery.on is called? am i right? – Loonb Nov 20 '12 at 11:21