Fancybox iframe galéria otvorenie

Programovacie jazyky, rady, poradňa...
Pades
Light Expert
Light Expert
Príspevky: 77
Registrovaný: 03 aug 2008, 10:51

Fancybox iframe galéria otvorenie

Príspevok od používateľa Pades »

Ahojte, mám stránku do nej vkladám iframe, v tom iframe je galéria s obrázkami a chcem aby sa otvorenie fancyboxu otvorilo na hlavnej stránke a nie v tom iframe. Skúšal som už niečo, funguje to otváranie ale neni to ako galéria s preklikávaním dalšej fotky, trebalo by to prerobiť ale neviem ako. Napadá vás niečo? Ďakujem

index.html

Kód: Vybrať všetko

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta http-equiv="imagetoolbar" content="no" />
	<title>FancyBox 1.3.4 | Demonstration</title>
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
	<script>
		!window.jQuery && document.write('<script src="jquery-1.4.3.min.js"><\/script>');
	</script>
	<script type="text/javascript" src="./fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
	<script type="text/javascript" src="./fancybox/jquery.fancybox-1.3.4.pack.js"></script>
	<link rel="stylesheet" type="text/css" href="./fancybox/jquery.fancybox-1.3.4.css" media="screen" />
 	<link rel="stylesheet" href="style.css" />
	
	<script type="text/javascript">
		function readyFancy(){
			$("a#sample").trigger("click");
		}
		function callMe(site){ 
			$("#sample").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'href'				: ''+site+'',
				'autoScale'			 : true,
				'onStart'			: function(){$("body").css({'overflow':'hidden'});},
				'onClosed'			: function(){$("body").css({"overflow":"visible"});}
			});
		readyFancy();
		}
	</script>
	
</head>
<body style="padding: 20px;">
<a href="#" id="sample"></a> <!-- here we set a decoy link for the frame to be triggered-->
<p>Below is an iframe</p>
<iframe src="sample.html" width="300" height="200"> <!--the link of the iframe-->
</body>
</html>
sample.html (iframe)

Kód: Vybrať všetko

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body >
<div>
<a onClick="parent.callMe('http://localhost/fan/1_b.jpg');" style="" href="#" ><img src="1_s.jpg"></a>
<a onClick="parent.callMe('http://localhost/fan/2_b.jpg');" style="" href="#" ><img src="2_s.jpg"></a>
</div>
</body>
</html>
Everhard
Light Expert
Light Expert
Príspevky: 79
Registrovaný: 25 dec 2010, 14:41

Re: Fancybox iframe galéria otvorenie

Príspevok od používateľa Everhard »

stacil mi Google a 2minuty: fancybox iframe problem target
http://stackoverflow.com/questions/8853 ... 10#8855410
Ktory odkazuje na demo na http://www.picssel.com/playground/jquer ... Jan12.html

trik je v tom ze namiseto $.fancybox napises parent.$.fancybox
Napísať odpoveď