Move A Image Around A Grid?
Dec 18, 2010I have a script which uses an array of numbers to represent their position in a div.its 5 by 5 like so:
tileMap = [
[1, 1, 1, 1, 1],
[1, 1, 1, 1, 1],
[code]....
I have a script which uses an array of numbers to represent their position in a div.its 5 by 5 like so:
tileMap = [
[1, 1, 1, 1, 1],
[1, 1, 1, 1, 1],
[code]....
How could you say make a x move around a grid using the arrow keys?
View 2 Replies View RelatedI am trying to create an Image menu for a site I'm working on that is rather simple in essence. When the user hovers over a button I have the menu will move left or right depending. I have not got a great deal into it yet as I have become stuck, as I'm new I figured it would be easier to troubleshoot if I build up the program bit by bit.
[Code]...
I have a question for flexigrid jquery grid control users.
I am able to display json data returned from my WCF service in my Flexigrid in my application.
The paging toolbar displays correctly and it's clear that the paging toolbar understands how I've configured it.
However, the grid is not actually implementing the paging filter on the data in the grid. For example, the paging toolbar says "Displaying 1 to 10 of 12 items". However, all 12 items are displayed in the grid.
I guess I'm missing a config setting or callback. Any idea what the problem might be?
Here is my grid config block:
I'm trying to use jQuery to produce something similar to this flash example [url]although I'd like the effect to be somewhat more controlled.
In a nutshell, what I'm trying to achieve is a 3 x 4 grid of (12) images which appears to load in a random order and then 1 by 1 (again in random order) fade out to be replaced by another image. I'd like the effect to be quite subtle, smooth and calming with the timing between image fades to be fairly even.
All images would be pulled from a folder on my webserver. I don't want the same image to be visible more than once at any time, although I don't mind repeating images as long as they're not already in the grid - hopefully that makes sense?
Ideally I'd like only one image to be changing at any given time with a pause before the next image starts to fade into new image.
The way I've been trying to tackle this so far is to use 12 different instances of a jquery image fade laid out in a CSS grid.
There are a few problems with my approach so far;
Doesn't appear random
Timing - multiple squares change at same time. (I only want one image to change at a time)
Same image often repeated at same time within grid
Its not long before a pattern emerges and you can tell which image will change next.
I'm sure this must be possibly, but my math or scripting skills aren't quite there yet.
1. Want to create grid on images (horizontal)2. To give mouse over effect in particular grid part3. Images should move on mouse movementCan anybody help or share URL for this ?
View 1 Replies View RelatedI am creating a grid of thumbnails. When a user hovers over a thumbnail, the image enlarges. The *trick* is, I want the "active area" to only be the size of the thumbnail. That is, the thumbnails are 180x120, and when the mouse leaves that area, I want the large image to shrink back to normal size.
I have a working demo here:[url]
The way I accomplished this feels hacky though, and I's like to know if there's a simpler/more elegant way to accomplish it. The thumbs are an unordered list of images.
Here is my javascript:
In essence, I add an overlay div over each thumbnail which acts as the trigger to shrink the enlarged image. I thought I could use the parent <li>, as it doesn't appear to expand with the image (since I've set its size in my CSS) but that didn't work.
I am currently building a simple photogallery. The photogallery contains a box with a few photo's in it, lined up horizontally. The box where the photo's are placed in is using an overflow so that there are only shown a few photo's. Below the box i have two buttons, left and right. The idea is simple if you click the left button the photo's must go 50 px to the left and visa versa goes with the right. I have coded this but the photo's unfortunately won't move! Have i done something wrong? You can see my code here:
View 2 Replies View RelatedI need an image to move from outside the viewed space, from somwhere on the page where users cannot hav acces, let's say from x position of -439px to 0px, so that the image looks like entering the window. And I need to do this after the user clicks a piece of text that is already on the screen. How can I do that ? In what tag should I include the image ? where should I put de event handler/ listener ? I know I need to change the CSS atributes but how. I tried this and it didn't work in Firefox nor in IE. THE HTML FILE
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
[code]....
I'm trying to make something a little like seen on Google Maps where you can search the location in text box and the map corresponding to the location will be dispalyed. Can any one send me the Javascript for the following in which my image is paced in an iframe and the upon entering the loaction in a textbox it image must move to that position witin the iframe.
View 1 Replies View RelatedI have been tasked with using javascript to move an image of a bus across the screen from right to left. I have found some code that almost works, but I cannot get the bus to finish offscreen. I have tried changing the x-position to a negative number, but it doesn't seem to work. If there are any javascript gurus out there, take a look at the sample code at :[url]
How to modify the existing code to achieve the desired effect.
How to make a cloud like the websites below to move ?[URL]
View 5 Replies View RelatedI have used draggable, and yes, the image can be moved by the user inside the div.when using the containtment:'parent' the image can not get out of the parent div,BUT I need some more functionality than that:In my app the image can be zoomed out / in When zooming out the image can grow more than the parent container then I need:
1. the image can keep growing with out affecting the dimensions of the container
2. the draggable function should still be usable so the user can see the rest of the image by dragging it.
Basically it's the same function that we use when we zoom in in photoshop and then we can move the image to see those areas that get out of the visible scope.
I'm trying to move an image with the following JS function, but it only seems to work when I remove the XHTML doctype from the top of the document.
Here's the javascript:
Code:
I read something about this on another forum and I think it has something to do with the declaration of obj.style.top, but I can't find a solution. I've tried creating a new variable that contains "document.getElementByID(obj)" and then using that variable to change the top of the image, but it still doesn't work.
The idea is move the foot to room no.1 .. but i want to see the foot moving on the red line to the room :(
Like this pic : [url]
I am trying to move an image down 20px each time the button is clicked, but I can only get it to move down once. I see what I am doing wrong, but I'm not sure how to fix it. I don't know how to store the updated position of the image in a variable.
View 5 Replies View RelatedI have an assignment doing something simple with javascript, but I'm lost because I can't figure out what I am doing wrong. This is the assignment. I'm using the code provided and modifying it as stated, but I cannot get the image to move. My textbook doesn't provide answers (it honestly has just 2 chapters devoted to javascript) that I can find. Here is my code
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 TransitionalEN"
"http:www.w3.org/TR/xhtmll/DTD/xhtmll-transitional.dtd">
[code]....
I have a gallery that has back/next links below the main image, but I want them to be on each side of the image instead.
My current code looks like this:
Code:
<center>
<br class='clearit' />
<div id="main_image_wrapper">
[Code]...
I'm just not sure how to best do this. And I want the links centered to the height of the image.
This is meant to be a very simple animation. Everything seems to be correct, but it doesn't seem to run. Basically it is a system where the image is 50px taller than the box it is being displayed in. When you hover over the image, the image is meant to move up via jquery to show the bottom (previously hidden) 50px and cut off the top 50px.
Here is my Site: [URL]
Here is my HTML:
Code:
<div id="container"><div>
<a class="none" href="<?php the_permalink() ?>"><img src="/themes/smo/portfolio/<?php echo get_post_meta($post->ID, 'portfolio_img',true).".gif"; ?>" alt="" /></a>
</div></div>
Here is the Jquery:
Code:
$(function(){
$("div.container div a").hover(function(){
$("img", this).stop().animate({top:"-51px"},{queue:false,duration:200});
}, function() {
$("img", this).stop().animate({top:"0px"},{queue:false,duration:200});
});
I think its something to do with the container class.
I have two grids, they both display buttons. One grid displays numbers, true or false and yes or no, and the other grid displays letters, true, false, yes and no.
The second grid is not displayed in the code (used css to not display second grid buttons (.answerBtns)) Now using the getButtons() function, if the user selects button "1" in first grid (the grid which you have to open using (Open Grid) link, then it should display button "A" in second grid, if user selects button "2" in first grid, then it should displays buttons "A" and "B" in second grid, if "3" then display "A", "B" and "C" and so on.
Now except using if statements and stating which buttons should be displayed and not displayed depending on the button chosen in first grid, is there a more efficent way of coding this so that the display of buttons in second grid depends on what is selected in the first grid?
If it is using an array can somebody show a sample of this in their answer. You can just do it for one example and then I should be able to use that to fill it for the other buttons.
This is a resizeable grid similar to ones found on windows OP, the xml version also has a sort function, but thats not posted here.
Note: a few thing could be done better (or different), but for times sake lets just say it works without error.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Sort Grid</title>
<style type="text/css"><!--
body{margin:0px;}
/* GRID STYLES */
#grid tbody td,#grid tfoot td
{
border-color: white ThreedHighlight ThreedHighlight white;
border-width: 0px 1px 1px 0px; border-style: solid;
padding: 0px 0px 0px 0px;
font-size: 14px;
cursor:default;
}
#grid tfoot td
{/* If used. */
border-color: white ThreedHighlight ThreedHighlight ThreedHighlight;
border-width: 0px 1px 1px 1px;
}
#grid tbody .FCol
{
border-left-color: ThreedHighlight;
border-left-width: 1px;
}
#grid .grabberH,#grid .grabberHF,#grid .grabberHE,#grid .grabberL,#grid .grabberR /* t r b L */
{
background-color:ButtonFace;border:outset;line-height:16px;
}
#grid .grabberHF
{
border-width: 1px 0px 0px 1px; padding: 0px 0px 0px 0px;cursor:default;font-size:14px;
}
#grid .grabberH
{
border-width: 1px 0px 0px 0px; padding: 0px 0px 0px 0px;cursor:default;font-size:14px;
}
#grid .grabberHE
{
border-width: 1px 2px 0px 1px; padding: 0px 0px 0px 0px;cursor:default;
}
#grid .grabberL
{
border-width: 1px 0px 0px 1px;
}
#grid .grabberR
{
border-width: 1px 2px 0px 0px;
}
#grid .grabberL,#grid .grabberR
{
cursor:col-resize;padding:0px;
}
#grid .ender
{
width:0px;
}
#grid span
{
padding: 0px 3px 0px 3px;
}
#grid .grabberH span
{
padding: 0px 0px 0px 0px;
}
#grid .grabberHF span
{
padding: 0px 0px 0px 3px;
}
-->
</style>
<script language="JavaScript"><!--
/*RESIZABLE DOM GRID - (C) COPYRIGHTED DON WATSON 2003 ALL RIGHT RESERVED - DONWATS@USA.COM*/
function mouseevent(elm, _event, _function)
{
elm.attachEvent(_event, _function)
}
function mousedetach(elm, _event, _function)
{
elm.detachEvent(_event, _function)
}
function resizeGrid()
{
var srcElem = event.srcElement;
if(srcElem.tagName !=="TD")
{
try{
while(srcElem.tagName !=="TD")
{
srcElem = srcElem.parentNode
}
}
catch(e)
{
return
}
}
if(srcElem.className != "grabberL")
{
if(srcElem.className != "grabberR")
{
return
}
}
var expandingTDTemp = srcElem;
try{
while( expandingTDTemp.className !="grabberH" && expandingTDTemp.className !="grabberHF" )
{
expandingTDTemp = expandingTDTemp.previousSibling;
}
}
catch(e)
{
return
}
expandingTD = expandingTDTemp;
/*lets get the rule (css)*/
ruleNum = expandingTD.firstChild.className; /*assume its the span*/
ruleNum = ruleNum.substr(ruleNum.length-1,1);/*strip the num off the end*/
lastrack = event.x;
finalW = expandingTD.offsetWidth;
createBar();grabElm(srcElem);
}
var grabberElm, finalW, expandingTD, lastrack, ruleNum;
function grabElm(srcElem)
{
grabberElm = srcElem;
grabberElm.setCapture(false);
mouseevent(grabberElm, "onmouseup", letGo);
mouseevent(grabberElm, "onlosecapture", dubbleCheck);
mouseevent(document, "onmousemove", resizeT);
}
function dubbleCheck()
{
window.setTimeout(letGo, 200, "JavaScript")
}
function letGo()
{
if(!document.getElementById("resizebar"))
{
window.clearTimeout();
return
}
grabberElm.releaseCapture();
mousedetach(grabberElm, "onmouseup", letGo);
mousedetach(grabberElm, "onlosecapture", dubbleCheck);
mousedetach(document, "onmousemove", resizeT);
document.styleSheets.rowspans.rules[ruleNum].style.width = 0;
finalW<0?finalW=1:0;expandingTD.width=finalW;
document.styleSheets.rowspans.rules[ruleNum].style.width = expandingTD.offsetWidth;
destroyBar();
}
function resizeT()
{
currentrack = event.x;
if( currentrack > lastrack )
{
finalW += currentrack - lastrack
}
else if( currentrack < lastrack )
{
finalW -= lastrack - currentrack
}
document.getElementById('resizebar').style.left = [ currentrack + document.body.scrollLeft - document.body.clientLeft ];
lastrack = currentrack;
}
function createBar(){
var _body = document.getElementsByTagName('body').item(0);
bar = document.createElement("DIV");
bar.id = "resizebar";
bar.style.backgroundColor="silver";
bar.style.width=3;
bar.style.height=document.body.clientHeight;
bar.style.position= "absolute";
bar.style.top=document.body.scrollTop;
bar.style.left= [ event.x + document.body.scrollLeft - document.body.clientLeft ];
_body.appendChild(bar);
}
function destroyBar(){
var _body = document.getElementsByTagName('body').item(0);
bar = document.getElementById('resizebar');
if(bar) _body.removeChild(bar);
}
//-->
</script>
</head>
<body>
<table id="grid" width="100%" border="0" cellspacing="0" cellpadding="0">
<thead>
<tr onMouseDown="resizeGrid()">
<td width="140px" nowrap class="grabberHF"><span class="col0">Artist</span></td>
<td width="3px" nowrap class="grabberR"><div class="ender"/></td>
<td width="3px" nowrap class="grabberL"><div class="ender"/></td>
<td width="250px" nowrap class="grabberH"><span class="col1">Venue</span></td>
<td width="3px" nowrap class="grabberR"><div class="ender"/></td>
<td width="3px" nowrap class="grabberL"><div class="ender"/></td>
<td width="120px" nowrap class="grabberH"><span class="col2">Title</span></td>
<td width="3px" nowrap class="grabberR"><div class="ender"/></td>
<td width="3px" nowrap class="grabberL"><div class="ender"/></td>
<td width="45px" nowrap class="grabberH" align="center"><span class="col3">Media</span></td>
<td width="3px" nowrap class="grabberR"><div class="ender"/></td>
<td width="3px" nowrap class="grabberL"><div class="ender"/></td>
<td width="100px" nowrap class="grabberH" align="right"><span class="col4">Date</span></td>
<td width="5px" nowrap class="grabberR"><div class="ender"/></td>
<td width="100%" class="grabberHE"><div class="ender"/></td>
</tr>
<thead>
<tfoot>
<tr><td nowarp colspan="15"><!--footer not needed--></td></tr>
</tfoot>
<tbody>
<tr>
<td colspan="2" class="FCol"><span class="col0">Column 1</span></td>
<td colspan="3"><span class="col1">Column 2</span></td>
<td colspan="3"><span class="col2">Column 3</span></td>
<td colspan="3" align="center"><span class="col3">SHN</span></td>
<td colspan="3" align="right"><span class="col4">04-19-1998</span></td>
<td><div class="ender"/></td>
</tr>
</tr>
<td colspan="2" class="FCol"><span class="col0">Column 1</span></td>
<td colspan="3"><span class="col1">Column 2 - this span uses overflow : ellipsis</span></td>
<td colspan="3"><span class="col2">Column 3</span></td>
<td colspan="3" align="center"><span class="col3">MP3</span></td>
<td colspan="3" align="right"><span class="col4">09-16-1983</span></td>
<td><div class="ender"/></td>
</tr>
<tr>
<td colspan="2" class="FCol"><span class="col0">Column 1</span></td>
<td colspan="3"><span class="col1">Column 2</span></td>
<td colspan="3"><span class="col2">Column 3</span></td>
<td colspan="3" align="center"><span class="col3">SHN</span></td>
<td colspan="3" align="right"><span class="col4">03-01-1969</span></td>
<td><div class="ender"/></td>
</tr>
</tr>
<td colspan="2" class="FCol"><span class="col0">Column 1</span></td>
<td colspan="3"><span class="col1">Column 2 - this span uses overflow : ellipsis</span></td>
<td colspan="3"><span class="col2">Column 3</span></td>
<td colspan="3" align="center"><span class="col3">MP3</span></td>
<td colspan="3" align="right"><span class="col4">01-20-2001</span></td>
<td><div class="ender"/></td>
</tr>
<tr>
<td colspan="2" class="FCol"><span class="col0">Column 1</span></td>
<td colspan="3"><span class="col1">Column 2</span></td>
<td colspan="3"><span class="col2">Column 3</span></td>
<td colspan="3" align="center"><span class="col3">SHN</span></td>
<td colspan="3" align="right"><span class="col4">10-29-1988</span></td>
<td><div class="ender"/></td>
</tr>
</tbody>
</table>
<script language="JavaScript"><!--
function setStyles(){
var _head = document.getElementsByTagName('head').item(0);
var dss = document.createElement("STYLE");
dss.id = "rowspans";
_head.appendChild(dss);
var _table = document.getElementById("grid");
var _tr = _table.getElementsByTagName("TR")[0];
var _td = _tr.getElementsByTagName("TD");
var colnum = 0;
for(i = 0; i < _td.length; i++)
{
if(_td[i].className != "grabberL")
{
if(_td[i].className != "grabberR")
{
document.styleSheets.rowspans.addRule(".col"+colnum+"","width:"+ _td[i].width +"");
colnum += 1;
}
}
}
document.styleSheets.rowspans.addRule("#grid span","overflow: hidden;text-overflow: ellipsis;white-space: nowrap;");
//alert(document.styleSheets.rowspans.cssText);
}
setStyles(); /* After resize grid, or onload event. */
//--></script>
</body>
</html>
Should work on IE5.5+ and recent Mozilla clones.
Download size ~30K
Open source (GPL license)
Not released yet, no API documentation (will be soon)
Basically the question is - does it make sense at all? What's your current experience with client-side widgets - too slow, too heavy or there is still a place for things like that?
we are now developing complex business application using Ajax
framework. Could anyone point me to the editable javascript grid
control which supports XML loading. Good javascript API would be a
plus. And rather important thing - sometimes we need to represent
hierarchically structured data, so tree view is a must. In most grid
controls I looked through this last thing was missed.
I just started using JQuery and I have a lot of questions, but this is the most complicated one:
I'm trying to show a dialog using Jquery UI. The problem is that into my dialog I'd like to insert a (dynamic) grid using JQGrid. is this possible, or I should create a normal html table?
How exactly does the sizing of the grid work? I have a grid that I've tried to experiment with and it seems like no matter what setting I use, there is a vertical and a horizontal scrollbar. the only thing that changes is if it stretches to fill the its container div. How do I get it to fit within a specific width and also to not display scrollbars?
View 3 Replies View RelatedCheck this URL [url]
Grid on above link is made in dotnet. i want to make same UI as in Java. which technologies should be used that can be easy to use with java.
How i create the nested grid using GWT API's.