Skip to content

CHICPRO

  • Life Log
  • Cycling Log
  • Photo Log
    • Portrait
    • Landscape
    • Flower
    • Etc
  • Coding Log
  • Information

IE에서 jQuery removeAttr()가 적용되지 않는 문제

2012-05-19 by 편리

오늘도 출근해서 열심히 코딩 작업 중인데.. DIV 태그 안에 title 속성을 줬더니 마우스 오버시 툴팁으로 보여진다.

아래 그림처럼 그래프에서 방문자수를 표시하는 것인데.. title 속성에 방문자수를 저장해서 jQuery를 이용해서

방문자수를 레이어를 보여주는 것인데 툴팁이 보이는 것은 도무지 용서가 되지 않아서 머리를 좀 써봤는데.. ㅋ

그래프 위쪽으로 나오는 것만 있으면 되는데.. 툴팁은 정말 아닌 것 같아서 jQuery removeAttr()를 이용해서

title 속성을 제거해봤는데.. 그래도 계속 표시가 되는 것이다. 아래는 처음에 시도했던 JS 코드의 일부분이다.

$(function() {
    $(‘#GraphArea .graph_area div[id^=graph]’).hover(
        function(e) {
            var pos = $(this).position();
            var left = pos.left – 40;
            var top = pos.top – 55;
            var info = $(this).attr(“title”).replace(“일 “, “일<br />”).replace(“:”, “:<span>”).replace(“명”, “명</span>”);
            $(this).data(“title”, $(this).attr(“title”)).removeAttr(“title”);

            $(‘div.infoPopup div.info’).empty().html(info);
            $(‘div.infoPopup’).css(“left”, left).css(“top”, top).show();
        },
        function() {
            $(this).attr(“title”, $(this).data(“title”));
            $(‘div.infoPopup’).hide();
        }
    );
});

jQuery data()를 이용해서 속성 제거 전 값을 저장하고 마우스가 영역을 벗어나면 다시 속성을 지정해 주는 식으로

구성을 했는데.. 이렇게 해도 IE 환경에서는 보기싫은 툴팁이 사라지지 않아서 아래처럼 약간 코드를 수정해봤다.

$(function() {
    $(‘#GraphArea .graph_area div[id^=graph]’).hover(
        function(e) {
            var pos = $(this).position();
            var left = pos.left – 40;
            var top = pos.top – 55;
            var info = $(this).attr(“title”).replace(“일 “, “일<br />”).replace(“:”, “:<span>”).replace(“명”, “명</span>”);
            $(this).data(“title”, $(this).attr(“title”)).attr(“title”, “”);

            $(‘div.infoPopup div.info’).empty().html(info);
            $(‘div.infoPopup’).css(“left”, left).css(“top”, top).show();
        },
        function() {
            $(this).attr(“title”, $(this).data(“title”));
            $(‘div.infoPopup’).hide();
        }
    );
});

속성을 제거하는 대신  속성 값을 없애주니까 더 이상 툴팁이 표시가 되지 않았다. 이게 맞는 방법인지는 모르겠다.

Post navigation

Previous Post:

2012 World IT Show(WIS)

Next Post:

가든파이브 2012년 5월 19일 가드너 공연, 밸리댄스

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

  • SK 세븐모바일 유심 셀프교체
  • php 배열 연산에서 + 와 array_merge 의 차이
  • pcntl_fork 를 이용한 다중 프로세스 실행
  • 아이폰 단축어를 이용하여 주중 공휴일엔 알람 울리지 않게 하기
  • 구글 캘린더 전체일정 재동기화
  • OpenLiteSpeed 웹서버에 HTTP 인증 적용
  • OpenLiteSpeed 웹어드민 도메인 연결
  • WireGuard를 이용한 VPN 환경 구축
  • Ubuntu 22.04 서버에 OpenLiteSpeed 웹서버 세팅
  • 맥 vim 세팅

Recent Comments

  • 편리 on 업무관리용 그누보드 게시판 스킨
  • 임종섭 on 업무관리용 그누보드 게시판 스킨
  • 캐논 5D 펌웨어 | Dslr 펌웨어 업그레이드 방법 82 개의 베스트 답변 on 캐논 EOS 30D 펌웨어 Ver 1.0.6 , EOS 5D 펌웨어 Ver 1.1.1
  • Top 5 캐논 5D 펌웨어 Top 89 Best Answers on 캐논 EOS 30D 펌웨어 Ver 1.0.6 , EOS 5D 펌웨어 Ver 1.1.1
  • 편리 on 워드프레스 애니메이션 gif 파일을 mp4로 변환하여 출력하기
  • 임팀장 on 워드프레스 애니메이션 gif 파일을 mp4로 변환하여 출력하기
  • 편리 on Notepad++ NppFTP 플러그인 수동 설치
  • paul-j on Notepad++ NppFTP 플러그인 수동 설치
  • YS on Windows 10 iCloud 사진 저장 폴더 변경
  • 편리 on Docker를 이용한 Centos7 + httpd + php 5.4 개발환경 구축

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
© 2025 CHICPRO | Built using WordPress and SuperbThemes