Reputation: 25
I have a code that hides multiple div's with a sliding action with one click on a text link. I need to add an open.window to the text link also, that will open a url in another window after a few seconds delay.
So with one click I want to hide a group of div's, and open a url in another window after a short delay, so that the sliding action can be seen before the url is opened.
I have this code that works to hide the div's with sliding action ...
$("#hide-content").click(function () {
$(".otherContainers").hide('slide',{direction: "right"}, 1000);
});
And this for the text link ....
<div id="hide-content"><a href="#" class="showHideContent" style="text-decoration:none" onclick="window.open('http://google.com')">hide and visit</a>
</div>
I've tried adding a delay with this but it's not working ...
onclick="setTimeout('window.open(\'http://google.com');'5000;"
Any ideas? Thanks!
Here's a Fiddle http://jsfiddle.net/eeyipes/Jf6wM/13/
Upvotes: 2
Views: 14609
Reputation: 781129
Your parenthese and quotes aren't balanced. Try:
onclick="setTimeout('window.open(\'http://google.com\')', 5000);"
Upvotes: 4