I've been trying to implement a smooth scrolling animation in my page, which works fine in firefox and IE8 (haven't tested any older versions yet). But doesn't seem to work in google chrome (and probably safari either I guess). I have 4 divs on my page, positioned absolutely 2 by 2, only one div should be visible at a time, so the body has gotten an overflow:hidden. When an anchor-link to one of those divs is clicked the javascript gets its position,then scrolls towards it. etting the position works, but the scrolling does not work in chrome.
Now, when I remove 'overflow: hidden' from the body element, the scrolling does work in chrome, but of course adds the scrollbars which I don't want.
Can anyone tell me the best way to access a hidden object in a form? I could use a hard-coded index to the elements of the form, but it's too easy to add something before the hidden object and mess up the indexing. For example:
The form has a tagid of "myForm" The hidden object has a tagId of "myHiddenObj"
I can get the form elements by using var formElements = document.getElementById('myForm').elements
But there doesn't seem to be any way to do this: document.getElementById('myHiddenObj')
Assuming I have the elements as obtained above, none of these have worked for me either:
I am finding some unusual behavior with techniques I am using to show/hide/update data without having to refresh the page. I'm quite sure it's developer ignorance on my part and would be grateful for any suggestions.
My page has 10 tables with their visibility controlled by the user making a menu selection. For example, selecting menu_1 calls a function which displays table_1 by setting table_1's style display: block and hides tables 2-10 by setting their respective styles to display: none. Everything in this simple navigational approach works as expected.
I am also using the HTTPRequest object to update relevant objects on the page based on user input. The problem I am seeing is when the HTTPRequest object is used to update DOM objects contained within the "invisible" tables -- or more accurately within those tables having their style display:none. I have tried using both the HTTPRequest object's synchronous and asynchronous approach and am seeing the same results.
I've tested when all of the tables are "visible" by setting their style settings to display:block and HTTPRequest calls work as expected.
The other twist in my example is that these HTTPRequest calls are each making a SQL query and updating a chart object within the table, which may take about 500ms each to return. My initial impression is that it looks as if the page is being rendered too fast because any more than three charts on a page is when the charts start getting misplaced on the page. Again, everything works fine when all tables are visible.
Is this a known problem with HTTPRequest, or do I need to migrate my coding techniques to the 21th century?
I have a web app which allows users to select multiple items from a select tag. I then call a JS function on submit which collects all the options they've selected and then adds them to the value attribute of a hidden input. The options selected are then used at a later time. This works fine on IE and Firefox, but both Chrome and Safari for not adding the selected values to the value attribute of the hidden input. Are there any JS issues for Chrome and Safari that could be responsible for this?
I am unsure what is going on with my website? I had flash on it, and I have removed the flash and installed javascript. Everything is installed correctly from what I can see, when I go to the view page button on Dreamweaver the images rotate. When I upload it to my server they stop rotating.I have download all of the files needed for this to work, and have added them all to my server. Here is a copy of the coding.
Is there a way in Javascript or Jquery to return an array of all objects underneath a certain point, ie. the mouse position. Basically, I have a series of images which link to various web pages but I have a large semi transparent image positioned over the top of the other images. I want to find the href of the background image that the mouse pointer clicks over.
I am trying to get a simple set of Javascript tabs to work properly. I have just two tabs and I want to set up the script to have the second tab automatically hidden prior to reading the javascript code because right now it shows the contents of both tabs when the page is loading and then the second tab disappears after all the script has loaded.
I have the jquery script linked to on the page and here is the way my script looks to run the tabs:
Code:
I want to add something like style="visibility:hidden;" to the DIV that isn't shown on page load and have it added and removed as necessary when users click on the tabs. So basically I would like the generated code to look like this:
Specifically, assume I have a div tag of absolute dimensions. I need to figure out, first, whether or not the text inside the div tag is partially hidden by the overflow setting, and if so, what the hidden text is.
Is this even possible? Obviously, the rendering engine in the browser "knows" this information, but is it accessible through Javascript?
I have a tab compopenet object that works by passing a dom element to a constructor... which then finds all the relative elements to that element using .find() and adds the necessary behaviour. Now, since I have multiple tab components on the same page, I'm using each() to iterate through the dom elements and pass each into the tab component constructor function.
where can i find an example of how jQuery selects objects when using an id selector? i'm asking because i've been using a cross browser snippet to select objects and i was wondering if it's the right move to move from the snippet to jQuery. the snippet checks to see for availabe methods and depending on the one that works, it knows which browser the user is using and selects the object using that method. i also know jQuery is cross browser, so it's kinda implied, just wanna make sure.
Basically i have a good experience and knowledge with prototype.js library and also at the same time i am willing to get deeper into jquery.
I very much use oops concept now a days in almost every problem i solve using javascript, and was doing with prototype's feature to create classes and objects. Since i am now looking to get deeper into jquery, i was looking to find similar feature in jquery as well. I suppose jquery must be having a feature to create classes and do inheritance programming, but i couldn't find the way. My question to the forum is, Is there any option/feature in jquery which helps us to create classes and objects of our own probably with the support of inheritance?
I have a tab compopenet object that works by passing a dom element to a constructor... which then finds all the relative elements to that element using .find() and adds the necessary behaviour.Now, since I have multiple tab components on the same page, I'm using each() to iterate through the dom elements and pass each into the tab component constructor function.[code]This works fine for my purposes, but after running my code through JSLint and researching here (URL...), I've been made aware that I'm pretty much throwing these objects away, since I'm not assigning them to a variable.My question really is; is this particularly bad practice under the circumstances? If I assigned the object to a variable within .each(), I'd surely be overwriting that varibale with each iteration and essentially doing the same thing?
Let's say I have two images. I make one dragable. I physically move one image directly over the other. While my mouse is pressed I release it. The image underneath recognizes and gives a message indicating it's covered by the other????
I have a menu that is made from a ul element (with li children).
Here is an example:
< ul id="menu" > < li><a href="#divEntire2">Home Page</a></li>
[Code].....
However, if I do something like $(this).css('background-color','maroon'), the text and a section of bar under it does turn maroon. This happens even I just click on the bar.
I'm trying to build an SVG-based galaxy map for a space game, it pulls the details from MySQL using PHP and seems to work fine with the following code:
Is it possible to join two jQuery objects to make a new object. For example... var e1 = $("#firstObject"); var e2 = $("#secondObject"); var combined = e1.add(e2); // This is the expression I'm looking for [URL]
I basically have several buttons that are created dynamically via a db, so I can have 1 to 40 etc. now at the moment I give each one a unique id and a hover code in the loops. see below:loops goes here..
On touchstart and touchmove event, the event object has touches and targetTouches properties (see http://bit.ly/Q6uOD), however the jQuery.Event doesn't seem to copy these properties. I tried adding them to $.event.props like this:
$.each(['touches', 'targetTouches'], function(){ if (!($.inArray($.event.props, this))) { $.event.props.push(this); } });
But it doesn't seem to work. The event an event listener received via jQuery hasn't the targetTouches property even if it's accessible via event.originalEvent.targetTouches or window.event.targetTouches.
I have a bunch of divs with the same classname, 'mediafield':
And I have this jquery code in my header:
So I know that the click function is getting implemented.. The alert box appears however I get the following error in firebug: uncaught exception: Syntax error, unrecognized expression:[@class=mediafield] Line 0
Nothing happens when firebug is turned off... So I'm not sure why it's throwing the error.
I have a function that generate code, create a tags and i want those a tags that onclick send the name attribute to and existing div in the page
so <div class="icon"></div> load with the page <a href ... class ="marker"></a> are created manually $(document).ready(function(){ $('a.marker').each( function() {
I have a set of div elements cached inside var divs = $('#myDivs'). Suppose another div comes along that i want to add (push) to the group. is there a simple method for doing this without selecting ones already in the group for a second time?
I'm making some jQuery UI elements, and once an element is created, I want to add some custom functions and variables - I don't want to clutter up other jQuery objects by putting the functions in all jQuery objects, and obviously, the variables need to be different between different objects. However, the issue is, when I re-acquire the item, I won't have access to the variable any more.
That was probably confusing. Another way of putting it: (function($){ var _MyUI_id=0; jQuery.fn.MyUICreate = function(opts){ this.each(function(){ var obj=$(this)
//... code to turn the object into a MyUI object omitted to be concise obj.MyUI_id = _MyUI_id; _MyUI_id++; }}
})(jQuery) //now, create one $('#some_div').MyUICreate({}); //The desired effect would be to give me the id in #14, instead I get 'undefined'. alert($('#some_div').MyUI_id);
My 'solution', is to create an object variable in jQuery.fn called 'Collections'. It's indexes are the names of the new types, and each contains an object, the keys of which are the IDs of the UI elements that are converted to the type, and the values the jQueries objects. This is not only hackish, but it has a LOT of potential bugs. The code for this would look like:
This is in the 'create' function, at the end. jQuery.fn.Collections.MyUI[obj.attr('id')]=obj;
This is outside of the create function, but within the (function($){...}) scope. //jQuery.fn.Collections is set to {} in another file. jQuery.fn.Collections.MyUI={}; jQuery.fn.GetMyUI(id){ return jQuery.fn.Collections.MyUI(id); } This will allow the first block of code to work as desired, but it inserts a whole new set of bugs. What are the common ways to achieve what I am trying to do?