Adding a delay timer to a javascript

RogersDARogersDA 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.

Comments

  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited March 9, 2010
    You can try changing this line of your code from this:

    $(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.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • RogersDARogersDA Registered Users Posts: 3,502 Major grins
    edited March 9, 2010
    Yeah - I removed it and the Buy button reappears on the right of the view cart button (no longer to the left of the view cart button).

    So - now to add the YE.onDOMReady and see what happens...
  • RogersDARogersDA Registered Users Posts: 3,502 Major grins
    edited March 9, 2010
    The Ye.onDOMReady did not help. I am not sure if that's because the library that that the flexibackground is using is jQuery (hosted at Google) whereas the above is yahoo library stuff? I am not too familiar with java to know if that would make the YE.onDOMReady not work in this case.
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited March 9, 2010
    RogersDA wrote:
    The Ye.onDOMReady did not help. I am not sure if that's because the library that that the flexibackground is using is jQuery (hosted at Google) whereas the above is yahoo library stuff? I am not too familiar with java to know if that would make the YE.onDOMReady not work in this case.
    Smugmug should fix the buy button. This is ridiculous that you can't manipulate the page in YE.onDOMReady without losing your buy button. You should report this as a bug because they've busted the customizability of the page.

    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.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • BeachBillBeachBill Registered Users Posts: 1,311 Major grins
    edited March 9, 2010
    I haven't actually looked at the logic behind these, but $(document).ready(); and YE.onDOMReady(); do the exact same thing.

    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...
    Bill Gerrard Photography - Facebook - Interview - SmugRoom: Useful Tools for SmugMug
  • RogersDARogersDA Registered Users Posts: 3,502 Major grins
    edited March 9, 2010
    Bug report posted. Feel free to add to it what I may be missing.deal.gif
Sign In or Register to comment.