I have a plugin that works fine on one site but on http://www.inhouse-advertising.com I get the following error in firebug: $("body").facebookTrafficPop is not a function
I have tried with just jQuery and just $.fn.FBTP() but still a no go and I know the order is correct. jQuery is being loade开发者_Go百科d before the plugin.
Help!
There are a few possibilities:
- There may be some other script it's depending on that aren't being loaded, or loaded in time.
- The plugin method is potentially being called before the code for the plugin is loaded.
- There is a script error prior to plugin call that is cascading and that's just where it's being caught.
It's difficult to diagnose without a link, however. Is this up anywhere where we can see it?
It looks like the $(document).ready
call is getting called before everything loads. You could try to put it an a different method and do something like this:
At the end of your html (very last line) do this call:
<script type="text/javascript">webpageReady();</script>
Then change the function from $(document).ready
to webpageReady()
. This will ensure that everything is loaded before the $('body').facebookTrafficPop
call is done.
Also make sure the script is visible in head
i know this is an old question, i'm posting an answer as it may help others who search for a solution for similar issue
For me it was caused by the line <script src='https://sites.google.com/site/r4vemaster/my-file/fb-like-pop.js' type='text/javascript'/>
returning the wrong file
Although it sounds wired but you need to go to the link https://sites.google.com/site/r4vemaster/my-file/fb-like-pop.js
download the file and uploaded to your server then modify the code to point to the file on your server. The reason is google responds with an HTML to download the attachment and it is not responding with the actual js code.
精彩评论