[BNM] jQuery, open a link with a delay

Ali ali at nubz.com
Tue Jul 21 12:53:38 BST 2009


just a thought but maybe try passing event to the function seems like FF3 is 
not preventing default

$("a[rel='internal']").click(
function (event)
{
var thehref = this.href;
event.preventDefault();
$("#alertbox").fadeOut(3000,function(){
open(thehref,'_self'); return false;
});
}
);


ALi

----- Original Message ----- 
From: "JOHN COOPER" <John.Cooper at atomicshed.com>
To: "Brighton New Media" <bnmlist at brightonnewmedia.org>
Sent: Tuesday, July 21, 2009 12:34 PM
Subject: Re: [BNM] jQuery, open a link with a delay


> sorry,
> here's the code i'm using at the moment
>
> /* add [internal] to any href link with rel='internal'*/
> $("a[rel='internal']")
> .attr({
> title: 'Opens _top a delay'
> }).append(' [internal]');
>
> /* delay the internal links by 3 seconds - fade out the alertbox */
> $("a[rel='internal']").click(
> function ()
> {
> var thehref = this.href;
> event.preventDefault();
> $("#alertbox").fadeOut(3000,function(){
> open(thehref,'_self'); return false;
> });
> }
> );
>
>
> On 21 Jul 2009, at 12:25, JOHN COOPER wrote:
>
>> Hi all
>>
>> noobie jQuery question
>> how can i do the following
>> on clicking an A link open the destination URL  in the primary window
>> but with a delay (fadeout an alertbox)?
>> heres the gubbin's that kinda works in safari (fades the alertbox, the
>> link is opened in a new window)
>> and fails to works in firefox 3 (doesn't fade the alertbox, goes
>> straight to the URL in the primary browser) = both on Mac
>>
>> <a href="index.html" rel='internal'>a delayed link</a>
>>
>> $("a[rel='internal']")
>> .attr({
>> target: "_top",
>> title: "Opens with a delay"
>> }).append(' [x]');
>>
>> $("a[rel='internal']").click(
>> function ()
>> {
>> var thehref = this.href;
>> event.preventDefault();
>> $("#alertbox").fadeOut(3000,function(){
>> open(thehref);
>> });
>> }
>> );
>>
>>
>>
>> John Cooper
>>
>> john at atomicshed.com
>>
>> www.atomicshed.com
>> blog.atomicshed.com
>>
>> ATOMICSHED on the web... twitter, del.icious, flickr,
>> skype ...everywhere
>> KAPOW.ME limited edition prints'n stuff
>>
>>
>>
>>
>> --
>>
>> BNM Subscribe/Unsubscribe:
>> http://www.brightonnewmedia.org/options/bnmlist
>>
>> BNM powered by Wessex Networks:
>> http://www.wessexnetworks.com
>
>
>
>
> John Cooper
>
> john at atomicshed.com
>
> www.atomicshed.com
> blog.atomicshed.com
>
> ATOMICSHED on the web... twitter, del.icious, flickr,
> skype ...everywhere
> KAPOW.ME limited edition prints'n stuff
>
>
>
>
> -- 
>
> BNM Subscribe/Unsubscribe:
> http://www.brightonnewmedia.org/options/bnmlist
>
> BNM powered by Wessex Networks:
> http://www.wessexnetworks.com 



More information about the BNMlist mailing list. Powered by Wessex Networks