I'm attempting to make it so it physically swaps the element position within DOM (the index, in other words) when someone clicks on a button. It will either be the element right before, or right after (depending on which button they click). I'm using jQuery, so if there is an easy way to do it using that, please let me know. If not, I can use jQuery to get the DOM elements using .get(). I don't know if I can just just do something like:
Code:
var domElements = $('.draggable').get(); var tempElement = domElements[index + 1].cloneNode(true); domElements[index + 1] = domElements[index].cloneNode(true); domElements[index] = tempElement;
It doesn't seem to work quite right. Should I use replaceChild or something? Don't know if it would work, here? I will know the index, so that's not an issue, here, it's just a matter of getting it to reorder the elements, so when I loop through them, they are processed in the correct order.
Is it possible to make it so that image that is displayed in the div is limited to certain dimensions.. say 100 by 100px. If an image that is displayed is above the limit, the excess is simply just out of view..
I dunno how this would be possible maybe by a use of some sort of mask, i normally code inflash im not sure if taht is possible with divs in html. Or maybe you can limit the size in the js file, if your allowed to.
I'm developing a chess game recorder (records chess games just like electronic score sheet) and i am trying to write a function that handles the "en passent" rule in chess. However, when i try to test to see if a Black pawn is at a particular x,y location, it is always giving me back "50px". Even when it's not at that location. i uploaded semi-live version to my website here: [URL] you just click on the 'Play' button to start the game here's the function in question:
I have a javascript or CSS problem with two tables with same positions. The two tables has the same structure and positon in page.I want to view the odd lines from a table and the even lines from the oher table. What I have do is the following :
After page loads I see just the tabel having id='slideshow'.I have expected to see odd lines from the "slideshow2" table and even lines from the "slideshow" table.
I have a link that when clicked it opens up a pop up window. However, this window has a dramatic size change in different browsers, from way to small, to extremely large...
how can I make this pop up window have a similar size in all browsers...currently I have it set at 500 x 200.
Anyone know a jquery plugin I can use for a horizontal scrolling image carousel with different size images. I Iike the plug in here as my client will be easily able to put new content using a simple text file. The problem is that the images will be the same height but different width so I get ugly spaces between narrow images. Is there a plug in that solves this or is there a way to manipulate the css for each image so as to adapt the width of the div ? I can add the height and width properties of the images themselves to the text file and that works up to a point , but the images display at their correct size but the carousel stops working.
If the user has not entered data in a textbox I display a message in the textbox in italics.After the user has entered a message their message is then stored in normal textstyle.I am noticing that the textbox changes length when the fontstyle changes. Is there a way to prevent this from happening?
Is there a way to get the position of multiple substrings that match a regexp without using closures? match() returns the substrings themselves, not the positions, and search() seems to only return the first position. Here's what seems to work (under Shanti Rao's jsdb.exe shell) but I get a bit nervous about using closures Code:
I'm using this sortable method: [URL] Works perfect! I have one question though: When a certain action is taken by the user, I want to reset the original order of the <li>s in the list. I can't seem to figure out how to do that.
in a list, as seen below, i would like to first of all change the order only by clicking a button.e.g. li_elem2 and li_elem3 should change their order (positions), maybe even in a nice animated way later on...i tried to change it by editing the css properties, but didn't work out. so now i would be happy about any other approach i can take to swap items, or change positions of two list items....
I have a page where you can dress someone up in silly clothes using a skeleton image, and several items of clothing as gifs in dragable layers. Code:
How can I use a bit of j'script to grab the X and Y values of each layer and then put them in to a load of hidden form fields?
I then intend on having the user click the submit button when they've put all the stupid clothes in the wrong places... and saving the results in a database.
I have two separate questions. One being, how would I go about having the container resizing itself for different image sizes. So that surrounding elements can conform to it's size?
Also, is there a way to align the images in a slide shows so that it is always horizontally and vertically centered in the slideshow?
I am working on a plugin and have a test page setup here...to test bigSIZE click the 'BIG' button first, then mouse over the colored boxes. It works fine if all the boxes are the same size...the problem comes when you change the box sizes (I added the form to change the sizes for testing). For example if 3 boxes are 100x100 and one is 25x25 the 100 boxes will still work but the 25 will not.
Also, if the mouse leaves the box during the grow animation it will stay grown until you reenter and then trigger a mouseleave, so I need to fix that but I'm not quite sure how to do that either.
I have a webpage which the user can drag a marker around inside a div and the script then shows the standard js alert box with the final positions of the marker once the user has stopped dragging it about. What I need to do is get the script to add these values to two hidden input elements in the page.
I'm working on implementing a menu and need to have information when the menu size is larger than the width of the window. The problem is that pas a certain point, jQuery("body").width() keeps registering 497, despite being much smaller than that. Has anyone had this issue
Have to make a calculator to calculate wallpaper sizes and cost (college course so not for the 'real world' so doesnt need a great deal of functionality. Do i make a form in html and then name each cell? what then? Lost as hell here and been watching countless tutorials for js, need guidance i think now.
Now lets assume that the text itself contains characters outside of the normal ISO-8859-1 character set (like asian or russian characters). Would the individual char values be stored as one byte or two bytes?
"hello" -> 5 * 1 bytes = 5 (normal 8859 character sets) "hello" -> 5 * 2 bytes = 10 (unicode or an extended character set size).
Is ISO-8859-1 still stored like ASCII once was as 8 bits? Or is it 16? If I was to use a 2 byte character set then would that cut the size of my allocated local storage space by half?
IE6 in standards mode doesn't seem to hide scrollbars on the body element (overflow:hide) Ain't this a quandary. I have it in my head that I need to specify html instead. The scrollbars do hide on Gecko browsers though, so there is definitely a disagreement among browser developers on how to implement scrollbars (as a side note, Gecko browsers with their notoriously bug-ridden resize code seem to always screw up when asked to stretch and scroll divs, even when the page is reloaded on every resize!)
My first thought is to modify the CGI that generates the style sheet as I already have code that deprecates the document type when hidden scroll bars are required on IE6 (but not IE5.) This is based on the simple empirical evidence that the scroll bars are still there on IE6 in standards mode, so the optimal document type (XHTML strict) cannot be used. So I could just change this to output an html style (rather than a body style) for IE6 and lose the deprecation (it wouldn't be needed at this point.)
So the question is this. Given that CGI-based processing of browser versions for these kinds of tweaks is taboo, what would you check on the client side before dynamically generating the style for the body and/or html element? It doesn't seem like you could just send both as this would surely break some older browsers (I know you can do tricks with comments and such, but that only works for NS4 and maybe IE3 AFAIK.)
documentElement is the only thing I can think of that indicates standards mode and NS6/Mozilla support this AFAIK.
IE Conditional comments perhaps? I would hate to hard-code a test for a browser version number into the actual document (for obvious reasons), but I guess it is an alternative if the browser version is exposed to these things.
I don't see any other way to deal with a situation like this than with server-side code that looks at the browser's version number and makes the necessary adjustment. And there are lots of little differences like this that just don't seem to have viable client-only solutions. There's DirectX stuff (probably is an object detect for that) and funky colored scrollbars (hey people ask for them) and document margins (Opera did them slightly differently than the rest as I recall) and now this scrollbar thing.
I have used a textarea to display typewriter effect text. The scrollbars are displayed by default. What is the code to disable the scrollbars in a textarea form field? < scrolling="no"> does not seem to work.
<script> var newWindow = null; var scrolling = 0;// Controls whether the layer is scrollin or not var yT = 25;// Pixel position the top of the scrolling layer should be set to var lT = 25;// Initial position for the top of the layer var yI = 5;// Increment that the scrolling layer should move at var yH = 0; var domStyle;// Stores the generic DOM for the scrolling layer to access style properties var dom;// Stores the generic DOM for the scrolling layer var isDHTML = 0; var isLayers = 0; var isAll = 0; var isID = 0;
in the parent window, i have some objects that will release a pop-up window. in the pop-up window you can make various changes that will affect the database. to see those changes in the parent window, i need to refresh...right?
well, when i refresh...if you're working at the bottom of the page it pops the scrollbars all the way back up to the top. is there a way to reposition the scrollbars without the use of anchors?
Is there anyway to detect if scrollbars were made visible in a textarea? I'm not talking about initial setting of the scrolling attribute, but rather whether scrollbars have been added either horizontally or vertically based on the users text input?
I'm looking for an solution to find out the real vertical viewport - without the height of horizontal scrollbars.
I have two frames side by side. The left one declared 'scrolling="no"' and the right one 'scrolling="auto"'. For the left frame it is important to know if the right frame has a horizontal scrollbar and how sick it is. So I have tried to compare the viewport of both frames.
Using 'window.innerHeight', 'document.documentElement.clientHeight', 'document.body.clientHeight' or 'document.body.offsetWidth' I get the height including the scrollbars.
The same problem with two frames (rows="50%,50%) i've solved with block elements declared with a width of 100%. Comparing the offsetWidth of both, I can see if there is a scrollbar in one frame. But with frames side by side that doesn't work.