JavaScript isn't my strongest skill, but I'll do my best to explain, so here it goes. I had someone create a slideup menu on my website and im also using jplayer music player.
Now everything works fine until I add this script at the top. For some reason it stops the slideup from working. This is the script that stops the slideup.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
If someone could tell me what im doing wrong that would be great.
Try using this to include your jQuery: <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
That is taken from the jplayer demo page at http://www.jplayer.org/latest/demo-01-video/ - line 22
you are not importing jQuery correctly. After consulting Google HOsted Libraries page (https://developers.google.com/speed/libraries/devguide?hl=es&csw=1#jquery) seems that the version to be imported should be 1.7.0 (Three digits, not two), try it!
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
Related
I have a question for you about jQuery.noConflict.
First of all - I did some research on what
jQuery.noConflict(true)
is, my question is related to this closely. So far I have found no answer that I was able to apply to my case, so if the answer is obvious and slipped my mind I apologize in advance.
The problem:
I am currently trying to solve a problem for a very large JS application. The JS application runs on a SAMSUNG browser (based on Orsay), which in turn runs on specific SAMSUNG displays.
To use display functions it is required to include:
<!-- TODO : Common API -->
<script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/API/Widget.js"></script>
<script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/API/TVKeyValue.js"></script>
<script type='text/javascript' src='$MANAGER_WIDGET/Common/af/2.0.0/loader.js'></script>
<script type='text/javascript' src='$MANAGER_WIDGET/Common/API/Plugin.js'></script>
Also to use Deferred objects within the code jQuery 1.9.1 is included:
<script type='text/javascript' src='app/javascript/jquery-1.9.1.js' ></script>
My problem arises from the fact, that the SAMSUNG APIs apparently load whatever it is they are loading in the display's backend, however one of the things they load is their own jQuery version, which is 1.4.2.
The situation is such that I cannot say which version will be loaded at what point. I can start up the display five times having done no changes to the code and will get two times 1.4.2 and three times 1.9.1 or once 1.4.2 and four times 1.9.1 or any other possible order. I suspect this being due to the display's API able to run multithreading, so that the JS application and the API run independently from one another.
So I took a look at the noConflict method, however am unsure how to go about this problem using it.
As said, the application is large. It uses jQuery in various places. So doing something like
jQuery1_9_1 = $.noConflict(true);
after loading our jQuery version is rather unfeasible, since this will cost a large amount of time to fix.
However so far I have found no way to reliably unbind version 1.4.2 from $, because I do not load it, but the display's API does and it is not clear as to when it is loaded.
I hope this question is not redundant and someone has an idea how to go about it.
I installed fakeLoader (jquery preloader) but I have trouble making it show before the page loads.
In mozilla it works almost fine (strangely...), but in Chrome and Opera, the page loads first and then the preloader animation takes place.
You could check my full source code here: http://morph.ellevenacoustica.com/
As the instructions in fakeloader website say, I load jquery 1.11.1 and fakeloader.js and .css in head.
Then I place a <div id="fakeloader"></div> on top of body and then I load this script
<script language="javascript" type="text/javascript">$(document).ready(function(){$("#fakeloader").fakeLoader({ timeToHide:1200, zIndex:9999, spinner:"spinner1", bgColor:"#a01414" });});</script>
The full javascript of fakeloader.js can also be found at the link that I provided above.
I contacted the creator of the script at github but unfortunately I got no answer, so I rely on you to give me a helping hand!
I fixed it! I am proud of myself! :P
The correct code to be placed at the bottom is:
<script language="javascript" type="text/javascript">
(function ($) {
$("#fakeloader").fakeLoader({
timeToHide:1200,
zIndex:9999,
spinner:"spinner1",
bgColor:"#a01414"
});
}(jQuery));
</script>
I'm trying to port an existing mobile web app to Phonegap, but I had difficulty handling a click event with jQuery (it worked in my browser, but not in the emulator). I've tried everything, but here is the general gist of what I'm trying to do.
HTML:
...
<span id="footerclick">Test</span>
...
<script type='text/javascript' src='alert.js'></script>
<script type='text/javascript' src='phonegap.js'></script>
<script type='text/javascript' src='js/index.js'></script>
<script type='text/javascript'>
app.initialize();
</script>
alert.js:
$("#footerclick").click(function(){
alert("I can't get this to show up");
});
That's pretty much it and I cannot get the alert to show up, I've tried wrapping it in $(document).ready(){} and a device listener. If I put something like onclick="alert('Hello')" as an attribute of #footerclick, that works also.
I think I just don't understand how Phonegap works with Javascript, but I've read the documentation several times and I don't get it. Please help, thank you.
I've found the source of the problem thanks to #tomysshadow. It turns out that the emulator was blocking the loading of scripts from external domains (in particular, jQuery) and so the .click listener obviously didn't work. My temporary fix is to download and use a local version of jQuery, but I may update this answer when I figure out how to change the config file to allow these inclusions.
I'm trying to build responsive webpage based on Zurb Foundation framework. Everything worked fine until I tried to add nanoGallery which uses jQuery too. When I add gallery scripts, top menu generated by Foundation script becomes unclickable, :hover works fine but if you click on it, nothing happens. Fell free to visit the exact page at http://emfoto.filipsvoboda.net/presentation.html.
This is how I'm trying to call each script:
<script src="js/jquery.js"></script>
<script src="/js/foundation.min.js"></script>
<script>
jQuery(document).foundation();
</script>
<script src="third.party/transit/jquery.transit.min.js"></script>
<script src="third.party/hammer.js/hammer.min.js"></script>
<script src="third.party/imagesloaded/imagesloaded.pkgd.min.js"></script>
<script src="jquery.nanogallery.js"></script>
<script>
jQuery("#nanoGallery").nanoGallery({
kind:'flickr',
(..)
thumbnailHoverEffect:[{'name':'borderLighter'}],
thumbnailLabel:{display:false},
});
</script>
I've already tried changing order of those scripts, but that does not seem to help.
EDIT: It does seem to work properly in IE10, however in Chrome-based browsers it still does not work.
EDIT2: After continual fiddling with the code it seems obvious that the presence of the gallery itself on that page causes the bug. Order of scripts doesn't seem to make any difference, as long as the gallery is not displayed, Foundation works correctly and links does work.
EDIT3: Updated the code, stripped it down and changed the order of scripts. I've added simple "a" link to the sample page and it doesn't work either.
EDIT4: I've searched for event.preventDefault() and it is present in one of the *.js files for the gallery. I've contacted the author and if we get to any solution I will post it here.
Thank you for your help.
This issue has been fixed in nanoGALLERY v4.2.1:
https://github.com/Kris-B/nanoGALLERY/releases/tag/4.2.1
I compared chrome and firefox requests and responses using Developer Extensions (chrome) and Firebug (firefox) for the info shown in Net panel. I'm not sure if the file that chrome doesn't find can be the cause of the problem but wanted to point out that difference.
chrome
http://emfoto.filipsvoboda.net/third.party/hammer.js/hammer.min.map (Not found)
http://emfoto.filipsvoboda.net/third.party/hammer.js/hammer.min.js
firefox http://emfoto.filipsvoboda.net/third.party/hammer.js/hammer.min.js
Atleast for time being, you can have a workaround for this by having a click handler which will read the url and take the page to that url.
$(function () {
$("a").click(function () {
var url = $(this).attr("href");
window.location.href = url;
});
});
Okay guys I have a website that has a lights off for videos source code: http://www.megaptery.com/allofthelights/
An organic tabs for videos using Jquery
and a 2buttons which onclick it changes the CSS of the whole page you know it's kinda like a theme for the page
Here is an example of one of my page:
http://myanimesekai.com/Watch/Noucome-Episode-9
okay all of them works perfectly fine on my laptop all of them IE, Mozilla and the OLD Google Chrome.
But Then I tried it on my Brothers Laptop BUT his Google Chrome is the latest Google Chrome the Google Chrome where the scrollbar changed. The problem is that the Lights off feature is malfunctioning it doesn't turn off the video only. But the Organic Tabs and The 2buttons works perfectly fine. So I tried it on an internet Cafe and this is where I was really frustrated their Google Chrome is also updated and then both 3 of them were malfunctioning then after a while I tried them on Mozilla and all of them worked perfectly fine and so I have an Idea maybe it's becaused it took time for the Jquery and my Javascript to load which is why all 3 of them were malfunctioning.
so my question is is there a way for me to make my page load the jquery and javascript 1st? or am I missing something that the new Google Chrome requires? this is really frustrating me
oh BTW the 2buttons that changes the CSS are the B and M squares Below the facebook page
There are so many errors on this page (http://myanimesekai.com/Watch/Noucome-Episode-9) that any one error can cause the page not to work.
You need to clean up your code quite a bit:
<script src="http://myanimesekai.com/javascript.js"></script>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js'></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script src="http://myanimesekai.com/organictabs.jquery.js"></script>
You are calling jQuery in your javascript.js file. The jQuery library has not been declared before your scripts. You need to restructure your code to (you only need one version of jQuery):
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script src="http://myanimesekai.com/javascript.js"></script>
<script src="http://myanimesekai.com/organictabs.jquery.js"></script>
This will fix some errors. I suggest that you look at the console for further errors and fix them.