我如何初始化一个AJAX加载标签一个jQuery功能?初始化、加载、标签、功能

2023-09-10 20:40:30 作者:伤孤寂

我有我的AJAX加载标签正常工作,这是code:

I have my AJAX loaded tabs working correctly and this is the code:

<div id="tabs">
  <ul>
    <li><a href="../about-leadership-admin-ajax/">Leadership / Admin</a></li>
    <li><a href="../about-sales-marketing-ajax/">Sales & Marketing</a></li>
    <li><a href="../about-service-desk-technicians-ajax/">Service Desk Technicians</a></li>
    <li><a href="../about-technology-consultants-ajax/">Technology Consultants</a></li>
    <li><a href="../about-manufacturing-consultants-ajax/">Manufacturing Consultants</a></li>
    <li><a href="../about-salesforce-cpm-consultants-ajax/">Salesforce/CPM Consultants</a></li>
    <li><a href="../about-developers-ajax/">Developers</a></li>
  </ul>
</div>

和我动初始化脚本:

<script>
  jQuery(function() {
    jQuery( "#tabs" ).tabs().addClass( "ui-tabs-vertical ui-helper-clearfix" );
    jQuery( "#tabs li" ).removeClass( "ui-corner-top" ).addClass( "ui-corner-left" );

    jQuery( "#tabs" ).tabs({
      beforeLoad: function( event, ui ) {
        ui.jqXHR.error(function() {
          ui.panel.html(
            "Couldn't load this tab. We'll try to fix this as soon as possible." );
        });
      }
    });
  });
</script>

我对标签中的每一个jQuery的滑块。只有第一个(在加载的第一个选项卡)正常工作,直到我浏览到一个新的。当我回来的第一个选项卡中的滑块都搞砸了。初始化脚本,我需要让每个AJAX加载标签是:

I have a jQuery slider on each one of the tabs. Only the first one (in the first tab that is loaded) works correctly until I navigate to a new one. When I come back to the first tab the slider is all screwed up. The initialization script I need to have on each AJAX loaded tab is:

<script>
jQuery(document).ready(function(){
jQuery('#horiz_container_outer').horizontalScroll();
});
</script>

我知道(文件)。就绪不起作用。我需要知道在哪里,并在我的标签初始化脚本放在什么来完成这项工作。

I know (document).ready does not work. I need to know where and what to place in my tabs initialization script to make this work.

我知道我需要使用jQuery的几个功能之一,但我不知道用在哪里。我的选择看起来像.load(),.bind(),.success()。

I know I need to use one of several functions in jQuery but I have no idea what to use and where. My options look like .load(), .bind(), .success().

我喜欢它,如果有人可以点我在正确的方向和具体。提前致谢。我也愿意为一个解决方案:)

I would love it if someone could point me in the right direction and be specific. Thanks in advance. I am also willing to pay for a solution:)

推荐答案

尝试使用激活事件

jQuery( "#tabs" ).tabs({
  beforeLoad: function( event, ui ) {
    ui.jqXHR.error(function() {
      ui.panel.html(
        "Couldn't load this tab. We'll try to fix this as soon as possible." );
    });
  }
  activate: function( event, ui ) {
    jQuery('#horiz_container_outer').horizontalScroll();
  }
});