更新时间:2023-11-21 11:26:22
这里有两个问题.我认为主要是用来访问该书点击的选择器,而且它的文本似乎也没有以任何方式链接到书库项目.
There are a couple of problems going on here. I think the main being the selectors you are using to access the click on the book and also its text doesn't appear to be linked to the book gallery item in any way.
我已经在此处
基本更改为 HTML :
<dl class="gallery" rel="one">
在每本书的dl
上添加rel="blahh"
,这将对应于文本div
Add a rel="blahh"
to the dl
of each book, this will correspond to the text div
<div class="bkcontent" id="one">
在包含书籍文字的div
中添加id="blah"
Add an id="blah"
to the div
that contains the text for the book
jQuery 的更改:
$("#bookimggallery dt").click(function() {
$(".bkcontent").hide();
var textid = $(this).parent('dl').attr('rel');
$('#'+textid).slideToggle(500);
});
id="bookimggallery"
div
中的所有dt
.
rel="blah"
获取 id ,然后对其进行滑动切换.
dt
's within the div
with the id="bookimggallery"
rel="blah"
, then slideToggles it.
在没有完全重新布置代码布局的情况下,这就是我要这样做的方式.
Without completely rearranging your code layout this is how I would do this.