北京市网站建设企业酷站科技:在HotStyle主题风格在集成化了右下方弹出来最新公告的作用,此作用能够 根据后台管理主题风格选择项轻轻松松打开关掉,如今就其完成方式 做下列叙述。
这一作用的完成比较简单,其运用jquery的fadeTo或是Hide的作用。
1,载入jquery.js.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
2,载入下列js代码:
<script type="text/javascript">
$(document).ready(function() {
//$('#sitefocus').hide(0, 0);
//$('#sitefocus').fadeIn(1800, 0);
$('.bm_h a').click(function() {
//$('#sitefocus').hide();
//$('#sitefocus').fadeTo(500, 0);
$('#sitefocus').hide(600, 0);
return false;
});
});
</script>
3,css格式。
<style type="text/css">
.focus {
position:fixed;
rightright:5px;
bottombottom:5px;
z-index:300;
overflow:hidden;
width:251080x;
border:1px solid #AAA;
padding:0 10px;
background:white;
}
.bm,.bn {
margin-bottom:10px;
}
.bm_h {
padding:0 10px;
height:40px;
border-bottom:4px solid #009AD9;
line-height:40px;
whitewhite-space:nowrap;
overflow:hidden;
}
.cl {
zoom:1;
}
.y {
float:rightright;
}
a {
color:#333;
text-decoration:none;
}
h1,h2,h3,h4,h5,h6 {
font-size:1em;
}
body,ul,ol,li,dl,dd,p,h1,h2,h3,h4,h5,h6,form,fieldset,.pr,.pc {
margin:0;
padding:0;
}
.bm_c {
background:white;
}
.bbda {
border-bottom:1px dashed #CDCDCD;
}
.cl {
zoom:1;
}
.xld dt {
padding:8px 0 5px;
font-weight:700;
}
.bm_c h2 a,.bm_c dt a {
padding-right:10px;
color:#4a4E52;
}
.focus dt a {
color:#0060A6;
font-size:12px;
}
.xi2,.xi2 a,.xi3 a {
color:#266CB5;
}
.xld dd {
margin-bottom:8px;
}
.hm {
text-align:center;
}
.ptn {
padding-top:5px!important;
}
a:hover,* a:hover {
color:#F60 !important;
}
</style>
4,php和html编码启用最新公告。
<?php
$loop = new WP_Query( array( 'post_type' => 'bulletin', 'posts_per_page' => 1 ) );while ( $loop->have_posts() ) : $loop->the_post();
?>
<div class="focus" id="sitefocus">
<div class="bm">
<div class="bm_h cl">
<a href="#" class="y" title="关掉">关掉</a>
<h2>临时性公示</h2>
</div>
<div class="bm_c">
<dl class="xld cl bbda">
<dt>
<a href="<?php the_permalink(); ?>" class="xi2" target="_blank">
<?php the_title(); ?>&nbs p;
</a>
</dt>
<dd>
<?php echo mb_strimwidth(strip_tags(apply_filters( 'the_content', $post->
post_content)), 0, 68,"..."); ?>
</dd>
</dl>
<p class="ptn hm">
<a href="<?php the_permalink(); ?>" class="xi2" target="_blank">查询 »</a>
</p>
</div>
</div>
</div>
<?php endwhile; ?>
这儿循环系统启用最新公告,因为此公示由主题风格集成化,因此不具备统一性,请依据本人具体必须做改动。
留下联系方式,我们将会在一个工作日内与你联系