We have code that will run if the user is idle for a certain amount of time.
(doStuff resets a countdown)
Existing code in Prototype:
Event.observe(window, 'mousemove', function() { doStuff(); });
Event.observe(window, 'scroll', function() { doStuff(); });
Event.observe(window, 'click', function() { doStuff(); });
Event.observe(window...
Need assistance please. (More confused than anything really)
I've got ASP.NET mvc controller
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Dashboard(string Whatever)
{
//Save name to database
System.IO.StreamWriter swLogFile = new StreamWriter(@"c:\temp\test.txt", true);
swLogFile.WriteLine(Convert.T...
I have a sortable list and an iframe on the same page. What I'm trying to do is define the <iframe> as a Droppable. Everything works with out errors but when I try to drag a sortable item across the Iframe it stops at the edge. ( if I move it slowly it seems works in firefox)
The Iframe is set to DesignMode ="on" so covering it wit...
Given the following code:
function a() {}
function b() {}
b.prototype = new a();
var b1 = new b();
We can stay that a has been added to b's prototype chain. Great. And, all the following are true:
b1 instanceof b
b1 instanceof a
b1 instanceof Object
My question is, what if we don't know the origins of b1 ahead of time? How can we d...
I'm not an expert of jquery and i need help to porting this function
auto_complete: function(controller, focus) {
if (this.autocompleter) {
Event.stopObserving(this.autocompleter.element);
delete this.autocompleter;
}
this.autocompleter = new Ajax.Autocompleter("auto_complete_query", "auto_complete_dropdown", "/admin/" + controller ...
I just started a new job, and my first task is to clean up the Javascript code for the site - the problem is that there are two JS libraries being used (jQuery and Prototype / Scriptaculous).
I'm trying to figure out what's being used where, but it's pretty difficult, especially not being very familiar with the code.
Does anyone have a...
Hi,
Ive been fiddling with this for hours and hours and just cant get it right. First off my sites are already using Prototytpe and Scriptaculous, and to change would take a long time.
Basically I am after achieving a slideshow effect similar to jQuery Cycle plugin. I have written most of it but cant get over this hurdle:
I need the u...
I am using jquery on my html page and want to have an onchange event on a collection_select.
If I add <%= javascript_include_tag :defaults %> then my jquery code does not work.
Basically I have a collection_select as follows:
<%=collection_select(:product, 'prod_name', @prods, :id, :prod_name,
{:prompt => 'Select Product'},{:onchan...
I have a few div's like this in my page:
<div class="listing-type-list catalog-listing">
I would like to append a class to the div when I hover over it then remove it when I mouseout?
How can this be done with prototype?
...
I have a Magento site, which includes the prototype JavaScript library.
Some time ago, I added jQuery as well.
Before that however, I'd included a prototype based Lightbox. It was triggered by adding the attribute rel="lightbox[gallery]".
Now I'd like to make a lightbox appear on page load. I know nothing about prototype, so I tried c...
var myJsonObj = {"employees":[{"name":"John", "lastName":"Doe", "age": 55},{"name":"Jane", "lastName":"Doe", "age":69}]};
How can I delete myJsonObj.eployees[1] ?
Thank you :)
...
I'm confused about the notion of "prototype" in javascript.
When I'm defining an object both of the following seem to work:
myObject = {};
myObject.prototype.method1 = function() { ... };
myObject.prototype.method2 = function() { ... };
myObject.prototype.method3 = function() { ... };
and...
myObject = {};
myObject.method1 = functio...
Hi, I'm editing some old sideshow code someone else written a while ago and I was wondering how you get the alt attribute of an image with prototype.
Ive got the image tag selected with the code below:
$$('#' + this.slides[this.currentSlide].id + ' a img')
But for the life of me I don't know how to get the alt text.
I've tried...
$...
Using the script off http://viralpatel.net/blogs/2008/12/set-maxlength-of-textarea-input-using-jquery-javascript.html I am trying to limit the input of a textarea to 1000 characters. Prototype is also included in the page.
It works fine in chrome, but in firefox the following error is given and the input is not limited:
$("textarea[ma...
Refer to the link below. I have a "dropdown" html element which has an event observer looking for mouseover. It's working, but it continuously fires mouseover events while you are mousing over the other elements inside it. I am guessing this is because of bubbling.
Is there a way to only make it fire the event on the initial mouseover? ...
This is probably really simple, but the prototype docs on the $$(function) really suck. What do I DO with all the items once the function gives them to me?
First I tried:
$$('div.category').style.height = 400 +"px";
Then:
$$('div.category').each(.style.height = 400 +"px");
Finally:
for (x in $$('div.category'))
{
x.style.heig...
So, here's the deal, I'm trying to use Element.previous to call an a previous element as an object... but it just gets the text of the element. How can I call on a previous object without knowing what it's id is? Calling on a previous element by class for example?
...
Basically, I am confuse with Developer devCopy = (Developer)dev.Clone();
Clone method of Developer class just creating a Employee clone, then how developer get another clone of developer.
public abstract class Employee
{
public abstract Employee Clone();
public string Name { get; set; }
public string Role { get; set; }
}
...
I am learning the prototype framework and javascript in general and am tring to refactor a bit of existing code to create some html from data inside of a class using an event listener. I am having problems getting the events to fire and getting the corresponding listener code working. Here is a small example, that I can't get working:
<...
I know my jQuery, but sadly don't know much about Prototype.
$(function() {
$('#home-gallery-container').append('<a href="/images/cobra_sale.jpg" alt="" rel="lightbox-home" id="special-home" ><img src="/images/tag.png" alt="Special" /></a>');
});
How would I do this in Prototype, or Magento's library if that adds anything extra.
...