-1
<a href="javascript:void(0)" data-url="http://google.com" class="red">

基本上,一旦用户单击它,就会出现一个带有计时器的灯箱,然后使用 data-url 进入 url。那可能吗?


你也将如何结合这些,

 jQuery(document).ready(function(){

var link = document.getElementsByTagName("a")[0];

    link.onclick = function(){
       $('.lightbox').show();
        setTimeout(function(){window.location.href = link.getAttribute("data-url")}, 1000)
    }

});

$(function(){
  var count = 10;
  countdown = setInterval(function(){
    $("p.countdown").html(count + " seconds remaining!");
    if (count == 0) {
      window.location = 'http://google.com';
    }
    count--;
  }, 1000);
});
4

1 回答 1

0

非常简单的示例,应该可以帮助您入门。

var link = document.getElementsByTagName("a")[0];

    link.onclick = function(){
        // make the modal popup here.
        alert("imma let you finish but first imma take you to a new webapge in 1 second");

        // after the setTimeout go to a new page
        setTimeout(function(){window.location.href = link.getAttribute("data-url")}, 1000)
    }
​

现场演示

(注意,由于 jsFiddle,live demo 实际上不会转发)

于 2012-06-20T16:04:25.377 回答