$(function() { $('.nav li').bind('click', function() { $(this).find('.dl-box').height("auto"); $(this).find('.dl-box').stop().slideDown(); if ($(this).find('.dl-box').length) { $(this).addClass('ok'); } }); // $('.nav li').bind('mouseleave', function() { // $(this).removeClass('ok'); // $(this).find('.dl-box').stop().slideUp(); // }); if (!('placeholder' in document.createElement('input'))) { $('input[placeholder],textarea[placeholder]').each(function() { var that = $(this), text = that.attr('placeholder'); if (that.val() === "") { that.val(text).addClass('placeholder'); } that.focus(function() { if (that.val() === text) { that.val("").removeClass('placeholder'); } }) .blur(function() { if (that.val() === "") { that.val(text).addClass('placeholder'); } }) .closest('form').submit(function() { if (that.val() === text) { that.val(''); } }); }); }; $('.ol-box li').click(function() { if ($(this).find('.fouji').css("display")=='none') { $(this).find('.fouji').css("display","block"); $(this).siblings('li').find('.fouji').css("display","none"); }else{ $(this).find('.fouji').css("display","none"); $(this).siblings('li').find('.fouji').css("display","none"); } }); $('.con_left dd').click(function() { $(this).addClass('hover').siblings('dd').removeClass('hover'); }); $('.nav li').click(function() { $(this).addClass('on').siblings('li').removeClass('on'); }); $('.aboutbeiling').click(function() { $(".bexia").css("display","block"); }); // 自定义多选 $('[role=checkbox]').each(function() { var input = $(this).find('input[type="checkbox"]'); input.each(function() { if ($(this).attr('checked')) { $(this).parents('label').addClass('checked'); $(this).prop("checked", true) } }) input.change(function() { $(this).parents('label').toggleClass('checked'); }); }); // 自定义单选 $('[role=radio]').each(function() { var input = $(this).find('input[type="radio"]'), label = $(this).find('label'); input.each(function() { if ($(this).attr('checked')) { $(this).parents('label').addClass('checked'); $(this).prop("checked", true) } }) input.change(function() { label.removeClass('checked'); $(this).parents('label').addClass('checked'); input.removeAttr('checked'); $(this).prop("checked", true) }) }); // tab切换 $(".TAB_CLICK li").click(function() { var tab = $(this).parent(".TAB_CLICK"); var con = tab.attr("id"); var on = tab.find("li").index(this); $(this).addClass('on').siblings(tab.find("li")).removeClass('on'); $(con).eq(on).show().siblings(con).hide(); }); $('.TAB_CLICK').each(function(index, el) { $(this).find("li").filter(':first').trigger('click'); }); // 下拉 $('.y-select1 .res').val(""); $(document).click(function() { $('.y-select1 .type').stop().slideUp(200); $('.y-select1').removeClass('on'); }) $('.y-select1').click(function(e) { $(this).toggleClass('on'); $(this).children('.type').stop().slideToggle(200); e.stopPropagation(); }) $('.y-select1 .type label').click(function() { var $thisVal = $(this).find('span').html(); $(this).parents('.type').siblings('.res').val($thisVal).siblings('.show').html($thisVal); }) // 页码下拉 $('.pages .pages-l dl').click(function(e) { /* Act on the event */ $(this).find('dd').stop().slideToggle(); e.stopPropagation(); }); $(document).click(function() { $(".pages .pages-l dl dd").hide(); }) if ($(".snav li").find('.dl').length) { $(".snav li").find(".dl").siblings("a").attr("href", "javascript:;") }; $(".snav li").click(function() { $(this).find(".dl").stop().slideToggle(500); $(this).toggleClass("on"); $(this).siblings("li").find(".dl").stop().slideUp(500); $(this).siblings("li").removeClass("on"); }); });