我找到了我的具體問題,找不到它......我希望你們中的任何人都可以提供幫助。:nth-child在IE中不工作
我試圖讓nth孩子在IE中工作 - 現在我讀了,你可以用JQuery來做到這一點,我如何在這種情況下實現jQuery?
林也是用這個庫項目ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js
它完全在Firefox而不是IE瀏覽器 - 請幫助 - 謝謝
<div class="info-col">
<h2>Header 1</h2>
<a class="imagehref="imagepath">View Image</a>
<dl>
<dt>Sub header 1</dt>
<dd>Copy 1.</dd>
<dt>Sub header 2</dt>
<dd>Copy2</dd>
<dt>Sub header 3</dt>
<dd>Copy 3</dd>
<dt>Sub header 4</dt>
<dd>Copy 4</dd>
<dt>Sub header 5</dt>
<dd>Copy 5</dd>
<dt>Sub header 6</dt>
<dd>Copy 6</dd>
</dl>
</div>
Javascript代碼
$(function() {
// Set up variables
var $el, $parentWrap, $otherWrap,
$allTitles = $("dt").css({
padding: 5, // setting the padding here prevents a weird situation, where it would start animating at 0 padding instead of 5
"cursor": "pointer" // make it seem clickable
}),
$allCells = $("dd").css({
position: "relative",
top: -1,
left: 0,
display: "none" // info cells are just kicked off the page with CSS (for accessibility)
});
// clicking image of inactive column just opens column, doesn't go to link
$("#page-wrap").delegate("a.image","click", function(e) {
if (!$(this).parent().hasClass("curCol")) {
e.preventDefault();
$(this).next().find('dt:first').click();
}
});
// clicking on titles does stuff
$("#page-wrap").delegate("dt", "click", function() {
// cache this, as always, is good form
$el = $(this);
// if this is already the active cell, don't do anything
if (!$el.hasClass("current")) {
$parentWrap = $el.parent().parent();
$otherWraps = $(".info-col").not($parentWrap);
// remove current cell from selection of all cells
$allTitles = $("dt").not(this);
// close all info cells
$allCells.slideUp();
// return all titles (except current one) to normal size
$allTitles.animate({
fontSize: "14px",
paddingTop: 5,
paddingRight: 5,
paddingBottom: 5,
paddingLeft: 5
});
// animate current title to larger size
$el.animate({
"font-size": "20px",
paddingTop: 10,
paddingRight: 5,
paddingBottom: 0,
paddingLeft: 10
}).next().slideDown();
// make the current column the large size
$parentWrap.animate({
width: 320
}).addClass("curCol");
// make other columns the small size
$otherWraps.animate({
width: 140
}).removeClass("curCol");
// make sure the correct column is current
$allTitles.removeClass("current");
$el.addClass("current");
}
});
$("#starter").trigger("click");
});
在你鏈接到的js中沒有提到'nnth-child';你是否試圖在JavaScript/jQuery本身或css中使用它? – 2010-10-17 00:13:43
您只發布了HTML。請發佈代表您遇到的問題的JavaScript代碼。 – user113716 2010-10-17 00:27:48
應該標記JavaScript不是java。 – 2010-10-17 00:30:37