Sunday 15 June 2014

javascript - Jquery image alt on hover -



javascript - Jquery image alt on hover -

i have 1 question image alt on hover image.

i have create fiddle

in fiddle can see there big , smole images. when hoverover smole image big image changing.

what want do. want add together alt big image. in demo shows alt smole images. code said undefined. need showing alt big images.

$(document).ready(function() { var = $(this).attr('alt'); $("#magazin_sldwr li img").hover(function(){ cleartimeout(autoscrollertimer); $(this).parent('li').addclass('active').siblings().removeclass('active'); $('#mainm-img').attr('src',$(this).attr('src').replace('thumb/', '')).parent().attr('href',$(this).parent().attr('href'),$(this).parent().append('<div class="title">' + + '</div>')); }, function(){ autochangeimage(); });

for undefined problem: you're setting variable a $(this).attr('alt') early, before $(this) thumbnail.

try setting in function pass hover(), so:

$(document).ready(function() { var a; $("#magazin_sldwr li img").hover(function(){ = $(this).attr('alt'); cleartimeout(autoscrollertimer); $(this).parent('li').addclass('active').siblings().removeclass('active'); $('#mainm-img').attr('src',$(this).attr('src').replace('thumb/', '')).parent().attr('href',$(this).parent().attr('href'),$(this).parent().append('<div class="title">' + + '</div>')); }, function(){ autochangeimage(); });

for showing other alt text, you'll have more detailed in question.

javascript jquery

No comments:

Post a Comment