테스트 사이트 - 개발 중인 베타 버전입니다

게시판 리스트에서 내용 레이어 미리보기 때문에 질문 드립니다. 채택완료

미니니 8년 전 조회 3,809

리스트에서 제목에 마우스 오버하면 내용이 레이어로 나오는 건데 오류가 있어서 질문 드립니다.

잘 나오다가 갑자기 내용이 안나오고 undefined 라고 나옵니다.

새로고침하면 또 다시 잘나오다가 마우스로 제목에 여러번 왔다갔다하면 또 안나옵니다 ㅠ

이 오류 해결할수 있는 방법 없을까요?

 

[CODE]
<script type="text/javascript">
$(document).ready(function() {

 //Select all anchor tag with rel set to tooltip
 $('a[rel=tooltip]').mouseover(function() {
  
  //Grab the title attribute's value and assign it to a variable
  var tip = $(this).attr('title_tip'); 
  
  //Remove the title_tip attribute's to avoid the native tooltip from the browser
  //$(this).attr('title_tip');
  
  //Append the tooltip template and its value
  $(this).append('<div id="tooltip">' + tip + '</div>');  
    
  //Show the tooltip with faceIn effect
  $('#tooltip').fadeIn('500');
  $('#tooltip').fadeTo('10',0.9);
  
 }).mousemove(function() {
 
  //Keep changing the X and Y axis for the tooltip, thus, the tooltip move along with the mouse
   //$('#tooltip').css('top', e.pageY - 220 );
  //$('#tooltip').css('left', e.pageX -220 );
  
 }).mouseout(function() {
 
  //Put back the title_tip attribute's value
  $(this).attr('title_tip',$('#tooltip').html());
 
  //Remove the appended tooltip template
  $(this).children('div#tooltip').remove();
 });

});
</script>


<?php
$text_content = cut_str(strip_tags($list[$i][wr_content]),200," . . .");
echo "<a href='{$list[$i][href]}'rel='tooltip' title_tip='{$text_content}'><span>{$list[$i][subject]}</span></a>";
?>
[/CODE] 

댓글을 작성하려면 로그인이 필요합니다.

답변 1개

채택된 답변
+20 포인트
8년 전

아래의 링크를 참고하세요.

https://sir.kr/g5_skin/10534">https://sir.kr/g5_skin/10534 

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

미니니
8년 전
감사합니다. 한방에 되네요 ㅎㅎ 정말 감사합니다 천사별님 ㅎㅎ

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인