Dumle29
Dumle29

Reputation: 839

needing to updating an iframe twice for it to work

I have made this calculator:

http://snuletek.org/arma2coordcalc/

I'm having a problem with an iframe on the site. The first time you enter in some coordinates to convert, it works fine, but if you then enter some other coordinates, you will have to press the equals twice, for the iframe to update.

Here's some example coordinates:

[151,[10504.9,2857.15,0.00293732]]

[5,[2645.41,1941.31,0.00133705]]

[40,[1565.65,2059.92,0.00142217]]

So my question is, what would cause this behavior?

Upvotes: 2

Views: 81

Answers (2)

Jason Small
Jason Small

Reputation: 1054

You can destroy the whole iframe and reload it. This will cause it to load every time.

In the js.js file change the load code to:

$('#mapUrl').fadeOut(400, function() {
  height = $(document).height() * 0.8;
  $('#mapUrl').remove();
  $('<iframe id="mapUrl" src="'+getUrl+'" height="'+height+'"width="100%">').delay(200).appendTo('body').hide();
  $('#mapUrl').delay(400).fadeIn(400); 
});

Upvotes: 2

Remove or comment out the line,

$('#mapUrl').attr('src','');

from the javascript file 'js.js' and it should work fine.

Upvotes: 0

Related Questions