So basically, I am attempting to display a Bootstrap Modal once a specific image is clicked. I am then attempting to display some text and image within a paragraph tag that will be changed every 600 milliseconds like so:
Playing -> Playing. -> Playing.. -> Playing...
Once the text
becomes 'Playing...'
, it will return back to the start as 'Playing'
, and over and over again until the Modal's display
class becomes none
.
I am calling all this after a setTimeOut
function since I need to wait for the Bootstrap Modal to load first to test against its class.
Although, my code is crashing the browser every time, and due to that, I cannot view the developer tools to find out the problem.
$(".tutorial").click(function () {
$('#tutorialModal').modal('show');
$(this).toggleClass('playingGif'); //display 'playing' background image
$(this).toggleClass('tutorial'); //turn off regular background image
setTimeout(function () {
while ($('#tutorialModal').css('display') == 'block') {
var text = 'Playing';
$('p', this)
.delay(600)
.queue(function (n) {
$(this).html(text);
n();
});
if (text == 'Playing...') {
text = 'Playing';
} else {
text += '.';
}
}
}, 500);
});