Current status of the Ning Platform is always available on the Ning Status Blog.

Forum

Can you delay a certain script?

Hello Creators, I am experimenting with a new feature for my network, however the JavaScripts are conflicting if the page takes too long to load. Is it possible to delay one of my scripts somehow?

Thanks everyone. Take care.

You need to be a member of Ning Creators Social Network to add comments!

Join Ning Creators Social Network

Email me when people reply –

Replies

  • If someone can teach me how to delay a script from loading, I will release an amazing TIP.

    What TIP you ask?

    How about letting your members choose what style sheet they prefer (light/dark/holiday) and have a cookie remember their choice?

    It's possible, I've had it working (not easy) but my problem is that it conflicts with my jquery tabs. So I need to delay the styleswitcher script so that there are not these conflicts.

    Thanks guys, I'd love some help.

  • I'm pretty sure that this is close to the right track....

    Needs a bit of altering, and I need to learn where I am to implement this, and how to apply it to my styleswitcher script.

    onClick="setTimeout(function() {alert('hello');},1250);

    Wouldn't want the alert part, but the timing delay function is there. 1250 milliseconds.

  • So this gives a delayed pop up message. How do I convert this to happen for my styleswitcher script, without the pop up of course.

    <form>
    <input type="button" value="Push this button to open an alert box in 1250 milliseconds" onClick="setTimeout(function() {alert('hello');},1250);">
    </form>

  • There's also a small issue with my styleswitcher script. I'll address that if I end up posting the TIP. It's pretty advanced in my opinion.

    Seems that on the first stylesheet, everything is fine, then switch to stylesheet 2, and my ningbar no longer is fixed, and that whole top section is wacky.

    I know you all won't have a clue what I'm talking about, until you see the scripts.

    Perhaps I'll just post the TIP and see what happens.

    • NC for Hire

      Hi Damien ,

      i normally use jQuery to do this :

      This script is to wait the window to complete loading then carry out the javascript

      $(window).load(function(){

         //javascript code goes here.

      });

      • Awesome Elson, that looks like it would work beautifully, and even looks easy to implement... now can I just delay the call to the script?

        $(window).load(function(){

        <link rel="stylesheet" type="text/css" href="http://api.ning.com/files/jwktXyJ4GnEIIluAAOY2mTQ6e*iEDVDGj2EDQDxGLzz-tEkbxOz6vD3IHWSSRlM2uLAs-SnptBR7X3LcvpzLGb8dwWNW*d3N/APStyleSheet.css" />

        });

        • That's my stylesheet, I know, but will it work like this?

          • NC for Hire

            Do it like this:

            $(window).load(function(){

               $('head').append('<link rel="stylesheet" type="text/css" href="http://api.ning.com/files/jwktXyJ4GnEIIluAAOY2mTQ6e*iEDVDGj2EDQDxGLzz-tEkbxOz6vD3IHWSSRlM2uLAs-SnptBR7X3LcvpzLGb8dwWNW*d3N/APStyleSheet.css" />');

            });

            • Ok sorry Elson, this is easier... this is what I need to delay... could you copy and paste, and add the delay for me? I'm failing my attempts.

              <!--trial stylesheet switcher-->
              <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
                  
                  <link rel="stylesheet" type="text/css" href="http://api.ning.com/files/jwktXyJ4GnEIIluAAOY2mTQ6e*iEDVDGj2EDQDxGLzz-tEkbxOz6vD3IHWSSRlM2uLAs-SnptBR7X3LcvpzLGb8dwWNW*d3N/APStyleSheet.css" title="styles1" media="screen" />
                  <link rel="alternate stylesheet" type="text/css" http://api.ning.com/files/6dRGUjTYClcg8NTa4pZGB8sk7LHCbUboLSQ0qY74i...*fJoxnvqgv7/APStyleSheetdark.css" title="styles2" media="screen" />
                  <link rel="alternate stylesheet" type="text/css" href="http://api.ning.com/files/j4wABojellApIBhmYmDsM277fce8Nxo89VvZ-RBKHE*TIWgXmeZQdVXrmacxm--bxgjgmBoGhEE76hH4ZbVfclB9ARHpD33o/NewStyleSheet1.css" title="styles3" media="screen" />
                  
                  <script type="text/javascript" src="http://api.ning.com/files/m9wY6nHswW4dI-dqxiJ62s9a5Q6jo-PHP*pU83VVJlsw*eFlDZ3h3TlV8-BFyIp7pNkB-FthX4a8PnmCJkWwQRGPyeTd1zN0/1059817952.bin"></script>
                  <script type="text/javascript" src="http://api.ning.com/files/m9wY6nHswW5L0BMsh0DGsQr3-6KMC*ooOuaJHf2*UQNNCs83xyTvlMmWkxjBOTb1O5cmE3Qyym171Rw834HlqnQSv2k*tYN9/1059817955.bin"></script>
              <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
              <!-- TemplateBeginEditable name="doctitle" -->
              <!--end trial stylesheet switcher-->

              • Also, you know my fixed ningbar? When I switch to 2nd and 3rd stylesheet, the ningbar is no longer fixed, and all of the stuff in the ningbar is no longer in there. (account module returns to left column, navigation is no longer in ningbar, and ningbar is no longer widened. Seems like the stylesheets don't fully load or something? Not sure if you'll know an answer for this, and I may have to design the 2nd and 3rd stylesheets to not have a fixed ningbar, and think up something different.

This reply was deleted.

Search the Creators Network

Latest Activity

Ceddy J replied to Kyryl_Ning_Support's discussion Paid Access demo version
"As always, I'm eager to help each other grow!"
1 hour ago
Sílvia Mota replied to Kyryl_Ning_Support's discussion Paid Access demo version
"Meu contato: silviamota@silviamota.com.br"
10 hours ago
J.Ayvar replied to Kyryl_Ning_Support's discussion Paid Access demo version
"Amazing News !<br/>

Our Site tin.dating Will be Perfect to test this New feature."
yesterday
Kos replied to Kyryl_Ning_Support's discussion Paid Access demo version
"Matt the code in 2.0 is old, out of date and degrading over time - which is why they built 3.0.  3.…"
yesterday
Mike Collins replied to Kyryl_Ning_Support's discussion Paid Access demo version
"I'd like to be involved in looking at paid access demo please "
yesterday
Harly replied to Ivy Williams's discussion Ning Roleplay Sites
yesterday
Kyryl_Ning_Support replied to Dr. Krishna Kumari Challa's discussion I am unable to find discussions on my network when I search. Any solutions?
"Hi there,
We are sorry for this. Previously we have been fixing the search on each network separate…"
yesterday
Kyryl_Ning_Support replied to Kyryl_Ning_Support's discussion Paid Access demo version
"Hi there,
We are glad to know that you have been excited with this news. I have sent you the privat…"
yesterday
Kyryl_Ning_Support replied to Kyryl_Ning_Support's discussion Paid Access demo version
"Hi Matt,
Yes, this post is regarding 3.0 platform only.
Regards,
Ning team."
yesterday
Lj Cange replied to Kyryl_Ning_Support's discussion Paid Access demo version
"Exciting news..... I will be happy to assist!"
yesterday
Matt replied to Kyryl_Ning_Support's discussion Paid Access demo version
"So Ning 2 paid access will not be updated?"
yesterday
Dr. Krishna Kumari Challa replied to Dr. Krishna Kumari Challa's discussion I am unable to find discussions on my network when I search. Any solutions?
"Still the problem is not resolved!"
yesterday
Matt replied to Kyryl_Ning_Support's discussion Paid Access demo version
"Is this only for Ning 3?"
Friday
Hugh replied to Anastasiia_NING support's discussion Ning 2Q 2017 plan!
"I'd like to get some reassurance that support will be upgraded. I can't think of a time recently wh…"
Thursday
Kyryl_Ning_Support replied to Kyryl_Ning_Support's discussion Paid Access demo version
"Hi Philip,
We are glad to hear that you are willing to help with the beta test, and it will be the…"
Thursday
Kyryl_Ning_Support replied to Kyryl_Ning_Support's discussion Paid Access demo version
"Hi there,
Thanks for your endless support! We have sent you the private message regarding joining t…"
Thursday
Kyryl_Ning_Support replied to Aubrey Williams's discussion Paid Access 2017
"Hi there!
We do appreciate your feedback, yes we know that based on our history the people wouldn't…"
Thursday
Ning via Facebook

#unitewithNING You`re one click away from the place where all questions about #NING find their…

Kos replied to Kyryl_Ning_Support's discussion Paid Access demo version
"Cannot express how happy I am to see Ning growing and expanding once again. It's been a long three…"
Thursday
Philip Voice replied to Aubrey Williams's discussion Paid Access 2017
"Thanks. I've applied to help evaluate and I'll make a decision about how I implement paid access in…"
Thursday
More…