2013-05-03 98 views
0

我有文件index.js這裏面的功能:在調用顯示()外部函數

$('#menu_aEmpresa').on('click', function(){ 
    $('#aEmpresa_mainContent').show(); 
    $('#aNossaArte_mainContent').hide(); 
    $('#contactos_mainContent').hide(); 
    }); 

...而這一次在文件aEmpresa_intro.js:

function aEmpresa_Opening_run(){ 
    $.when(aEmpresa_horizontalBrackets_01(), aEmpresa_horizontalBrackets_02(), aEmpresa_horizontalBrackets_03(), aEmpresa_horizontalBrackets_04()).done(function(){ 
     $.when(aEmpresa_horizontalBrackets_05(), aEmpresa_horizontalBrackets_06(), aEmpresa_horizontalBrackets_07(), aEmpresa_horizontalBrackets_08()).done(function(){ 
     $.when(aEmpresa_textBox()).done(function(){ 
      $.when(aEmpresa_textBoxBtns_01(), aEmpresa_textBoxBtns_02()).done(function(){ 
      $.when(aEmpresa_photoBox(), aEmpresa_facebook()).done(function(){ 
       aEmpresa_photoBoxBtns_01(); aEmpresa_photoBoxBtns_02(); 
      }); 
      }); 
     }); 
     }); 
    }); 
    } 

的HTML腳本鏈接:

<!-- A Empresa scripts --> 
    <script type="text/javascript" src="js/aEmpresa_intro.js"></script> 
    <script type="text/javascript" src="js/aEmpresa_exit.js"></script> 
    <script type="text/javascript" src="js/aEmpresa.js"></script> 
<!-- Index scripts --> 
    <script type="text/javascript" src="js/index_intro.js"></script> 
    <script type="text/javascript" src="js/index.js"></script> 
    <script type="text/javascript" src="js/index_infobox_pt.js"></script> 

基本上,函數aEmpresa_Opening_run()是前奏開口瓦特如果顯示#aEmpresa_mainContent

show()發生時如何調用介紹函數?

感謝名單

佩德羅

回答

0

使用完整的事件,這裏是文檔:.show()

$('#menu_aEmpresa').on('click', function(){ 
    $('#aEmpresa_mainContent').show(function(){ 
     aEmpresa_Opening_run(); 
    }); 
    $('#aNossaArte_mainContent').hide('rocksMenu_pt.html'); 
    $('#contactos_mainContent').hide('contactos_pt.html'); 
}); 
+0

謝謝你的快速反應。我收到一個ReferenceError:aEmpresa_Opening_run沒有被定義 - aEmpresa_Opening_run();因爲aEmpresa_Opening_run()位於另一個文件中。我該如何解決? – Pedro 2013-05-03 11:27:21

+0

@Pedro在使用$('#menu_aEmpresa')。on(.. action。 – 2013-05-03 11:29:11

+0

之前,您必須包含JS文件和aEmpresa_Opening_run()函數。我所有的js文件都鏈接到html文件中。在index.js文件中? – Pedro 2013-05-03 11:38:33