0

I'm sure there is a simple answer to this, but I can't see it ;)

Here's the HTML:

<div id="kunden">
<ul class="kunden-logos">
<li><a href="A LINK" target="_blank"><img src="AN IMAGE" border="0" /></a></li>
<li><a href="ANOTHER LINK" target="_blank"><img src="ANOTHER IMAGE" border="0" /></a></li>
</ul>
</div>

And the jQuery:

$("#kunden").click(function() {
$("#kunden").animate({
height: "-=20%"
}, 1500 ).removeClass('open');
$("#kunden").css({
backgroundSize: "15%", backgroundImage: "url('AN IMAGE')"
});
$("#kunden .hide").css({
display: "none", margin: "0"
});     

How do I get the link to open in a new window before firing the jQuery?

EDIT: I need to distinguish between more than one links in the #kunden div!

Thanks in advance for any help!

Richard Tinkler
  • 1,635
  • 3
  • 21
  • 41

2 Answers2

2

You can open the link programmatically using @kristinalim solution.

Simply open the link in your click event function right before your animation. On a side note, jQuery selection is expensive to use repetitively, you can however cache it.

kunden = $("#kunden");
kunden.css({ ... });
Community
  • 1
  • 1
Vin Lim
  • 173
  • 7
0

Try this

$("#kunden").click(function() {
    $("#kunden").animate({
        height: "-=20%"
    }, 1500).removeClass('open');
    $("#kunden").css({
        backgroundSize: "15%", backgroundImage: "url('AN IMAGE')"
    });
    $("#kunden .hide").css({
        display: "none", margin: "0"
    });
});
$('#kunden ul li a').each(function() {
   window.open($(this).attr('href'));
})
Nauphal
  • 6,194
  • 4
  • 27
  • 43