My jquery code is conflicting with my links, causing them not to open in a new window "target=_blank"?
import java.util.Scanner;
public class Cooling {
public static final double FREEZER_TEMPERATURE = -20;
public static final double K = 0.001;
public static void main(String[] args) {
temperatureTest(70, 0);
temperatureTest(70, 60);
}
public static double temperature(double initialTemperature, int seconds) {
double x = initialTemperature;
int y = seconds;
double dt = (x - FREEZER_TEMPERATURE);
return K*dt*y ;
}
The affected links are onReady:function(){
$('a').click(function(event) {
event.preventDefault();
CookieControl.setConsent(true);
CookieControl.closeAndHide();
window.location = $(this).attr('href');
});
},
答案 0 :(得分:1)
The very first thing your callback does is cancel the event!
forwarding reference
答案 1 :(得分:0)
不是将您的活动与所有<a>
代码绑定,而是将类添加到您希望定位的链接或链接,如下所示:
<a class="lnkSpecial" href="http://www.google.com" target="_blank">Link</a>
然后将您的事件绑定到该类:
$('.lnkSpecial').click(function(event) {
event.preventDefault();
CookieControl.setConsent(true);
CookieControl.closeAndHide();
window.location = $(this).attr('href');
});
这将阻止仅对链接或类别链接的默认操作。