0
我試圖在Pinax項目(Django)的頁面上放置選項卡式界面。但是,該網頁的其他元素已經導入了JavaScript和CSS,這可能會搞亂我的標籤頁。jquery選項卡CSS衝突
這裏是我的網頁的頭:
<meta charset="utf-8" />
<title>{% block head_title_base %}{% if SITE_NAME %}{{ SITE_NAME }} : {% endif %}{% block head_title %}{% endblock %}{% endblock %}</title>
<!-- HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link rel="shortcut icon" href="{{ STATIC_URL }}img/favicon.ico" />
<link rel="stylesheet" href="{{ STATIC_URL }}css/bootstrap.min.css"/>
<link rel="stylesheet" href="{{ STATIC_URL }}css/extra.css"/>
<link href="{{ STATIC_URL }}css/ui-darkness/jquery-ui-1.8.16.custom.css" rel="stylesheet" />
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="{{ STATIC_URL }}js/jquery-1.7.min.js"></script>
<script src="{{ STATIC_URL }}js/jquery-ui-1.8.16.custom.min.js"></script>
<script src="{{ STATIC_URL }}js/jquery.form.js"></script>
<script src="{{ STATIC_URL }}js/bootstrap-alerts.js"></script>
<script src="{{ STATIC_URL }}js/bootstrap-twipsy.js"></script>
<script src="{{ STATIC_URL }}js/bootstrap-popover.js"></script>
<script src="{{ STATIC_URL }}js/bootstrap-dropdown.js"></script>
<script src="{{ STATIC_URL }}js/bootstrap-tabs.js"></script>
<script src="{{ STATIC_URL }}js/bootstrap-scrollspy.js"></script>
<script src="{{ STATIC_URL }}js/bootstrap-buttons.js"></script>
<script src="{{ STATIC_URL }}js/theme.js"></script>
<script src="{{ STATIC_URL }}js/pinax.modal.js"></script>
我創建的標籤就像網站 -
在這裏的jQuery的例子中,生成的HTML:
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8" />
<title>Text Analytics Workbench : Welcome</title>
<!-- HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link rel="shortcut icon" href="/site_media/static/img/favicon.ico" />
<link rel="stylesheet" href="/site_media/static/css/bootstrap.min.css"/>
<link rel="stylesheet" href="/site_media/static/css/extra.css"/>
<link href="/site_media/static/css/ui-darkness/jquery-ui-1.8.16.custom.css" rel="stylesheet" />
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="/site_media/static/js/jquery-1.7.min.js"></script>
<script src="/site_media/static/js/jquery-ui-1.8.16.custom.min.js"></script>
<script src="/site_media/static/js/jquery.form.js"></script>
<script src="/site_media/static/js/bootstrap-alerts.js"></script>
<script src="/site_media/static/js/bootstrap-twipsy.js"></script>
<script src="/site_media/static/js/bootstrap-popover.js"></script>
<script src="/site_media/static/js/bootstrap-dropdown.js"></script>
<script src="/site_media/static/js/bootstrap-tabs.js"></script>
<script src="/site_media/static/js/bootstrap-scrollspy.js"></script>
<script src="/site_media/static/js/bootstrap-buttons.js"></script>
<script src="/site_media/static/js/theme.js"></script>
<script src="/site_media/static/js/pinax.modal.js"></script>
<script type="text/javascript">
/* $(document).ready(function() {
$("#tabs").tabs();
});*/
</script>
</head>
<body class="home" id="">
<div class="topbar">
<div class="fill">
<div class="container">
<h3><a href="/">Text Analytics Workbench</a></h3>
<ul><li id="tab_profile"><a href="/profiles/profile/fccoelho/">Profile</a></li><li id="tab_notices"><a href="/notices/">Notices</a></li></ul>
<ul class="secondary-nav">
<li>
<a href="#" class="menu">fccoelho</a>
<ul class="menu-dropdown">
<li><a href="/account/email/">Account</a></li>
<li><a href="/admin/">Admin</a></li>
<li class="divider"></li>
<li><a href="/account/logout/">Logout</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<div class="container">
<div class="hero-unit">
<div id="tabs">
<ul>
<li><a href="#tabs-1">Search</a></li>
<li><a href="#tabs-2">Document View</a></li>
<li><a href="#tabs-3">Corpus View</a></li>
</ul>
<div id="tabs-1">
<p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>
</div>
<div id="tabs-2">
<p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.</p>
</div>
<div id="tabs-3">
<p>Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.</p>
<p>Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.</p>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$("#tabs").tabs();
});
</script>
</div>
<div class="row">
<div class="span4">
<h2>Heading</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed sed viverra dui. Aenean blandit faucibus tincidunt. Phasellus fermentum elit ut erat varius cursus. Nunc posuere mauris sit amet enim congue quis elementum lectus tincidunt. Cras vel tempus metus.</p>
<p><a class="btn" href="#">View details »</a></p>
</div>
<div class="span4">
<h2>Heading</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed sed viverra dui. Aenean blandit faucibus tincidunt. Phasellus fermentum elit ut erat varius cursus. Nunc posuere mauris sit amet enim congue quis elementum lectus tincidunt. Cras vel tempus metus.</p>
<p><a class="btn" href="#">View details »</a></p>
</div>
<div class="span4">
<h2>Heading</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed sed viverra dui. Aenean blandit faucibus tincidunt. Phasellus fermentum elit ut erat varius cursus. Nunc posuere mauris sit amet enim congue quis elementum lectus tincidunt. Cras vel tempus metus.</p>
<p><a class="btn" href="#">View details »</a></p>
</div>
<div class="span4">
<h2>Heading</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed sed viverra dui. Aenean blandit faucibus tincidunt. Phasellus fermentum elit ut erat varius cursus. Nunc posuere mauris sit amet enim congue quis elementum lectus tincidunt. Cras vel tempus metus.</p>
<p><a class="btn" href="#">View details »</a></p>
</div>
</div>
</div>
<div id="footer">
<div class="inner">
<div class="container">
© 2011 Leximath
</div>
</div>
</div>
</body>
</html>
你能包括實際生成的HTML和所有其他相關的JS和CSS?否則,通過閱讀包含在您的頁面中的文件列表將很難/不可能知道發生了什麼。另外,你有沒有考慮過使用[Bootstrap的標籤插件](http://twitter.github.com/bootstrap/javascript.html#tabs)呢? – 2012-03-04 03:24:04
您可能需要瀏覽包含的bootstrap css並找到違規的樣式。另外,如果你不使用bootstraps標籤,爲什麼你要包含他們相應的js?你有沒有嘗試檢查標籤元素,看看哪個CSS重寫正確的jQuery的CSS? – sinemetu1 2012-03-04 06:38:45
爲什麼不使用引導標籤? http://twitter.github.com/bootstrap/components.html#navs – jpic 2012-03-04 09:59:49