JQuery :: To Change Height Of Sprite Image
Nov 19, 2011
I am trying to do something with a sprite image, which is changing the height of it when an action button is clicked. The sprite image is 602x5485px. For clarity here's the link [url] and here's the image [url] and when the "Run sequence" button is clicked the height of the background image is supposed to change (each image is 602x399) so I need to add another 399px to move to the next one. The sequence will run till the last picture and then come back so that it gives a kind of movie animation (so in brief adding 399px till it reaches the last pic and then removing 399px till it gets to the first one).
Here's the html page without the script:
HTML Code:
And here's the css just for the sprite image:
Code:
Ok let's get to the script now (which won't be an external file but within the html page, I separated it temporarily for the sake of clarity). What the script should do, I think, is to get the background image which is in the css, and change the css background position adding - as said - 399px. When it gets to the end, remove 399px till it gets to the first image.
So in practice here are my last (believe me of many!) attempt:
Code:
I am not sure whether this is correct but I am not quite sure how to continue. The thing is, I want to change the height of the background image as said and the above should change at least one image but it doesnt work. If somebody has the patience to talk me through that (I am a beginner so I would like to attempt to build the code myself.
View 1 Replies
ADVERTISEMENT
Jan 8, 2011
I am trying to develop a mouseover effect on an image sprite. Half of the image is a colour version and the bottom half is a grayscale version. I want to start with the grayscale version and fade into the colour version.I would normally use :hover on the css element but as the image is defined in the DOM and not a background image im slightly confused.[URL]
View 4 Replies
View Related
Jun 16, 2011
I'm using jQuery with a sprite--moving the background image 100px when the user mouses over to display the "over" state. Seems terribly simple, but for some reason I can't get it working. Note that it works fine when implemented with a traditional a:hover {background-position: 0 -100px} in CSS.
jQuery:
$("#login-sprite").mouseover(function() {
$(this).addClass("login-sprite-overstate");
});
[code]....
View 1 Replies
View Related
Feb 23, 2011
I have to change a div height, when I click a button. At the moment, I use this code :
$('#map-trigger').click(function() {
if( $('#map-container').hasClass('closed') ) {
$('#map-container').css('height', '581px');
}
[Code].....
This works. But the height is "instantly" updated. I'd like this effect to be smoother : The height should "slide" from 294px to 581px.
View 1 Replies
View Related
Nov 24, 2010
I use a CSS-Menu with this structure:
<div class="tabs">
<ul class="menu">
<li id="item-1">
<a href="#item-1">Tab 1</a>
[Code]....
Via CSS .tabs will be position:relative and the divs within the li are position:absolute to stack. This works fine.
Unfortunately, in some cases the content of li is too height and overflow the parent. I'm looking for a way to find out the displayed li and this height to apply it on the parent elements (CSS) height.
View 3 Replies
View Related
May 29, 2009
I have the following layout.
.panel
{
position:relative;
width:580px;
[Code]....
The parent (class="panelContent") div contains a child element that is generated/rendered last. This makes the child element #ReportViewer1 overlap the parent (class="rptViewer"). Can I jQuerytize the parent div to adjust it's size after the child renders so it is contained/displayed in the parent?
View 3 Replies
View Related
Oct 13, 2011
how to change basic settings etc.But I have a problem changing the height of the following "news-ticker"
[URL]
You can see that I have different length of text in the testimonials and they appear now with fixed height. Where can I change the height so it's flexible to the amount of text. I've tried to changed it in the <li> and the <ul> but that didn't worked for me.
View 6 Replies
View Related
Jun 14, 2010
I am trying to write a script to get my sprite to move to the next row once it reaches the last frame on it's current row.
Here's my attempt so far; in the code below I want bird2 when it reaches frame 3 and spState(1) - this means first row - to switch to spState (2) second row.
if ($('#bird2'['current_frame']) == 3 && $('#bird2').spState(1)) {
$('#bird2').spState(2);
} else {
$('#bird2').spState(1);
[Code]....
this is from [URL] you will notice on this site that if you drag the slider to the left the bird sprites change direction, in fact they play the second row of frames.
The reason I want my bird sprite to go automatically to the next row is because I am using video turned into individual frames and a png strip, and I am limited by the max width of png (8192px). see [URL] scroll down to see the bird on the rooftop. Each frame in that bird sprite is 80px wide and there are 93 frames. So I would like to include multiple rows to allow me to increase the number of frames. Up to 15 rows will be needed and after the last row it should go back to the first row. Perhaps a switch statement would be better than what I currently have.
I am new to JavaScript and have been trying to pick up clues from [URL] I am very happy to learn and I hope to be prompted and pushed in the right direction.
View 4 Replies
View Related
Sep 30, 2009
I am new to jQuery & Superfish, but it seemd like the most logical way to do a quick prototype for a menusystem. I am trying to create a verertical menu system (using superfish-vertical). However, I'd like to tweak the behaviour of the submenu, and have been unsuccessful so far. Here's what the current solution does (straight out of the box) assume menu item 3 is hovered over:
[Code]...
View 2 Replies
View Related
May 22, 2010
I'm just starting my first jQuery project (tutorial from this months Web Designer) and I've got a background image that I want to spread across the entire background, regardless of browser size. It's big, so I originally had an onload function. This works fine in Mozilla and Safari but not in IE.
My question is, can jQuery set a width and height of 100% and have it work in IE?[code]...
View 2 Replies
View Related
Oct 30, 2011
I have a strange issue with jQuery while using the following code :
$("#image").append('<img src="'+json.filename+'" id="cropje" alt="None" />');
$('#cropje').load(function() {
alert($(this).width());
}) .error(function(){
alert("FAIL TO LOAD IMAGE");
And the result is : 0 But it looks like the image gets loaded after the alert... How is that possible?
View 4 Replies
View Related
Jun 24, 2010
I need to get image height without using .attr and add it to div style. I got something like that but it's not working.
<img alt="photo-current" src="images/galleries/1/photo_1.jpg" id="photo-current"/>
<script type="text/javascript">
jQuery(document).ready(function($) {
[code]....
View 2 Replies
View Related
Jun 4, 2009
how can i find the size of an image element which got loaded via ajax?
View 2 Replies
View Related
Mar 10, 2011
I have an image that I set to have a width of 100%. I want its height to be no greater than the visible height of the browser web-page area. This could distort the image, but thats OK. To makes things difficult, the image is in a div, and I want the div to be higher than the visible area. So I can't just set the div to height of 100%, and then within that set the image to a height of 100%. I know there is a javascript way of getting the height of the entire screen (screen.height) but that includes the extra areas of the browser such as toolbars etc. I know there is a 'offsetHeight' attribute, but I think I would have to use that on the BODY tag, and the BODY of the page could be several screens in height. So is there a solution to this? If there isn't then can I detect the aspect ratio of the screen?
View 3 Replies
View Related
May 25, 2011
I've set up jcarousel and configured it to work how I need it to, apart from one thing; I need the images to keep their width - height ratio when the browser is resized.
I'm using the Flexible carousel configuration and the width of the images changes appropriately when the window is resized, but the height stays the same, I need it to change.
View 3 Replies
View Related
Jan 12, 2009
How do you change the height Javascript to html because it works the first time for me but the second time it does not work
[Code]...
View 2 Replies
View Related
Aug 8, 2009
once again I have a Javascriptin' problem In my table I have a row which is hidden like so.
<tr class=\"err\" id=\"err_nameC\"><td class=\"fsa\"><b>Error: </b></td><td id=\"err_name\"><b>Unknown Error</b></td></tr>
(The slashes are because It's rendered from a PHP script)
Linked CSS classes:
[Code]...
Now, when they type into the text box the table row disappers like it should do, but it leaves a space where it was, almost like it's just turned blank but is still there. Is there anyway to make it disappear like it was at the start? I tried changing it's height but that doesn't work, when I tested the same height changing function on a visible table it worked so it can't seem to change the height of the "ghost row" as it doesn't exist.
View 2 Replies
View Related
Jul 19, 2011
I got this working in chrome and was happy until I got to check out IE8! Enough said about that.The code I have now will work (in both chrome and IE8) if I manually set the height and width of the image but I cannot get them dynamically, for instance if images have different sizes, I've been trying for a while now but cannot get anywhere with it.The code I am currently using (of my own creation) is;
$("#lightbox_image_container").html('<img id="lightbox_image" src="http://www.veritywebdesign.com/gallery/gallery_images/image.jpg" />');
$("#lightbox_image").load(function() {
// image_width = $("#lightbox_image").width();
[code]....
How do I get the height and width dynamically after loading the image?
View 1 Replies
View Related
Sep 1, 2009
I have a hidden popup that I populate with content and it dynamically expands to the size of the content. I then show the popup. When a user clicks on another link, it populates the popup with longer or shorter content. When the content is SHORTER, it seems to show the background image that I'm using expanding to the height of the previous size of the popup. I've tried setting the height manually with JS, no luck. This only happens on IE6.
View 1 Replies
View Related
Jul 29, 2010
I have a website, two divs. The right div is fixed position.However when the user browser window, is less than the height of the div, i need it to be no longer fixed, but to scroll with the rest of the page.I imagine the logic to be the following:
-detect div#right height
-if window-height is less than div#right height. change div class to xxx
-if window-height is greater than div#right height. div class stays at yyy
(must update window-height everytime window is resized)
View 2 Replies
View Related
Jul 15, 2009
This script changes the image, I wanted to know if there is a way to automatically resize the div's height and width based on the actual image proportions.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
[Code]....
View 2 Replies
View Related
Nov 5, 2011
I have two monitors (one wide screen, one square) attached to my computer I can verify how it will look in different resolutions.While doing so I came across a nasty thing: in some resolutions the content div is very small and not using all of the full browser window (left after the header section).Is it possible to make a change to the CSS min-height and max-height while the page is being loaded?I've looked into lots of samples but all depend on a click or mouse over event and didn't want to work with onload in the body tag.
View 3 Replies
View Related
May 5, 2010
How can I change the height and width of an element with Javascript? I have tried and so far I can only change either the width or height but not both, doing something like this…
Code:
<HTML>
<HEAD>
<script type = "text/javascript">
function changeSize(){document.getElementById('test').style.height = '200'}
[code]....
And this works fine but if I try to change both height and width it doesn’t work. Doing something like this doesn’t work
Code:
function changeSize(){document.getElementById('test').style.height = '200' width=’200’}
View 4 Replies
View Related
May 5, 2009
I've set the page up with an iframe because I figured then I would only have to update menu links on that main page and then there'd be less chance of missing a link somewhere along the way as new updates are added. I know this could probably be accomplished with .css, but I don't know how to do that either!
My problem is that the iframe won't adjust height to allow for the longer pages without adding scroll bar. My neighbor doesn't want it to look like its a separate box at all, so no borders and no scrolling can be used. I've tried the various solutions I've found online and either they do nothing or they stretch the page that's loading in the frame to ridiculous proportions AND still adds a scroll bar.
As I said, I haven't designed in several years and I never learned JavaScript at all. I suspect my problem is probably due to not understanding which bits of code I need to change to my iframe name. The IFrame SSI IV totally confuses me, though I do think that's the one that would ultimately work if I just knew where I was supposed to plug in my iframe name and target info.
My iframe name is, quite simply, "content" and the first page I want loaded (when someone first visits the site) is "whatisreiki.html" (my neighbor does Reiki on animals). The site is www.lovingtheanimals.com but I am working on this particular issue on www.lovingtheanimals.com/iframetest.html so that I don't totally screw up the site where visitors might be affected.
View 3 Replies
View Related
Sep 5, 2010
I'm building a website with a image menu like accordion, using jquery+easing+kwicks [URL]ith CSS, I can change the opacity of the element hovered (the opened kwick), but I'm looking to someway to change the opacity of the inactive kwicks (the images that close when you open a hovered image).I tried to do it with css, or hacking kwicks plugin, but I couldn't make it.
View 3 Replies
View Related
Jul 3, 2010
I've been using prettySociable on my site (can be downloaded here. I use the uncompressed version). I want to be able to change the tooltip (that shows up when you drag an image) to default to an image on my server, rather than to the page title. I think I've tracked down the code on line 265 of the jquery.prettySociable.js file, but I'm unsure how to change it:
[Code]...
View 4 Replies
View Related