![]() |
PLZ HELP :/ setTimeOut function
Hello dear codingforum members. im newbie in JS so i really ur need help. here is my question. Im working on simple modal project which is developed by eric martin. As it can be seen in the codes. it calls the modal screen when user clicks on demo link or button. however instead of clicking i would like to call tht modal screen automatically after certain time like 20sec later. so can i actually apply setTimeOut in tht JS code ? Thank u !!!
Regards HTML <div id='content'> <div id='basic-modal'> <input type='button' name='basic' value='DEMO' class='basic'/> <a href='#' class='basic'>DEMO</a> </div> <!-- modal content --> <div id="basic-modal-content"> <a href='asdasdasd'><img src="https:/asdasd.jpg" alt="asdasd"></a> </div> <div style='display:none'> </div> </div> </div> JS CODE: jQuery(function ($) { // Load dialog on page load //$('#basic-modal-content').modal(); // Load dialog on click $('#basic-modal .basic').click(function (e) { $('#basic-modal-content').modal(); return false; }); }); |
try this -
Code:
// delay in milli seconds |
A better alternative would be:
Code:
setTimeout(function() {$('#basic-modal-content').modal();}, 20000);2. You don't need to simulate the click, you just need to call the code that the click calls. |
| All times are GMT +1. The time now is 02:17 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.