CSS + Animate - Post ID 204998

User 2924428 Photo


Registered User
1,718 posts

Hey guys, this ones for Eric, the code I got from your website to animate a picture is working, but for only one picture, can you help please? Here is the code..
/header
<script src="js/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#imgname').width(250);
$('#imgname').mouseover(function()
{
$(this).css("cursor","pointer");
$(this).animate({width: "400px"}, 'slow');
});

$('#imgname').mouseout(function()
{
$(this).animate({width: "250px"}, 'slow');
});
});
</script>

<body>
<img src="images/dragon_thumb.png" alt="dragon" id="imgname">

<img src="images/dragon_thumb2.png" alt="dragon2" id="imgname">

<img src="images/dragon_thumb3.png" alt="dragon3" id="imgname">
User 122279 Photo


Senior Advisor
14,624 posts

I don't know this particular script (and I couldn't find it on Eric's help site), but one thing that does work, is to repeat the script in the head for each image, renaming 'imgname' to 'imgname2' and 'imgname3' etc, and then also modify the IDs of the images accordingly.

But maybe Eric has a smarter solution... ;) In CSS you can't have the same ID more than once on a page. I'm no expert on js, but maybe it has the same rules about IDs.

Check out the mockup I'm attaching.
Attachments:
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 187934 Photo


Senior Advisor
20,266 posts

Which page of mine did you get that from Max?:)
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2924428 Photo


Registered User
1,718 posts

Hello Inger, and Eric. Inger that's a great idea I never thought of that thanks! Eric it's off of http://progrower.coffeecup.com/picsmouseover.html
But i'm going to try Ingers code really quick too :)
User 2924428 Photo


Registered User
1,718 posts

It worked! But my menu backround went away! I changed my site to www.teampbpc.com by the way no more kingfizz.com.
User 187934 Photo


Senior Advisor
20,266 posts

Hit ctrl + d on your keyboard.
Looks like there's a <div> tag missing or an extra </div> tag.:)
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2924428 Photo


Registered User
1,718 posts

It works! Thank you Mr Rohloff!
User 187934 Photo


Senior Advisor
20,266 posts

Your welcome.;)
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.