2011-11-24 50 views
5

我對IE有問題(真是一個驚喜)。我在我的頁面上發佈了一個問題報告功能(報告不好的圖像...)。我想通過幾個問題(理由報告...)顯示「報告此圖像」的簡單形式。它應該在點擊報告圖像後顯示。它適用於FF和Chrome,但IE中存在問題。 Div應該在鼠標點擊位置顯示。第一次它顯示在正確的位置,但是當我關閉它並單擊另一個報告圖像而不重新加載頁面(網站上有更多報告圖像)時,它會再次顯示在第一次顯示的相同位置(僅在IE )。 這裏是我的代碼:IE中的jQuery工具提示定位問題

$(document).ready(function(){ 
    $(".proofreporter").click(function(e){ 
    $('.popup').remove(); //used to remove previously shown elements 

    $.ajaxSetup ({ 
    // Disable caching of AJAX responses 
     cache: false 
    }); 


    // setTimeout(function(){$('.popup').remove()},2000); 

    var name = $(this).attr('id'); 
    function showData(data) { 
     $("body").append(data); 
    } 
    //x = e.pageX; first I tried this to get position but same result 
    //y = e.pageY; 

    var pos = $(this).offset(); 
    x=pos.left; 
    y=pos.top; 

    alert(x + 'x' + y); 
    $.get('includes/reporter.php?reportimgdiv=' + name + '&x=' + x + '&y=' + y, showData); 
    }); 
}); 

這裏是reporter.php

if(isset($_GET['reportimgdiv'])) 


{  //report IMAGE 
    ?> 
    <style type="text/css">                                
    .popup {   //SOLVED; change to this: #<?echo report$_GET['reportimgdiv']?> 
    position: absolute; 
    left: <?echo $_GET['x'];?>; 
    top: <?echo $_GET['y'];?>; 
    z-index: 100; 
    width: 280px; 
    } 
    .subtle { 
    margin: 0px; 
    padding: 5px; 
    border: 2px solid gray; 
    font-size: small; 
    text-align: left; 
    background-color: #EEE; 
    color: #444; 
    } 
    </style> 
    <? 
    $imgid=$_GET['reportimgdiv']; 
    ?> 
    <div id="reportForm001" class="popup" style="margin-top: 0em; "> //solved: change id="report<?echo $imgid?>" 
    <!-- 
    <form name="form1" method="post" target="reportframe" action="update/pagereportframe.php" class="subtle" style="position: relative; left: 1em; top: 2px;"> 
    --> 
    <form name="form1" method="post" target="reportframe" action="includes/reporter.php" class="subtle" style="position: relative; left: 1em; top: 2px; background-color: white" >  
    <input name="id" type="hidden" value="<?echo $imgid; ?>"> 
    <div style="position: absolute; right: 1em; font-size: x-small"><a href="#" onClick="jQuery('.popup').remove();">CLOSE [X]</a></div> 
    <h3>What is wrong with this image? <?echo $_GET['x'];?> X <?echo $_GET['y'];?> </h3> 
    <input type="radio" name="reason" value="1"> BLAH BLAH/b>. <br> 
    <input type="radio" name="reason" value="2"> BLAH BLAH/b>. <br> 
    <br>Comment (optional):<br> 
    <textarea name="comment" rows="3" style="width: 100%"></textarea><br> 
    <input value="Submit" type="submit"> 
    </form> 
    </div> 
<? 
    } 
+6

您可以發佈自己的答案並將其標記爲 –

回答

0

解決

我現在用的ID(而不是類),以確定POPUP div的代碼。查看reporter.php代碼評論更多信息