Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-14-2013, 10:57 AM   PM User | #1
Scott R
New Coder

 
Join Date: May 2012
Location: Colorado SPrings
Posts: 18
Thanks: 2
Thanked 3 Times in 3 Posts
Scott R is an unknown quantity at this point
Wordpress post img hover effect.

I am trying to get each post to hover individually not all together. This is what I have so far. How do I get it to select each individual post not all of them?
source = http://www.ScottReinmuth.com/portfolio
Code:
$(document).ready(function(){
	$(".portfolio-thumb").mouseenter(function(){
		$(".portfolio-hover").fadeIn("slow");
	});
	$(".portfolio-thumb").mouseleave(function(){
		$(".portfolio-hover").fadeOut("slow");
	});
});
Scott R is offline   Reply With Quote
Old 01-14-2013, 04:24 PM   PM User | #2
vwphillips
Senior Coder

 
Join Date: Mar 2005
Location: Portsmouth UK
Posts: 4,355
Thanks: 3
Thanked 458 Times in 445 Posts
vwphillips is a jewel in the roughvwphillips is a jewel in the roughvwphillips is a jewel in the rough
Code:
<!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" xml:lang="en" lang="en">

<head>
  <title></title>
<script type="text/javascript" src="http://www.scottreinmuth.com/wp-content/themes/scottreinmuthcom/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">

$(document).ready(function(){
   var $els = $(".portfolio-hover");
   $els.each(function(){
      $(this).mouseenter(function(){ $(this).fadeIn("slow");  });
      $(this).mouseleave(function(){ $(this).fadeOut("slow");  });
   });
 });
</script>
</head>

<body>
<img class="portfolio-hover" src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg" />
<img class="portfolio-hover" src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg" />
</body>

</html>
__________________
Vic

God Loves You and will never love you less.

http://www.vicsjavascripts.org.uk/

If my post has been useful please donate to http://www.operationsmile.org.uk/
vwphillips is offline   Reply With Quote
Old 01-14-2013, 05:37 PM   PM User | #3
Scott R
New Coder

 
Join Date: May 2012
Location: Colorado SPrings
Posts: 18
Thanks: 2
Thanked 3 Times in 3 Posts
Scott R is an unknown quantity at this point
Quote:
Originally Posted by vwphillips View Post
Code:
<!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" xml:lang="en" lang="en">

<head>
  <title></title>
<script type="text/javascript" src="http://www.scottreinmuth.com/wp-content/themes/scottreinmuthcom/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">

$(document).ready(function(){
   var $els = $(".portfolio-hover");
   $els.each(function(){
      $(this).mouseenter(function(){ $(this).fadeIn("slow");  });
      $(this).mouseleave(function(){ $(this).fadeOut("slow");  });
   });
 });
</script>
</head>

<body>
<img class="portfolio-hover" src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg" />
<img class="portfolio-hover" src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg" />
</body>

</html>
I understand what is going on here but for some reason it is not working. Any suggestions? Now the title wont even show. I think I may have something screwed up on my site but I'm not sure. The slide effects never work either on my site for some reason. Maybe I have an old jQuery version?
Scott R is offline   Reply With Quote
Old 01-15-2013, 03:17 AM   PM User | #4
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,200
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
You will have to show your actual code instead of just re-posting Vic's code.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Reply

Bookmarks

Tags
effect, hover, image, thumbnail, wordpress

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:43 PM.


Advertisement
Log in to turn off these ads.