Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.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
Jquery 字体为JS的Div不';t在potable content div中显示_Jquery_Html_Css_Loader - Fatal编程技术网

Jquery 字体为JS的Div不';t在potable content div中显示

Jquery 字体为JS的Div不';t在potable content div中显示,jquery,html,css,loader,Jquery,Html,Css,Loader,我为我的内容div制作了一个jQuery加载器。但是它不再显示我的div class=“typeface”。这意味着我不能使用不同的字体。content div的其余部分工作正常。有人能帮我吗 Javascript代码:(用于元素) $(文档).ready(函数(){ //检查URL中的哈希值 var hash=window.location.hash.substr(1); var href=$('#nav li a')。每个(函数(){ var href=$(this.attr('href')

我为我的内容div制作了一个jQuery加载器。但是它不再显示我的
div class=“typeface”
。这意味着我不能使用不同的字体。content div的其余部分工作正常。有人能帮我吗

Javascript代码:(用于元素)

$(文档).ready(函数(){
//检查URL中的哈希值
var hash=window.location.hash.substr(1);
var href=$('#nav li a')。每个(函数(){
var href=$(this.attr('href');
如果(hash==href.substr(0,href.length-5)){
var toLoad=hash+'.html#content';
$(“#内容”).load(toLoad)
}  
});  
$('#nav li a')。单击(函数(){
var toLoad=$(this.attr('href')+'#content';
$('content').hide('fast',loadContent);
$(“#加载”).remove();
$(“#包装器”).append('LOADING…');
$('加载').fadeIn('正常');
window.location.hash=$(this.attr('href').substr(0,$(this.attr('href').length-5);
函数loadContent(){
$('#content').load(toLoad',showNewContent())
}  
函数showNewContent(){
$('#content').show('normal',hideLoader());
}  
函数hideLoader(){
$('加载').fadeOut('正常');
}  
返回false;
});  
});  
HTML代码:

<body> 
<div id="wrapper"> 
    <ul id="nav">
       <li><a href="index.html">welcome</a></li>
    </ul>
      <div id="content">

      <div class="typeface-js" style="font-family: Helvetiker; color:#0182a8;  font-size:25px; margin-bottom:10px;">Mauris ac eros. Donec quis lacus Header text.
      </div>

      Morbi gravida posuere est. Fusce id augue. More content text.

      </div>

</div>

莫里斯·艾罗斯。Donec quis lacus标题文本。 莫比孕妇波苏尔东部。我是奥古斯。更多内容文本。
您正在完全通过“#content”div加载某些内容,因此“typeface js”div当然会消失(除非您加载的内容中也包含该内容)。你看到了吗?当你打电话的时候

$('#content').load( ... )

然后,之前
中的内容将消失。

.load将清除目标容器元素的全部内容(即:“#内容”)

。。。。变明朗。。。。。
由于“typeface js”元素包含在content div中,因此在加载完成时将清除该元素

$('#content').load( ... )
<div id="content"> .... cleared ..... </div>