Adding a delay timer to a javascript
RogersDA
Registered Users Posts: 3,502 Major grins
So - I am left without a buy button after the recent packages et al. upgrade. As best as we can determine (I was chatting with the alway helpful Barb online last night) it is the scalable background script that is conflicting with the generation of the buy button.
So - wanting to keep my scalable background script, how can I put in a delay at the beginning of that specific javascript to keep in from firing for a predetermined period of time to see if that causes the buy button to come back? Maybe this problem is somewhat related to what Gabriel mentioned here.
So - wanting to keep my scalable background script, how can I put in a delay at the beginning of that specific javascript to keep in from firing for a predetermined period of time to see if that causes the buy button to come back? Maybe this problem is somewhat related to what Gabriel mentioned here.
0
Comments
$(document).ready(flexiBackground.initialize);
to this:
YE.onDOMReady(flexiBackground.initialize);
Try that first. If it doesn't work, I can help you delay it even further on a timer. I'm having a hard time understanding why this code messes with your buy button. Have you temporarily removed this line above to see that your buy button actually comes back.
Homepage • Popular
JFriend's javascript customizations • Secrets for getting fast answers on Dgrin
Always include a link to your site when posting a question
So - now to add the YE.onDOMReady and see what happens...
GreyLeaf PhotoGraphy
GreyLeaf PhotoGraphy
A timer is just a major hack. I think you should push hard on Smugmug to fix their design so it doesn't break customizations. Their change also broke everyone who was customizing the buy button itself and since your customization broke the buy button, who knows what else is busted. They need to fix this. Suddenly, customizations and the buy button got really fragile.
YE.onDOMReady is just YUI's method of registering an event to happen when it's safe to modify the page because the DOM is fully loaded. It is supposed to be safe to modify the page at that point and there are no other events to hook that come later. Since I don't know jQuery, I thought it was worth trying to run your jQuery at the point where YUI says the page is safe.
Homepage • Popular
JFriend's javascript customizations • Secrets for getting fast answers on Dgrin
Always include a link to your site when posting a question
It might be something in the flexibackground logic that is stomping on the new buy button.
I've read the other threads and I do agree, SmugMug needs to change the way they are doing the buy button because there are probably a lot of pros who don't even realize they can't make a sale right now...
GreyLeaf PhotoGraphy