Better alternative to an iframe?

前端 未结 8 1609
臣服心动
臣服心动 2020-12-05 03:20

I have a page with an iframe to feature the contents of the clicked tab. There are 3 tabs and 1 iframe. The sources of the contents relating to each tab clicked are formatte

8条回答
  •  天命终不由人
    2020-12-05 03:42

    Another alternative is to use AJAX to load the content of a tab and use a div to display the content. I would suggest that using an existing Tab library might be an option rather than trying to solve all the problems associated with creating tabs.

    Maybe the jQuery UI Tab might be helpful here if you like to try it.


    EDIT: AJAX example with UI Tabs.

    First, the HTML will look like this.

       
    

    Then make sure that you import the appropriate jQuery files:

      
      
      
      etc...
    

    Then add the code to create the tabs:

       
    

提交回复
热议问题