image - jquery animating different img widths -


I'm not taking any benefits for a long time, so it's time to ask I .animate () < Trying to use / code> so that the image can be clicked on. The first state of the image will be a thumbnail size, again in the original size of the image, then on a thumbnail.

Edit: Pictures are loaded with a width of 150px by default.

The problem is that not all images have "basic" sizes, so I need to tell a normal function to switch to the original size of the current image.

This is my current code that loads $ (window). Load:

  $ ('img [class = resize]'). Value ({width: '150px'}, 400);} and {$ (this). Value ( {Width: ''}, 400);}});  

Now clearly the way I want it does not work, because .animate () thinks when I say Width: '' I want to make width = 0. Any suggestions on how I should go about this?

Here's an idea: When you write an image on the page, add a class or some other attribute , Which is the original width of the image, then when you change it to its original size, then try $ (this). ({Width: $ (This) .attr ('original_size_attribute_of_your_choosing')}, 400);

TL, DR: Save the original size in each feature of each image.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -