I'm trying to make my draggables snap to each other as well as their containing div. Is this possible? this works:
$($element).draggable({
snap: true
})
but this (and variations of it) will not:
$($element).draggable({
snap: true, '#mainwindow'
})
Anyone know how to give op...
Hi,
I just tried to implement Fermat's little theorem in JavaScript. I tried it both ways, a^(p-1) mod p = 1 and a^p mod p = a mod p.
function fermat(a, p) {
return (((a ^ (p - 1)) % p) === 1);
}
and
function fermat(a, p) {
return ( ( a^p ) % p ) === ( a % p );
}
It doesn't work both ways, is there any way to fix that?
...
Hey guys,
A JavaScript newbie here. I have this following code:
function testObject(elem) {
this.test = "hi";
this.val = elem;
console.log(this.test+this.val);
echo();
function echo () {
console.log(this.test+this.val);
}
}
var obj = new testObject("hello");
When it is run, I expect "hihello" to be ...
I am using Firebug to debug 3 lines of JS I have written, but the framework I am using generates 10k lines of JS code.
And I end up finding those 3 lines manually.
Is there a way to search for a string/function in the script console of Firebug?
Any work around?
Thanks
...
I'm trying to build a sortable listed thats animated.
Apples
Bananas
Cavemen
Let's say I've selected Apples and I want to switch it with Cavemen, I want to click on Apples, drag it to cavemen and have bannas and cave men animate up to the proper positions.
I am aware that JQuery UI Sortable allows for some level of this functionalit...
By position I mean, how many columns are to the left of the cell and how many rows are on top of it. What I need exactly is two functions:
function FindColPos(element)
{
/* find column position */
return colPos;
}
function FindRowPos(element)
{
/* find row position */
return rowPos;
}
the functions MUST be written that way, I can't a...
Hi,
I am using the Google Data API in Javascript to access google calendar. But when I grant the access to the website for accessing my calendar, it should return to my first HTML page, but this doesn't happen and it redirects it to the same grant access page.
Anyone encountered this situation?
Thanks,
Sana.
<!DOCTYPE html PUBLIC "-/...
I am making a sequence of Ajax calls using the Ext.Direct module. I want to save some data when I make each call, and then match each return value with the correct call.
In the server call, Ext provide a tid property (presumable "transaction identifier") in the JSON packet which it uses match return values to calls. Problem is, there do...
Is there any way to, with help of Javascript, list all cookies associated with the current page? That is, if I don't know the names of the cookies but want to retrieve all the information they contain.
...
Is there a JavaScript framework that focuses on extending JavaScript by levelling the implementation differences? I don't mean a framework that simply provides the same functionality across different browsers, but something that makes non-standard browsers behave as if they were standards-compliant.
Basically I want something that does ...
I'm using dojo.create to throw some native widgets onto a page. In particular, I have put a set of radio buttons onto the page, and whether they function properly depends on where I put them.
I want to put them into a DIV I create. However, when I do that, they don't work. If I put them at the bottom of the body, they work. If I put the...
Console is returning blank for the action attr. I've moved the:
$('#file_upload').attr('action','io.cfm?action=updateitemfile&item_id='+$('.agenda-modal').attr('data-defaultitemid'));
Around in and out of the .live('submit') and no luck. I also tried it without the +$('.agenda-modal').attr('data-defaultitemid') part and it still retur...
I've been looking into a legacy application with a web-based user interface. Given its age (nearly 10 years some parts) there's a lot that needs updating and re-architecting, but I'm wondering about a small point regarding how user sessions work.
In a nutshell:
The entire UI is served via HTTPS.
Users are authenticated unremarkably by...
I've seen this site:
http://www.visitmanchester.com
Essentially all of the content loads on the same page, dynamically. Pausing to load the content then scrolling to the correct portion of the page.
...
I have a function that opens a popup after user typed in 6 chars in the input field.
It works fine, except when you do ctrl+insert, shift+insert to copy and paste.
in that case there are 2 popups (identical) - I assume one for shift and one for insert..
It just looks ugly and can be confusing.
Is there a way to limit number of popups to ...
What's the simplest way in Silverlight to detect the user is not active?
i.e. no mouse input and keyboard input for a period of time.
I tried monitoring the mouse events, keyboard events and the focus events of the root visual but it doesn't seem enough.
For example, a popup window may be open and these events won't reach the root visua...
I am trying to build a floating menu that follows the user when he scrolls the screen:
menuYloc = parseInt($("#floatMenu").css("top").substring(0,$("#floatMenu").css("top").indexOf("px")));
$(window).scroll(function() {
var offset = menuYloc+$(document).scrollTop()+"px";
$("#floatMenu").animate({top:offset},{du...
I have the following anchor tag, which contains dynamically-generated arguments arg1,...,arg5 to the JavaScript function foo(), which runs on the web site-side. There are several of these anchor tags throughout the page in question, with unique id values and argN values:
<a href="#" id="foo1234567890" onclick="javascript:foo(arg1,arg2,a...
This is what I have so far.
function init_map() {
var places = [
{ name: "Place 1", coords: new google.maps.LatLng(30.728752, -73.995525)},
{ name: "Place 2", coords: new google.maps.LatLng(30.733673, -73.990028)},
{ name: "Place 3", coords: new google.maps.LatLng(40.725778, -73.992249)}
]
var myOpti...
I'm developing a JavaScript extension for Chromium and my current workflow is:
Edit file
Uninstall old file
Install new file
Test file
Is there a quicker way of doing this?
I'm using chromium-browser_5.0.375.125 in Ubuntu 10.04.
...