我normaly創建插件腳本,一個DIV
內具有特定ID
,所以當我婉要清除,只需刪除ID
和SCRIPT
將與他一起去。
在你的情況..
$(document).ready(function(){
$(window).resize(function() {
if ($(window).width() >= 420) {
// Enable the plugin to make the tab functionality...
var tempScript = '<div id="newTempId"><script type="text/javascript" src="../js/plugInScript.js"></script></div>';
$('body').append(tempScript); // append the DIV with the PlugIn script inside
$("#tabs").tabs();
}
else {
// Code needed to completely disable the tab functionality??
$("#tabs").tabs({ disabled: [ 0, 2 ] }); // see API info at http://api.jqueryui.com/tabs/#option-disabled
$('newTempId').remove(); // Remove the DIV that include the script
}
});
});
或/和......包括響應CSS文件,根據窗口大小。
<link href="../css/responsive_style.css" rel="stylesheet" type="text/css" media="screen and (min-width:419px)" />
希望它能幫助,祝你好運
來源
2013-04-08 11:30:41
gmo
嗨, 因此,與您的解決方案,這是否隱藏標籤內容或者只是刪除腳本? - 由於我仍然需要刪除腳本時顯示的內容。 – CodeyMonkey 2013-04-09 06:51:56
在我的示例中,將從'DOM'中刪除'#newTempId' div中的所有內容,只有腳本和他的功能。 (除非你把標籤內容放在裏面)。如果您想給我們一個實例,我們可以嘗試根據您的需求進行調整。 – gmo 2013-04-09 10:59:02