我有一个jquery的插件(是一个JS文件)。   中间有这样的一段代码 
   a.fn.prettyPhoto = function(t) {
        t = jQuery.extend({
            animationSpeed: "normal",
            padding: 40,
            opacity: 0.4,
            showTitle: true,
            allowresize: true,
            counter_separator_label: "/",
            theme: "light_rounded",
            callback: function() {            }因为这个插件在很多页面都用到了。 
   有什么办法把【callback】回调函数。写在页面中间。
   

解决方案 »

  1.   

    有什么办法把【callback】回调函数。写在页面中间。是什么意思?这样?function fun(){}
    a.fn.prettyPhoto = function(t) {
      t = jQuery.extend({
      animationSpeed: "normal",
      padding: 40,
      opacity: 0.4,
      showTitle: true,
      allowresize: true,
      counter_separator_label: "/",
      theme: "light_rounded",
      callback: fun
      

  2.   


    $.fn.f = function(p) {
        p = $.extend({}, {
            callBack: function() {}
        }, p);
    }//调用
    $('#aa').f({
        callBack: function() {
            ...
        }
    });