I am trying to solve an odd javascript problem where the script works fine in all browsers - except IE, but works since the dev tools were opened.
I searched around, and this is often due to IE not spawning a console object. However, the code does not mention the console, and I tried 5+ different codes, which apparently prevent this problem, to no avail.
I would be grateful for your help in this!
the code:
var slide = function slider() {
var i = 0;
var slider = {
loop: function loop(data) {
$.getJSON('?getdata=1', function(data) {
var create = $('<div class="social-area pic">' + '<div class="socimgdiv">' + '<img class="socimg" src="' + data.pic + '">' + '<div class="infotxt">' + data.name + '<br><small>' + data.age + ', ' + data.country + '</small><br>' + '</div></div></div>'),
maxTimeout = 4000,
minimumTimeout = 1000;
$('#box').prepend(create);
$('.social-area').last().fadeOut(400);
setTimeout(function() {
$('.social-area').last().remove();
}, 400);
setTimeout(function() {
$('.pic').animate({
width: 'toggle'
}, 350).removeClass('pic');
}, 400);
i += 1;
if (i >= 5) {
timeouter = Math.floor(Math.random() * maxTimeout);
if (timeouter <= minimumTimeout) timeouter = minimumTimeout;
} else timeouter = 400;
setTimeout(function() {
this.loop();
}.bind(slider), timeouter);
});
}
};
slider.loop();
};
slide();
The script collects data from the JSON channel, which is generated through the PHP script included earlier:
if(isset($_GET['getdata'])){
echo json_encode(array(
'name' => $name,
'gender' => $gender,
'age' => $age,
'country' => $mycountry,
'pic' => $pic
)); exit;
}
Everything works fine - exactly the same as expected in FF, Chrome, Safari and Opera, but not in IE 11 with developer tools in the unopened version.
- , , , .