此代码正在努力打开图像点击的香草盒,但我需要实现此代码按钮单击..我尝试使用click()方法,但它不起作用..
$(document).ready(function() {
$('#test').click(function(){
$('#grouped-image-list a').vanillabox();
});
});
上面的代码将test定义为按钮id ..请检查下面的html
<button id="test" name="test" value="Click1">click1</button>
<div class="double-column">
<div class="column1">
<ul id="grouped-image-list" class="link-list">
<li><a href="HD_Wallpaper/App-screen-1.png" title="Main Screen"><img src="HD_Wallpaper/App-screen-1.png" border="0" width="300" height="300"/></a></li>
<li><a href="HD_Wallpaper/App-screen-2.png" title="Screen2"><img src="HD_Wallpaper/App-screen-2.png" border="0" width="300" height="300"/></a></li>
<li><a href="HD_Wallpaper/App-screen-3.png" title="Screen3"><img src="HD_Wallpaper/App-screen-3.png" border="0" width="300" height="300"/></a></li>
</ul>
</div>
答案 0 :(得分:2)
尝试下面
$(document).ready(function() {
$('#grouped-image-list a').vanillabox();
$('#test').click(function(){
$('#grouped-image-list').find('a:first').trigger('click');
});
});
确保你添加了css&amp;香草盒的js。