How to make a jQuery Horizontal Tab that loads the page once

后端 未结 5 1684
眼角桃花
眼角桃花 2020-12-11 12:46

I want a jQuery horizontal tab pane (screenshot below) where clicking on a tab loads an external page in the div but where clicking on it after it is loaded does not load th

5条回答
  •  庸人自扰
    2020-12-11 13:40

    Use the one() function.

    Ex:

    $("#foo").one("click", function() {
      alert("click can only be done once.");
    });
    

    UPDATE

    If you are trying to cache the Ajax response so that subsequent Ajax requests that match the original Ajax options will return the cached response instead of making a new call then i highly recommend using this excellent jQuery plugin http://plugins.jquery.com/project/ajax-cache-response

提交回复
热议问题