Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将span的父元素悬停在jQuery之后在其他元素中显示span内容_Jquery_Html_Show Hide - Fatal编程技术网

将span的父元素悬停在jQuery之后在其他元素中显示span内容

将span的父元素悬停在jQuery之后在其他元素中显示span内容,jquery,html,show-hide,Jquery,Html,Show Hide,我试图弄清楚如何使它在框中悬停时,元素的span文本显示在特定的div中 HTML 好的,所以你有一些不起作用的东西。我更新了你的密码 要插入html,请使用.html函数而不是.load。此外,specs_detail不包含任何p元素,因此您不能选择它,只需使用div,或向其中添加p元素。最后,变量toLoad包含span元素,使用.text函数获取其内容。希望这能有所帮助。现在,当我从元素中移除光标时,有没有办法让它停止淡出和淡入? <ul id="specs"> <l

我试图弄清楚如何使它在框中悬停时,元素的span文本显示在特定的div中

HTML


好的,所以你有一些不起作用的东西。我更新了你的密码


要插入html,请使用.html函数而不是.load。此外,specs_detail不包含任何p元素,因此您不能选择它,只需使用div,或向其中添加p元素。最后,变量toLoad包含span元素,使用.text函数获取其内容。希望这能有所帮助。

现在,当我从元素中移除光标时,有没有办法让它停止淡出和淡入?
<ul id="specs">
  <li><a id="img1" href=""><span>ldldld</span></a></li>
  <li><a id="img2" href=""><span>ldldld</span></a></li>
  <li><a id="img3" href=""><span>ldldld</span></a></li>
  <li><a id="img4" href=""><span>ldldld</span></a></li>
  <li><a id="img5" href=""><span>ldldld</span></a></li>
  <li><a id="img6" href=""><span>ldldld</span></a></li>
  <li id="mid"><div id="specs_detail"></div></li>
</ul>
$(document).ready(function(){
  $('#specs li a').hover(function(){  

    var toLoad = $(this).find('span');
    $('#specs_detail p').fadeOut('fast',loadContent);
    function loadContent() {
        $('#specs_detail p').load(toLoad,'',showNewContent())
    }  
    function showNewContent() {  
        $('#specs_detail p').fadeIn('fast');
    }  
    return false;
 });  
});
$(document).ready(function(){
    $('#specs li a').hover(function(){        
        var toLoad = $(this).find('span').text();

        $('#specs_detail').fadeOut('fast',loadContent);
        function loadContent() {
            $('#specs_detail').html(toLoad);
            showNewContent();
        }  
        function showNewContent() {  
            $('#specs_detail').fadeIn('fast');
        }  
        return false;
    });  
});