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

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

QA

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

답변 1

본문

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

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

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

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

 


<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>";
?>
 

이 질문에 댓글 쓰기 :

답변 1

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

https://sir.kr/g5_skin/10534 

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 33
© SIRSOFT
현재 페이지 제일 처음으로