【发布时间】:2019-07-26 08:44:11
【问题描述】:
以下脚本运行良好。只是,现在我想添加更多按钮 和更多 ul 类。该脚本仅适用于一个按钮和一个 ul 类。
我已经尝试了很多东西,但现在我需要帮助。请看下图:
<body>
<header>
Testing
</header>
<input type="button" value="Open 1" id="openOne" />
<input type="button" value="Open 2" id="openTwo" />
<ul class="imageDataOne clearfix">
<li><a href="images/img-part-1-1.jpg" data-background-color="#000000"></a></li>
<li><a href="images/img-part-1-2.jpg" data-background-color="#000000"></a></li>
</ul>
<ul class="imageDataTwo clearfix">
<li><a href="images/img-part-2-1.jpg" data-background-color="#000000"></a></li>
<li><a href="images/img-part-2-2.jpg" data-background-color="#000000"></a></li>
</ul>
<script type="text/javascript">
$(document).ready(function() {
// v Here is the problem
$('.imageDataOne a').apImageFullscreen({
imageZoom:{},
});
$('#openOne').click(function() {
$('.imageDataOne a:first')
.apImageFullscreen('option', 'enableScreenfull', $('#use-fullscreen').is(':checked'))
.apImageFullscreen('open', 0);
});
$('#openTwo').click(function() {
$('.imageDataTwo a:first')
.apImageFullscreen('option', 'enableScreenfull', $('#use-fullscreen').is(':checked'))
.apImageFullscreen('open', 0);
});
});
</script>
</body>
【问题讨论】:
-
请详细解释您要做什么。也把截图中的完整代码示例放在这里,或者放在jsfiddle上方便我们理解和解决
-
Sinisa Bobic,感谢您的建议。我正在尽我所能解释人们如何提供帮助。
-
请阅读“How to Ask”指南。由于您的问题不清楚,因此在您的代码图像中发布其他或澄清问题是没有帮助的。以后请记住,我们需要您的代表 ("minimal reproducible example") 在您的问题中 编码,而不是作为外部资源。
-
很抱歉给您带来不便,学习java以及如何提出一个好问题。感谢您的链接!
标签: javascript jquery element var