I have the code for the bubble clicks, but it does not work all the
time, and I am not sure what is wrong with it.
I have an alert is bubbleWasTapped() to see if it enters the function,
and it does not all the time. If you have any suggestions if would be
extremely helpful.
Here is my call to addBubble()
// This is the timer for adding new bubbles
timerBubble = setInterval("addBubble()", 3000);
function addBubble()
{
// Figure out the duck's id number
var idNumber = bubbles.length;
var letter = generateRandomLetter();
// Add the bubble HTML
$("#bubble-area").append('<div id="bubble-' + idNumber + '"
class="bubble">' + letter + '</div>');
// Now, we need to grab a reference to the duck we just added to the
HTML
var bubble = $("#bubble-" + idNumber);
// Add the bubble to the bubbles array
bubbles.push(bubble);
//Set the click function for the bubble to be popped
// check to see if the bubble was tapped
$(bubble).click(bubbleWasTapped);
// Set the bubble's position using a "helper" function
initializePositionForBubble(bubble);
}
Your code looks correct. Do you see a faint square appear around your
bubbles when you tap them? The square is Mobile Safari's way of
indicating that it detected a tap on the div. Sometimes Mobile Safari
won't detect the tap, and no square will appear. If you see a square,
and it still does not respond, that is indicative of a problem with
your code.
- Steve
- Steve
On Feb 15, 9:30 pm, Amrita Thakur (अम्रिता ठाकुर)