Hi i trying to bounce a jpg with jquery but its not going anywhere you can check the code at
http://jsfiddle.net/sethportman/WZumy/6/
Some problems:
$("document").load(function(){
should be
$(document).ready(function() {
and
$(this).effect('bounce',1000 )
should be
$(this).effect('bounce', {}, 1000)
and beyond this, you are not loading the UI/Effects plugins, so your particular page doesn't have a .effect() method available.
You have to include jQuery UI for the effect, and be sure that jQuery has loaded properly:
http://jsfiddle.net/WZumy/11/
http://jsfiddle.net/rlemon/WZumy/12/
As posted, you will want to ensure you have loaded the library correctly (in JSFiddle) and ensure you wait for the DOM to load $(document).ready
dont know if you ever had this answered. but here is a fixed fiddle.
http://jsfiddle.net/WZumy/17/
Related
I think this question is asked, but I am surprised to see that dojo is not behaving as per the docs. I want some div to be changed with particular class. So I decided to use
dojo.ready(function(){
});
But that was running before the page was completely loaded. Then I used addonload() function. That too gave the same result. Finally I ended up doing something like this
require(["dojo/domReady"], function(domReady) {
domReady(function () {
setTimeout(function(){
setAfrobeat();
},500);
});
});
That is working fine, but some times I see a blink as there is delay, and very a few times this also doesn't work. If I increase that timeout to 1000 it works always, but user can see the content modification. Any perfect way like I used to do in jquery's document.ready
Regards
Aadam
The way you are loading domReady is as a typical module instead of as a dojo plugin with the "!" convention as per the dojo documentation http://dojotoolkit.org/documentation/tutorials/1.8/modules/ see using plugins.
To use domReady correctly it should look like this..
require(["dojo/domReady!"], function(){
// will not run until DOM is finished loading
});
http://dojotoolkit.org/reference-guide/1.10/dojo/domReady.html outlines when and how to use dojo/domReady! vs dojo/ready
I found a simple spinner/loader that uses only one div and one css. When I implemented that, i found that it was not stopping. It goes on and on.... so I inserted window load script given below. still it does not stop. What am I doing wrong?
Here is a fiddle http://jsfiddle.net/qzLdjq3c/5/
$(window).load(function() {
$('.spinner').show();
$(".spinner").hide();
});
you don't even use jQuery (on the left side under included libraries) in your example. second you use # instead of a dot (class) selector .... and third, in jsFiddle, look at the left side. You already run the js on the onLoad...you can't just fire it again (i think), anyway, you are wrong at everything imaginably possible. fix what I said and try again.
For some reason when I try and select an element from the page it only works if I put a timeout of 0 milliseconds. If I don't put the timeout it just returns what is there before the Ionic framework has been loaded. Any ideas? Below is my code.
The order of loading is jQuery, Ionic, Custom Script (as seen below).
Working
ionic.DomUtil.ready(function(){
setTimeout(function(){console.log($('body').html())},0);
});
Not Working
ionic.DomUtil.ready(function(){
console.log($('body').html());
});
EDIT: Obviously I could just put a timeout on everything I want to do but that's bad practice so would be nice to know the underlying cause!
EDIT (2): I have managed to get it do show the HTML doing the following... However, it is not ideal...
$(document).ready(function(){
console.log($(this).find('body')[0]);
});
It's almost as if some jQuery functions are not working even though the $ is being initiated otherwise it return $ is undefined.
I don't know ionic, but you tried with jquery stand alone? like this:
$(document).ready(function(){
console.log($('body'));
});
Maybe there are other way to do the same with ionic
I had an blog using WordPress. I got an jQuery code to make some div fixed after some scroll, got it here:
http://jqueryfordesigners.com/fixed-floating-elements/
Someday ago, I got an plugin to make and "Recent Post Slider" for WordPress. But when I activate it, the fixed div jQuery stop working. I think that can be an conflict, but really don't have sure yet.
What is the best move to know what's happening?
You can use jQuery.noconflict() for this. For example:
$j = jQuery.noConflict();
$j("your_div").css("position", "fixed");
Here you have the code explanation. jQuery.noConflict
Get a browser with JavaScript debugger console and make it print you the $ variable. jQuery returns : function (a,b){return new e.fn.init(a,b,h)}. The $ variable is sometimes used by other libraries, and if you use it directly in your jQuery it may get overwritten. To avoid this, encapsulate your jQuery code:
(function($) {
your code with $
})(jQuery)
This may break some of your global variables though, it depends on how you wrote your code.
I don't think that jQuery does not work anymore as #nicowernli said. But it is possible that the plugin changed the html of the page.
The best move is to disable the "Recent Post Slider" plugin and check if the fix starts working again. Then you will know what where problem is.
make sure that you've included Jquery once but no more
Hello I am using the jQuery plugin fancybox to display bing maps when somebody enters an address into a textbox and hits the submit button beside it. And a fancybox is loaded and a map for that address is displayed. This is working well with my application, but the problem is, it is only working well on one page and on the other one, when I load it, it is giving me an error saying fancybox is not a function. I get to see this error in the error console and in the firebug console. I am not sure what could the problem. The same code works in another page, but it doesn't on this one?
$("Map").fancybox is not a function
I am pretty sure it is not re-usability issue. But when I test to see if fancybox's original files have been loaded, they are loaded with the dom, so it might not be actual problem. But I am unable to understand what else could the problem be.
This is my code
abbr: is just a text bit. I have different divs based on what the user selects. And each div would have its own controls, which would start with that text and are appended with their own definitions such as mapresults, decValLat, decValLon etc.
ex: abbr>>east
and then the ids would be eastmapresults, eastdecValLat, eastdecValLon etc.
function showMapFancybox(abbr){
var abbr;
$('#'+abbr+'mapresults').hide();
$('Map').fancybox({
overlayShow: true,
onClosed: function() {
$('#'+abbr+'mapresults').show();
map_latdec = $('#decValLat').attr('value');
map_longdec = $('#decValLon').attr('value');
map_latdeg = $('#degValLat').attr('value');
map_longdeg = $('#degValLon').attr('value');
$('#'+abbr+'decValLatsub').val(map_latdec);
$('#'+abbr+'decValLonsub').val(map_longdec);
$('#'+abbr+'degValLatsub').val(map_latdeg+'N');
$('#'+abbr+'degValLonsub').val(map_longdeg+'W');
}
}).click();
};
I already had this type of errors because i was reloading jQuery after the plugin import, check you don't reimport jquery by mistake (sometimes included in a package like jQuery tools).
I just had this issue, it seem some versions of jQuery are not compatible with versions of FancyBox, for example Fancybox 1.3.4 is buggy with jQuery versions below 1.7 and doesn't work on version higher than 1.8.
Possible Solutions:
1) have you already loaded jQuery? If not, then load it before any $ commands start.
2) Check, probably you are loading jquery library (.js) several times during the page. Try to load only one.
3) In the end of file, you can execute this javascript command: $ = jQuery.noConflict(); and it might solve. If not, then anywhere use the word jQuery instead of $, and it will work too.
You need to load the extensions like easing.js and mousewheel.js BEFORE the main fancybox plugin. That solves the problem.
If "fancybox" as a function does not exist, it is likely that either the jQuery source or the plugin source are failing to load into your page. Make sure that the pathing, file names, and extension are all correct.
EDIT: Make sure that you link to jQuery Source before you link to any plugins. If a plugin is loaded into your HTML before jQuery is, the plugin fails.
In my case it was jQuery.noConflict(); row in another jQuery plugin ... when I removed everything started to work.
If you are using a plugin which includes JQuery into your header tag, this trouble can arise.
I recently added 'TheThe Slider' to my blog, all my FancyBoxes stopped working. There are easy fixes for this situation though. basically, go to the plugin directory, search for the call to jquery and make it's usage conditional. If you would like to see my implementation of this I did blog about it with screen-capture.
I got this issue in my WordPress web site and I found the issue was happening due to fancybox.js presenting twice in the code from two plugins which I installed. So check your code and make sure to load from one source.