<body>
<div id="trophy"><img class="img-responsive" src="media/image.png"></div>
<input id="target" type="button" />
<iframe style="border:0px;border-radius:10px" width="100%" height="100%" src="game/index.html">
<p>MY GAME CANVAS HERE</p>
</iframe>
<script>
// Collection animation
$('#target').click(function () {
moveChatWindow('righttop');
});
var chatWindow = $('#trophy');
var chatWidth = chatWindow.width();
var chatHeight = chatWindow.height();
var windowWidth = $(window).width();
var windowHeight = $(window).height();
$(window).resize(function () {
windowWidth = $(window).width();
windowHeight = $(window).height();
moveChatWindow(chatWindow.data('currentPosition'));
});
function moveChatWindow(moveTo) {
chatWindow.data('currentPosition', moveTo);
if (moveTo === 'righttop') {
chatWindow.stop().animate({
bottom: windowHeight - chatHeight
, right: 0
}, 2500);
$('#trophy').css('opacity', '1');
$('#trophy').fadeOut(300);
$('#trophy').css('margin-right', '0');
$('#trophy').css('margin-bottom', '0');
}}
</script>
</body>
[/code:2lyg8tlx]
now i can run this js function frome script when i click on buttom. How i can run this function from event in construct iframe?
If somone help me i can reward:)
sorry for my english lang...