2014-08-29 15 views
-2

jQuery的顏色框是工作,但我想將其關閉,當用戶點擊「立即下載」 HTMLjQuery的顏色框關閉「立即下載」點擊

 <script type="text/javascript"> 

    $(document).ready(function() { 
     setTimeout(function(){$('#cboxLoadedContent').show()}, 5000); 
     setTimeout(function(){$('#overlay_full').show()}, 5000); 
    }); 

    function close_pop_up() 
    { 
     $('#cboxLoadedContent').hide('slow'); 
     $('#overlay_full').hide('slow'); 
    } 



     (function() { 
     var sa = document.createElement('script'); sa.type = 'text/javascript'; sa.async = true; 
     sa.src = ('https:' == document.location.protocol ? 'https://cdn' : 'http://cdn') + '.ywxi.net/js/1.js'; 
     var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(sa, s); 
     })(); 
    </script> 

HTML

<a class="download_btn large" href="http://example.com"  title="Download">Download Now <img class="bd_arrow" src="images/btn_arrow.png" /></a> 
         </div> 

回答

1

只是一個click偵聽器添加到將調用已存在的close_pop_up功能的鏈接。

$(document).ready(function() { 
    setTimeout(function(){$('#cboxLoadedContent').show()}, 5000); 
    setTimeout(function(){$('#overlay_full').show()}, 5000); 
    // New code here 
    $('.download_btn').on('click', close_pop_up); 
}); 
+0

它的工作!我很高興有你這樣的人,幫助人跟我一樣:) – bpadgett123 2014-08-29 21:19:53