Authored by xuqi

ps页面添加收起介绍功能

... ... @@ -16,7 +16,13 @@ require('lazyload');
exports.init = function() {
$(function() {
var $intro = $('#intro'),
$moreIntro = $('#more-intro'),
$introTxt = $moreIntro.find('.more-intro-text'),
$iconUp = $moreIntro.find('.up'),
$iconDown = $moreIntro.find('.down'),
winH = $(window).height(),
mIntro, //品牌介绍文字介绍
aIntro,
tpl;
var isLogin = $('#is-login').val();
isLogin = isLogin ? isLogin : 'N';
... ... @@ -25,7 +31,7 @@ exports.init = function() {
winW,
tipH,
tipW;
//获取相关资讯模板
$.get('/common/articletpl', function(data) {
tpl = data;
... ... @@ -39,21 +45,32 @@ exports.init = function() {
$('.info-block-content, .info-block-title').each(function() { //相关文章
$(this).mlellipsis(2);
});
mIntro = $intro.text();
aIntro = $intro.attr('_title');
}, 0);
//lazyload
$('img.lazy').lazyload();
//显示品牌介绍所有文字
aIntro = $intro.attr('_title');
//显示品牌介绍所有文字/隐藏
function showMoreIntro() {
var intro = $intro.attr('_title');
$intro.text(intro);
$('#more-intro .more').css('visibility', 'hidden');
$moreIntro.toggleClass('show');
if ($moreIntro.hasClass('show')) {
$intro.text(aIntro);
$introTxt.text('收起');
$iconDown.addClass('hide');
$iconUp.removeClass('hide');
} else {
$intro.text(mIntro);
$introTxt.text('more');
$iconUp.addClass('hide');
$iconDown.removeClass('hide');
}
}
$('#more-intro').delegate('.more', 'click', function() {
$moreIntro.delegate('.more', 'click', function() {
showMoreIntro();
});
... ...
... ... @@ -15,7 +15,8 @@
</p>
<div id="more-intro" class="more-intro">
<span class="more-intro-text more">more</span>
<span class="more-intro-icon more iconfont">&#xe607;</span>
<span class="more-intro-icon more iconfont down">&#xe609;</span>
<span class="more-intro-icon more iconfont up hide">&#xe608;</span>
</div>
</div>
</div>
... ...