Following on from this question:
Can't I use JQuery inside my FancyZoom popup?
The two answers to that question fixed the problem so that our Hello World
alert fires consistently inside our FancyZoom popup.
However, what we really need to do is not fire off an alert but instead change the src of our img.
Here's what we have:
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/fancyzoom.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$(document).on('click', '#foo', function() { $('#foo').attr('src', 'i/image2.png'); alert('hello world'); });
});
</script>
</head>
<body>
<div id="Container">
<a id="myFancyZoomPopup" href="#Test"><span>test</span></a>
<div id="Test">
<p> this is some text in the popup</p>
<img id="foo" src="i/image1.png" />
</div>
<script type="text/javascript">
$('#myFancyZoomPopup').fancyZoom({ directory: 'i'});
</script>
</div>
</body>
</html>
The "Hello World" is firing but the image source isn't changing from image1.png
to image2.png
.