Jump to content
php.lv forumi

jquery funkcija ar vairākiem id


ziedinjsh

Recommended Posts

tik tālu esmu ticis, bet netieku skaidrībā ar lietu sekojošu

jquery


$(function(){
$('#video').mouseover(function(){
$('#videoi').fadeIn();
});
$('#video').mouseleave(function(){
$('#videoi').fadeOut();
});

});  

php


while($data = mysql_fetch_array($video)){
$id = $data['id'];
echo "
<div id='video' style='background-image:url(http://img.youtube.com/vi/".$data['code']."/1.jpg);'>
<div id='videoi'>
".$data['title']."
</div>
</div>
";
}

man viņš iefeidot tikai pirmo.. kā panākt lai viņš iefeidot katru uz kuru es uzbraucu ar pelīti!?!?

Edited by ziedinjsh
Link to comment
Share on other sites

es laikam nesaprotu kā tās jāizdarta


$(function(){
$('#video'+ID).mouseover(function(){
$('#videoi').fadeIn();
});
$('#video'+ID).mouseleave(function(){
$('#videoi').fadeOut();
});

});  

 

<div id='video".$data['id']."' class='video' style='background-image:url(http://img.youtube.com/vi/".$data['code']."/1.jpg);'>

Link to comment
Share on other sites

Pārsauc id="video" par class="video".

Nahrenizē id="videoi".

 

Dokumentā katram ID jābūt unikālam.

 

Un:

 

$('.video').hover(
  function () {
$(this).children().fadeIn()
  },
  function () {
$(this).children().fadeOut()
  }
);

Edited by mad182
Link to comment
Share on other sites


$('.video').mouseover(
  function () {
       $(this).children().fadeTo(150, 1)
  },
  function () {
       $(this).children().fadeTo(150, 0.25)
  }
);

 


while($data = mysql_fetch_array($video)){
echo "
<div id='".$data['id']."' class='video' style='background-image:url(http://img.youtube.com/vi/".$data['code']."/1.jpg);'>
<div>
<a href='".url."video.php?do=play&id=".$data['id']."'>".$data['title']."</a>
</div>
</div>
";
}
}

 

tagad man rādād uzreiz video nosaukums.. vajadzētu kad uzbracot ar peli uz div, tad lai rāda

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...