JQuery :: Canceling A Circle Callback?
Mar 2, 2010quick example:
function endless(){
$("element").animate({left: '-=100'}, 1500);
$("element").slideToggle(500);
[code]....
quick example:
function endless(){
$("element").animate({left: '-=100'}, 1500);
$("element").slideToggle(500);
[code]....
I use the getJSON request to fill a select (with cities names) after the user have choosen his region.
I paste some code:
The problem is that callback is never called. I used firebug and i have seen that when i change region the getJSON function is called and my script (python) return this JSON:
Why my callback is not called? I can't even get the alert ('callback time!'). I thinked that my json could be broken, but firebug net console read and parse it very well, so i think is valid JSON.
I also tried to split up the function declaration from the getJSON request, but it's no use.
I currently create a grid of svg circles made up of rows. I can animate a circle from one row moving into another row, sorted by some attribute value. But when I use a selector to fetch all circles within a row I get them ordered by when they were added to the underlying DOM.
Is there a way, if I created a group for each row, that when I move a circle from one row and insert it into another I actually remove the svg object from one group and insert in into the other so that it's correctly positioned in the underlying DOM?
i have the following test code in my html page
<div id="drawingArea">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="700" height="400"> <circle id="example" cx="335.4999" cy="234.38927" r="8" style="cursor: move;" fill-opacity="0.1"></circle> </svg></div>
[Code].....
Iam using Raphael and add the same question in their google group too, but they said, its jquery specific. I think, jquery doesnt found my circle. Maybe different id - handling between SVG-specific and plain DOM elements?
I have code that looks like this:
function setupEventWrapper(obj) {
old_ev_handler = obj.onsubmit;
obj.onsubmit = function () {
do_something();
if (old_ev_handler != undefined) {
old_ev_handler();
}
if (event_cancelled()) {
undo_something();
}}}
it wraps the onsubmit handler (if any) within a new function which
do_something() and then calls the old event handler.
My problem is how can I detect if the event has been canceled by
old_ev_handler(). AFAIK an event can be cancelled in three ways:
* returning false, easy to check for
* setting event.returnValue = false on IE, easy to check for
* calling event.preventDefault() on DOM
How can I check if event.preventDefault() has been called?
Is there a simple way to cancel all active timeouts without the need to reference each one individually ?
View 1 Replies View Relatedi have a form made up of 2 file inputs and a submit button..
the imputs are to upload images, namley jpeg's for a e-greatings thing im
working on.
this only works with jpegs so i have a script that will check the value of
the imput tag to make sure it ends with .jpg, .jpeg.
this works fine on the jubmit button using
onclick="myHandler(this)"
it works fane that it alerts the user that only jpegs are valid but then
when the alert
has been ok'd it continues to submit the form to my php script.
how can i get this to cancle the submit action?
I have two javascript onloads in my form which seem to be cancelling each other out. The first- onload="checkMyBox"- works fine, which means the calendar stays hidden until the ckeckbox is clicked. However the second script that is supposed to show text ("I am an organized person") only after image is clicked does not work. It always shows the text.
I tried playing with it, and realized that if I erase the first <body onload="checkMyBox('c2','div1')"> the second onload works, meaning that the text will stay hidden until I click on image.
Code JavaScript:
<script type="text/javascript">
function checkMyBox(trigger,toggled){
var mcb = document.getElementById(trigger);
var cal = document.getElementById(toggled);
[Code].....
I am displaying my own context menu in response to a right-click on control (textbox) in my ASP.NET application. In IE, I can suppress the display of the browser's own context menu by simply returning false from the javascript that displays my context menu.How can I suppress the browser context menus from Chrome or Firefox?
View 2 Replies View RelatedIm writing a small app that will basically be like a wiki for family memebers to go in and make pages using my wysiwyg editor, update pages, ect..
the problem i've run into is trying to ensure they have saved the page.
I have a variable to detect whether or not unsaved changes exist. however the problem is now stopping the close event if the user clicks 'cancel' in the confirmation box.
Examples of when the 'navigation' or 'browser close' should be blocked:
1)i've made a small change on the page then clicked on a link, i should receive a conf message asking me if i want to loose changes.
2)i've made a change on the page then clicked the browser 'X' (close) button by accident. I should get the conf message here as well.
3) i've hit the refresh or reload button without saving. again i want the conf message.
Note, if they want to close, clicking OK should allow them too. furthermore, this function to block the close and produce the confirmation only will be called if there are unsaved changes on the page.
here is what i have so far - and this appears to work fine in IE. Code:
I am trying to create a circle with different images.
var j = 0;
var degree30 = Math.PI/6;
var r_angle = 0;
function rotate(idy){
var x = parseInt(Math.cos(r_angle)*100);
var y = parseInt(Math.sin(r_angle)*100);
document.getElementById(idy).style.left = (x + 300);
document.getElementById(idy).style.top = (y + 186);
j++;
(r_angle < degree30 * 11) ? r_angle = degree30 * j : r_angle = 0;
( j < 12) ? setTimeout("rotate('reduit'+ j)", 400) : stop();
}
I wanna get all the text nodes of the children of an element. The goal is to get an array with all the textNodes in each cell of a table, without any other nodes that might ocure whithin that cell (<p>, <br> etc...)
I mean if:
<td>12</td>
<td>1<p>23<b>34</b>5</p>6</td>
I need:
var txt = new Array()
txt[0] = ཈'
txt[1] = ?'
Now I had to circle through all the childNodes to extract all the text nodes. I have build a function, but something is wrong in the code, and I don't sense what. I need soime fresh eyes, any ideeas? Where's the mistake?:
<script type="text/javascript">
function checkCell(){
var allC = document.getElementById('tab').getElementsByTagName('td');//cells' collection
var txt = new Array()
for(var i=0;i<allC.length;i++){
txt[i]=''
while(allC[i].hasChildNodes()){
var chC = allC[i].childNodes;
for(var j=0;j<chC.length;j++){
if(chC[j].nodeType==3){
txt[i]+=chC[j].data;
}
}
allC[i]=allC[i].childNodes;
}
}
alert(txt[1])
}
onload=checkCell;
</script>
Anyone know how to make an svg circle radius fixed (i.e. not affected
by transforms)? I tried adding px or cm, e.g. r=ཋpx' but it just
generates an error.
I want place custom text rotating around analogue clock.
Here is javascript that is clise to my task:
http://javascript.internet.com/time...trailclock.html
But it have a few unnecessary features which is difficult to alter.
i want:
1. replace week/year/days in external circle with my custom text: 'My
custom text'
2. I want to reduce a little rotation speed of this text. (no mouse
reaction speed)
3. I do not need mouse trail effect at all, i want fix clock in
required place.
There is another script, but it have no rotating text wheel around
clock:
http://www.dynamicdrive.com/dynamicindex6/analog.htm
Which from this scripts is more easy to adjust for my task and could
someone show me exact code?
I can make a rectangle without an image by using table. Can I make a circle without an image with your help?
View 6 Replies View RelatedI've created a page with an image of a man where a user is able to click on an area and a div is positioned at that point containing a white circle. This code works in all browsers except IE 6 where it creates a duplicate white circle beneath the one which is placed in the correct location. How to get rid of this second circle? The circle is essentially a div with a background image assigned.
Code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="ImageClick.aspx.vb" Inherits="ImageClick" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL]">
<html xmlns="[URL]" >
<head runat="server">
<title>Image Click</title>
<script type="text/javascript" language="javascript" src="JQuery.js"></script>
<script language="javascript" type="text/javascript">
window.onload = Init .....
Picture:
Doing in html5 canvas, so JavaScript (was not sure where to post, but here I go...). Above is a link to picture that I need to do. It is clock-like. I will have to draw a circle, and two lines, from centre to according points on circle. That is not a problem, the thing I can not do is to fill upper and lower parts of circle that those two lines divide, so upper part of a circle should be e.g. red, and lower blue. (Plus, it would have to bi gradient, to look more appealing).
I came up with the idea of making the links in the back of the circle (i've got a total of 10 links), invisible and put a globe in the middle (as background) - making it look like the links in the back go behind the globe and comes back from behind it again. I've tried to do this myself with .this.style.invisibility="hidden";
[Code]...
i am relativly new to jquery and the$.getJSON method. two weeks ago i startet using$.getJSON with success.but now i have an inexplicable problem with using the function. i changed nothing in the behavior of using the method but getting now a different result. i am calling the function this way
var path = 'app.php?controller=kgr&task=savemod&action=new&tablename=kostengruppe
&start=5&kostengruppename=132&kostengruppenummer=546';
var jqxhr = $.getJSON(path, function() {
alert("success");
[Code]...
I'm using the plugin jquery-tmpl. Is there a way to specify a callback after a template is run? I want to do something like
<script id='itemTemplate' type='text/html'>
<li class="item" id=${timestampMs}>
<span class="content">${content}</span>
[code]....
Where processItem does something to the <li> element that just got generated. As it's written, though, the element doesn't exist at the time processItem is called.Here's how I run the template:
// Make the AJAX call to the service
$.ajax({
dataType: "json",
[code]....
I am looking to fade text out when the mouse passes over it and replace it with text that is faded in. My understanding is that this needs to be done through a callback, as the text needs to fade out completely before fading in. However, when I try to implement this idea the content does not fade in, so I must be doing something wrong.[code]I left the mouseout part unchanged, as that is an example of what I am changing from. What happens is that the mouseover text fades out, but the replaced text does not fade back in. Additionally, the shown text flashes before fading out if the mouse rolls over the text (as opposed to the containing box), which is not really a problem, but I am not understanding why that is happening. All works fine with hide/show. Full code can be found at URL...
View 2 Replies View RelatedIs it possible to call a callback from an anonymos function that is running as a callback itself? how would the correct code look? (i could not get that running)
If i try to animate a set of elements who match a selector, the animations will be executed on each element in some sort of a loop. how do i attach a callback that will be executed, after ALL elements have been animated instead after each element animation? is this possible at all?
I'm experiencing with the .animate() function.What I'm trying to do is implement a wicked window scrolling method that I found here:URL...Basically I'm wanting a nested animation, ie do A first then B, so in my example, after the window has scrolled down, I then animate a div to open.. however the callback function code within the // secondary animate comments is executed twice.[code]
View 2 Replies View RelatedI don't have the exact code anymore, but it was something like this:
$('html,body').animate({
scrollTop : $element.offset().top
}, 900, function() {
$element.find('h4').eq(0).click();
});
The click in the callback function was executed twice. Version 1.6.3.
i can't callback even raise a alert.
{literal}
<script type="text/javascript">
$('document').ready(function(){
getToken();
});
[Code]....
The animation works, but the callback function (alert) doesn't get called.[code]
View 2 Replies View Related