public.js 2.6 KB
$(function(){
    var host = 'http://'+window.location.host;
    // 点击收藏与爱心
    $('.collections').click(function() {
        if ($(this).children('img').attr('src') == host+'/themes/simpleboot3/public/assets/starImg/bicon_02.png') {
            $(this).children('img').attr('src', host+'/themes/simpleboot3/public/assets/starImg/bicon_15.png');
        } else {
            $(this).children('img').attr('src', host+'/themes/simpleboot3/public/assets/starImg/bicon_02.png');
        }
    });
    $('.likes').click(function() {
        if ($(this).children('img').attr('src') == host+'/themes/simpleboot3/public/assets/starImg/bicon_03.png') {
            $(this).children('img').attr('src', host+'/themes/simpleboot3/public/assets/starImg/bicon_16.png');
        } else {
            $(this).children('img').attr('src', host+'/themes/simpleboot3/public/assets/starImg/bicon_03.png');
        }
    });
    // 评论判断长度显示与隐藏
    if ($('.show_2_pinL').length < 2) {
        $('.show_main_more').hide();
        $('.show_main2_show ul').removeClass('show_main2_show_H');
    } else {
        $('.show_main_more').show();
    }

    // 点击查看更多,与提示
    $('.show_main_more').click(function() {
        if ($(this).text() == "查看更多评论") {
            $('.show_main2_show ul').removeClass('show_main2_show_H');
            $(this).text('收起');
        } else {
            $('.show_main2_show ul').addClass('show_main2_show_H');
            $(this).text('查看更多评论');
        }
    });

    //头部导航栏切换颜色
    var str_url = window.location.pathname;
    $('.home_nav_act,.slide_vo').children('a').removeClass('home_nav_act');
    var star = 'star';//星球奇境
    var region = 'region';//星域秀场
    var enjoy = 'enjoy';//星享体验
    var scout = 'scout';//星探推荐
    var active = 'active';//星际活动
    if(str_url.indexOf(star) != -1){
        $('.slide_vo').eq(0).children('a').addClass('home_nav_act');
    }else if(str_url.indexOf(region) != -1){
        $('.slide_vo').eq(1).children('a').addClass('home_nav_act');
    }else if(str_url.indexOf(enjoy) != -1){
        $('.slide_vo').eq(2).children('a').addClass('home_nav_act');
    }else if(str_url.indexOf(scout) != -1){
        $('.slide_vo').eq(3).children('a').addClass('home_nav_act');
    }else if(str_url.indexOf(active) != -1){
        $('.slide_vo').eq(4).children('a').addClass('home_nav_act');
    }else{
        $('.home_nav_act').children('a').addClass('home_nav_act');
    }

    //改变分页图标
    $('.page-item').eq(0).children().text('<');
    $('.page-item:last').children().text('>');
});