亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

jquery - jquey tabs ajax load html conflict problem?
迷茫
迷茫 2017-05-15 16:49:51
0
1
968

The html of tabs load contains js, html, and id. There may be conflicts. How to solve it?

(No ifame is needed. Every time iframe is loaded, it is obviously not as good as load. Even if it is cached, it needs to be initialized a lot. Moreover, it is very difficult to display the dialog inside the iframe outside the iframe. The same dialog will be displayed on multiple pages. This problem occurs)

迷茫
迷茫

業(yè)精于勤,荒于嬉;行成于思,毀于隨。

reply all(1)
過去多啦不再A夢

There are three options:

  1. Use some naming convention to modify the ids into non-conflicting forms. Although this solution seems to be the least in line with the requirements of the subject, I personally recommend it, as it will reduce a lot of trouble in the later stage. If these html are logically on the same interface, then they should have different ids, otherwise you will encounter trouble when writing logic and styles in the future.

  2. Suppose there is an id conflict in just the html of the tab, and there is only one tab displayed at the same time, then you can consider detach the undisplayed tab from the DOM every time you cut the tab, and append it when needed.

  3. Use <iframe src="about:blank"></iframe> 來顯示 html,通過設(shè)置 <iframe>contentWindow.document.body.innerHTML to modify its content. If you still want to be able to display HTML's external styles and scripts well, as well as various dialogs, you can also use various hack methods, but it is still a hack with endless troubles.

P.S. At the request of the topic owner, I will add some hack ideas.

  1. How to make jQuery UI's dialog insert into the specified place by default?

You can override the default options of dialog through the following code, the key one is appendTo this option.

$.extend($.ui.dialog.prototype.options, {
    appendTo: tabNode
});

Set this option every time before loading a tab or after switching tabs, and set it to the currently displayed tab node.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template