2012-03-29 7 views
1

Ich benutze Javascript in einem iframe, das sich auf der Startseite meiner Website befindet. Es gibt eine Folie-Funktion, so dass, wenn ein Benutzer ein Bild schiebt, es einen Link zu einer anderen Seite öffnet, aber im Moment öffnet es den Link innerhalb des iframe, so dass es wirklich lustig aussieht.Javascript Funktion zum Öffnen einer URL auf der Hauptseite oder im neuen Fenster

Dies ist js Code im atm mit:

var unlock = function() 
{ 
    //$("#gfx").animate({backgroundPosition: '0 40'}, 400, '', function() 
    //{ 
     $("#gfx-bottom").animate({bottom: -100}, 300); 
     $("#gfx-top").animate({top: -100}, 300, '', function() 
     {});  
     $("#iphone-inside").fadeOut("normal", function(){window.location="http://www.urlimtryingtolinkto.com";});         
    //}); 

Antwort

1

Verwendung window.top.

var unlock = function() 
{ 
    //$("#gfx").animate({backgroundPosition: '0 40'}, 400, '', function() 
    //{ 
     $("#gfx-bottom").animate({bottom: -100}, 300); 
     $("#gfx-top").animate({top: -100}, 300, '', function() 
     {});  
     $("#iphone-inside").fadeOut("normal", function(){window.top.location="http://www.urlimtryingtolinkto.com";});         
//}); 
+0

die bestmöglich nutzen. Danke nochmal an alle. –

+0

@FizRaqim Mein Freund, akzeptiere diese Antwort, wenn es für dich funktioniert hat. Nur zu sagen "Du bist der Beste" ist nicht genug :-) –

1

Für ein neues Fenster, Sie window.open()

var unlock = function() 
{ 
    //$("#gfx").animate({backgroundPosition: '0 40'}, 400, '', function() 
    //{ 
     $("#gfx-bottom").animate({bottom: -100}, 300); 
     $("#gfx-top").animate({top: -100}, 300, '', function() 
     {});  
     $("#iphone-inside").fadeOut("normal", function(){window.open("http://www.urlimtryingtolinkto.com");});         
    //}); 
+0

genial einfach genial. –

+0

@FizRaqim Mein Freund, Akzeptieren Sie diese Antwort, wenn es für Sie funktioniert. Nur zu sagen "Du bist der Beste" ist nicht genug :-) –

Verwandte Themen