2012-07-26 26 views
0

我没有找到任何人有同样的问题,这是一个非常奇怪的。jquery/firefox - 动画div +显示p选择文本p?

这不是简单的解释,所以我给你下面的链接一点点解释。

首先,这里是我的代码:

<script type="text/javascript"> 
var close_feedback_box = function(){ 
    $jquery('div#feedback').removeClass('feedback_bigger').animate({ 
    top:'200px',width:'28px',height:'106px'}).find('p').hide(); 
    $jquery('div#close_feedback_box').hide('fast'); 
} 
$jquery(document).ready(function(){ 
    $jquery('div#feedback a').hover(function(){ 
    $jquery(this).addClass('hover');},function(){ 
      $jquery(this).removeClass('hover'); 
    }); 
    $jquery('div#feedback').click(function(){ 
    if(!$jquery(this).hasClass('feedback_bigger')){ 
    $jquery(this).addClass('feedback_bigger').animate({ 
      top:'147px',width:'300px',height:'212px' 
    },function(){ 
      $jquery('div#feedback p').show()}); 
      $jquery('div#close_feedback_box').fadeIn('slow'); 
    } 
    }); 
}); 
</script> 

<!-- feedback --> 
<div id="close_feedback_box" onclick="close_feedback_box();"></div> 
<div id="feedback" style=""> 
<p style="margin-top:30px;display:none;">You can take a few minutes to help us 
    improve user experience 
    <br/>and<br/><a id="">fill out our survey</a><br/>or<br/> 
<a href="/index.php?option=com_jumi&fileid=11" id="">submit a direct feedback 
    </a></p></div><!-- end feedback --> 

它的工作原理相当不错,在所有的浏览器,但只是在Firefox一看,你会明白我的问题,其实在P挡是显示它选择所有文字和我真的不明白为什么。我试图把p块放入一个内部反馈div(并显示div),它不会改变任何东西。

你会发现这里的错误(只在Firefox中):https://execboardinasia.com/(点击左侧固定位置的反馈按钮)。

非常感谢您为我花费一点时间!

巴斯蒂安桑德

+0

它看起来好像没什么问题。 – Chad 2012-07-26 02:31:33

+0

你可以尝试在你的$ jquery('div#feedback')结束时返回false。点击() – jsweazy 2012-07-26 02:39:37

+0

如果我添加一个返回false,它不能解决问题,我的内部链接不再工作了。 – BastienSander 2012-07-26 02:51:26

回答

1

的解决方法,试着在你点击()

这应该取消选择文本的末尾添加

var select = window.getSelection(); 
select.removeAllRanges(); 

...

+0

谢谢,即使它不是一个真正体面的解决方案,它的确很好用。 Bastien – BastienSander 2012-07-26 05:44:44