dounai6613 2012-12-03 07:25
浏览 40
已采纳

选择后加载隐藏的选项卡图像

i use idtabs js for make tab in main page .

http://www.sunsean.com/idTabs/

i put each tab 12 images . when page load first load tab div and header and menu images not load first . so 4min waiting to page load complete .

i want in load page first main images load then defult tab load images and when i select other tabs image on tab loaded ???

<div id="tabs" dir="rtl">
<ul class="tabNavigation">
<li><a href="#topdownload" style="font:12px tahoma;">top</a></li>
  <li><a href="#featured" style="font:12px tahoma">more</a></li>
<li><a href="#toprated" style="font:12px tahoma">defult</a></li> 
<li><a href="#latest" style="font:12px tahoma;" >free</a></li>
</ul> 
</div>
  • 写回答

2条回答 默认 最新

  • duanmu6231 2012-12-03 08:26
    关注

    Seems like the plugin you are using is very basic, and doesn't allow ajax requests.

    One solution is to use the load method for externals html files (featured.htm, toprated.html...), but I'm sure there is a better way using ajax request to the server and a preload plugin.

    HTML

    <html>
      <head>
       ...
        <script src="http://cdn.jquerytools.org/1.2.7/full/jquery.tools.min.js"></script>
      </head>
      <body>
        ...
        <!-- tabs -->
        <ul class="css-tabs">
           <li><a href="topdownload.htm">top</a></li>
           <li><a href="featured.htm">more</a></li>
           <li><a class="selected" href="toprated.htm">default</a></li>
           <li><a href="latest.htm">free</a></li>
        </ul>
    
        <!-- single pane. it is always visible -->
        <div class="css-panes">
          <div style="display:block">
            <!-- loaded content here -->
          </div>
        </div>
    

    Jquery

    Now we use ajax to load external pages using load method getting the href of the link element:

    <script>
        $(function() {
           $("ul.css-tabs").tabs("div.css-panes > div", {
                effect: 'fade',
                onBeforeClick: function(event, i) {
                // get the pane to be opened
                var pane = this.getPanes().eq(i);
                    // only load once. remove the if ( ... ){ } clause if
                    // you want the page to be loaded every time
                if (pane.is(":empty")) {
                    // load it with a page specified in the tab's href
                    // attribute
                    pane.load(this.getTabs().eq(i).attr("href"));
                }
                }
            });
        });
    </script>
    

    Demo

    http://jquerytools.org/demos/tabs/ajax-noeffect.htm

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序