I have two scripts the first is script.js that uses quicksand.js and the second is plusslider.
When I use code like the following, the plusslider works but the script.js doesn't.
But, when I delete the plussslider call the script.js works fine.
How do I make them work at the same time?
This is my header.php:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.quicksand.js"></script>
<script language="javascript" type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/script.js"></script>
<script language="javascript" type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.plusslider-min.js"></script>
<script language="javascript">
$(document).ready(function(){
$('#slider').plusSlider({
createPagination: false,
sliderEasing: 'easeInOutExpo',
fullWidth: true,
sliderType: 'slider'
});
});
</script>
<?php wp_head(); ?>
Check to see how the links appear when you do a view source in the browser. Copy the relevant ones and make sure their addresses load the files in the address-bar.
Also, don't use language="javascript" that was old-school 5 years ago and might throw the right browser with the wrong doctype.
But trust me. Always go to the HTML first, every time. Even if that doesn't help you this time.
Also making sure you're not doing something silly in script.js like overwriting the $ namespace.
Another possible issue. Are all your resource links https? By that I mean images, CSS, other JS files, the actual page you're loading, etc...
Related
I have big problem here and it seems i dont know that much jQuery so i need help. If someone know this i will be grateful.
I copy everything from their folders and i want to use skin thumbnail 07. Everything was ok when my page stays in ''skin'' folder, but when i take it out, JSSOR showing me just one picture. I cant figure it out where i need to change code...that i dont need to put every single page in ''skin'' folder.
You can check my working code here
And not good one here
Only difference is different place of .php file
Thank you
js file reference path is incorrect.
please replace
<script type="text/javascript" src="../js/jssor.core.js"></script>
<script type="text/javascript" src="../js/jssor.utils.js"></script>
<script type="text/javascript" src="../js/jssor.slider.js"></script>
with
<script type="text/javascript" src="js/jssor.core.js"></script>
<script type="text/javascript" src="js/jssor.utils.js"></script>
<script type="text/javascript" src="js/jssor.slider.js"></script>
I am facing a problem that when i reload my page all the child menu are expand and after reload they are all well.why child menu are expand.
my site link is
www.thesouq.com
Try putting js file of menu right after jquery
<script type="text/javascript" src="scripts/jquery.js"></script>
<script type="text/javascript" src="scripts/jquery.ui.js"></script>
<script type="text/javascript" src="scripts/jquery.menu.js"></script>
<script type="text/javascript" src="scripts/jquery.menu.hover.js"></script>
try removing this block also
<script>
window.onload = function(){
include ("scripts/jquery.menu.js");
}
</script>
I have check it using firebug you menu call is very late since doc is not ready.
Please optimize your page, check out Yslow, it will help you a lot
I'm a bit of a newbie with sources etc and I took it for granted that I could simply add the script src to the header and then add as many scripts or functions as I wanted after that. For the most part this is working fine but now I hav an issue that I cannot solve.
I can either have one script running or the other, both will not work in harmony no matter how many different permutations I've tried. I'm sure there's an easy fix or something I'm missing entirely. I had a look online for an idiot's guide but didn't find anything of use.
The two function scripts are in different places. One is in the head and called from the body of the HTML pages, the other is in an include which is added to every page for dynamic links.
This loads everything Except what is within the body
<!--Creation and hiding of div to allow images load-->
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script src="../js/helperFunctions.js"></script>
<!-- jQuery (required) -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="../js/jquery.min.js"><\/script>')</script>
<!-- Syntax highlighting -->
<link rel="stylesheet" href="../mainCSS/prettify.css" media="screen">
<script src="../js/prettify.js"></script>
<!-- AnythingSlider -->
<link rel="stylesheet" href="../mainCSS/anythingslider.css">
<script src="../js/jquery.anythingslider.js"></script>
<script>
$(function(){
prettyPrint script here;
</script>
<script>
$(function(){
slider script here
</script>
Whilst this loads the body script but none of the others.:
<!-- jQuery (required) -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="../js/jquery.min.js"><\/script>')</script>
<!-- Syntax highlighting -->
<link rel="stylesheet" href="../mainCSS/prettify.css" media="screen">
<script src="../js/prettify.js"></script>
<!-- AnythingSlider -->
<link rel="stylesheet" href="../mainCSS/anythingslider.css">
<script src="../js/jquery.anythingslider.js"></script>
<script>
$(function(){
prettyPrint script here;
</script>
<script>
$(function(){
slider script here
</script>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script src="../js/helperFunctions.js"></script>
I then tried putting the script src in the include, including the src twice and lots of other stupid senseless ideas.
If anyone could help it'd be great! Many thanks
Your include jQuery like three times in this code. i'm not sure if thats the problem but it ain't the solution
// jquery from jquery.com
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<!-- jQuery (required) --> // jQuery from google
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="../js/jquery.min.js"><\/script>')</script>
// both of these are expendable
this might cause a conflict since the last one to be included is an older version of the library. you only need only inclusion. I'm assuming your using migrate because you have older jQuery code running in your scripts.
CODE ERROR
<script>
$(function(){ // syntax error
prettyPrint script here;
</script>
<script>
$(function(){ // same error
slider script here
</script>
you have syntax errors here, and any script that comes after this code will not run or work.
I had a function in one f the scripts that was returning an error. That seemed to be halting the est of the code. -.-
Also only have one instance of jquery in the head now.
I'm getting the following warning message on my web page:
A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete.
Script: https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
How I can resolve it?
I'm using the following scripts:
<script src="https://www.markettrendsignal.com/beta/js/script.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="https://www.markettrendsignal.com/beta/js/thickbox.js" type="text/javascript"></script>
<script src="https://www.markettrendsignal.com/beta/js/jquery.treeview.min.js" type="text/javascript"></script>
<script src="https://www.markettrendsignal.com/beta/js/jquery.tipTip.minified.js" type="text/javascript"></script>
<script type='text/javascript' src='https://www.markettrendsignal.com/beta/js/jquery.colorbox-min.js'></script>
probably need to see more of the page. you may have some kind of recursive javascript that is taking advantage of jQuery, so the root cause is not jQuery, but the other javascript that uses it...
I created an application using PHP, mysql, and jquery. It's working fine on my localhost,m however after uploading it to the server, everything works fine but jquery, I believe it's not reading it.
Using firebug, I get the following error when trying to read the .js file in the browser:
Uncaught syntax error: Unexpected
token.
Here's how i include my scripts:
<script type="text/javascript" src="js/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="js/autoresize.jquery.js"></script>
<script type="text/javascript" src="js/customSelect.jquery.js"></script>
<script type="text/javascript" src="js/jquery.form.js"></script>
<script type="text/javascript" src="js/jquery.validate.js"></script>
<script type="text/javascript" src="js/jquery.validate.password.js"></script>
I did check my files and they exist in /js/ . What could be wrong?
UPDATE
It is working when I read :
https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js
But it's not working when reading from server?
You are using relative path right now.
When you use relative path, all the requests will go to the path relative to your location.
For example, if you are on http://www.mysite.com/products/catalog.php, your browser will send the request to get the jQuery scripts from this location: http://www.mysite.com/products/js/ which certainly does not exists.
Try using the absolute path instead. In fact make a habit of!
Try the following:
<script type="text/javascript" src="/path/to/your/srcipt/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="/path/to/your/srcipt/autoresize.jquery.js"></script>
<script type="text/javascript" src="/path/to/your/srcipt/customSelect.jquery.js"></script>
<script type="text/javascript" src="/path/to/your/srcipt/jquery.form.js"></script>
<script type="text/javascript" src="/path/to/your/srcipt/jquery.validate.js"></script>
<script type="text/javascript" src="/path/to/your/srcipt/jquery.validate.password.js"></script>
Shoud be an HTTP GET request for these js file.
<script type="text/javascript" src="js/jquery-1.6.1.min.js"></script>
Sounds like it does not exist on the location. If you have nice urls implemented or file does not exist then it would not work, try using full path.
<script type="text/javascript" src="http://xyz.com/js/jquery-1.6.1.min.js"></script>