开发者

What do I do if I can't use an id more than once to call a function?

开发者 https://www.devze.com 2023-04-05 09:58 出处:网络
I tried asking this before but I don\'t think I was as clear as I should have been.Sorry for the repeat, but I am new to this and just trying to figure it out.I am trying to call a function with the s

I tried asking this before but I don't think I was as clear as I should have been. Sorry for the repeat, but I am new to this and just trying to figure it out. I am trying to call a function with the same id multiple times. I am guessing this can't be done, so what do I need to do instead. I have the noConflict in because I am using other jquery versions on the page. The scrollmenu references one of those other ones. You will see all this if you you at the page I am working on. http://www.mac-av.com/test2/

$.noConflict();
jQuery(document).ready(function($) 
{
    $("#scrollmenu");


$("#e_emd").click(function () {
$("#e_em").show();
$("#e_v").delay(1200).fadeOut("slow");
$("#e_s").delay(1200).fadeOut("slow");  
$("#e_l").delay(1200).fadeOut("slow");  
});

$("#e_vd").click(function () {
$("#e_em").delay(1200).fadeOut("slow");
$("#e_v").show();
$("#e_s").delay(1200).fadeOut("slow");  
$("#e_l").delay(1200).fadeOut("slow");  
});  

$("#e_sd").click(function () {
$("#e_em").delay(1200).fadeOut("slow");
$("#e_v").delay(1200).fadeOut("slow");
$("#e_s").show(); 
$("#e_l").delay(1200).fadeOut("slow");  
});  

$("#e_ld").click(function () {
$("#e_em").delay(1200).fadeOut("slow");
$("#e_v").delay(1200).fadeOut("slow");
$("#e_s").delay(1200).fadeOut("slow");  
$("#e_l").show();
});  


});  
<div id="scrollmenua">| 
<a id="e_emd" href="#Event_Management" class="panel">Event Management</a> | 
<a id="e_vd" href="#Video" class="panel">Video</a> | 
<a id="e_sd" href="#Sound" class="panel">Sound</a> | 
<a id="e_ld" href="#Lighting" class="panel">Lighting & Staging</a> | 
</div>

<div id="scrollmenub">| 
<a id="e_emd" href="#Event_Management" class="panel">Event Management</a> | 
<a id="e_vd" href="#Video" class="panel">Video</a> | 
<a id="e_sd" href="#Sound" class="panel">Sound</a> | 
<a id="e_ld" href="#Lighting" class="panel">Lighting & Staging</a> | 
</div>

<div id="scrollmenub">| 
<a id="e_emd" href="#Event_Management" class="panel">Event Management</a> | 
    <a id="e_vd" href="#Video" class="panel">Video</a> | 
<a id="e_sd" href="#Sound" class="panel">Sound</a> | 
<a id="e_ld" href="#Lighting" class="panel">Lighting & Staging</a> | 
</div>

<div id="scrollmenub">| 
<a id="e_emd" href="#Event_Management" class="panel">Event Management</a> | 
<a id="e_vd" href="#Video" class="panel">Video</a> | 
<a id="e_sd" href="#Sound" class="panel">Sound</a> | 
<a id="e_ld" href="#Lighting" class="panel">Lighting & Staging</a> | 

</div>

<div><img id="e_em" src="images/event开发者_如何学Cmanage.png" width="1037" height="480" /></div>
<div><img id="e_v" src="images/video.png" width="1128" height="480" /></div>
<div><img id="e_s" src="images/sound.png" width="1011" height="480" /></div>
<div><img id="e_l" src="images/light.png" width="1011" height="480" /></div>


$('#other').click(function() {
  $('#target').click();
});

http://api.jquery.com/click/

just have all those other click function call the first one or assign them all a class

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号