- // 获取开关ē¶ę€
- å…³ē¶ę€
- function getSwitchStatus(th) {
- return $(th).hasC// 设置开关
- );
- }
- // 设置开关
- function setSwitch2On(th) {
- sliderOnOrOff('open', th);
- }
- function setSwitch2Off(th) {
- // 开关å‡ę¨¢
- f('close', th);
- }
- // å¼€// var ele = $(th).children(".move");
- ge(th) {
- // var ele = $(th).children(".move");
- var ele = $(th).children(".move");
- var nextOpen = false;
- if (ele.attr("data-state") == "switch_on") {
- nextOpen = false;
- } else {
- nextOpen = true;
- }
- var bigType = false;
- // console.log('大类');
- oad-heading')) {
- // console.log('å¤// console.log('小类');
- e = true;
- } else {
- // c//当前滑块滑åØ
- »');
- bigType = false;
- }
- //当前//开关小类
- »‘åØ
- sliderOnOrOff('auto', th);
- if (bigType) {
- //开关小类
- $(th).parents('dl').siblings('section').each(function () {
- if (nextOpen) {
- if ($(this).find('.btn_fath .move').attr('data-state') === 'switch_off') {
- sliderOnOrOff('open', $(this).find('.btn_fath'));
- }
- } else {
- if ($(this).find('.btn_fath .move').attr('data-state') === 'switch_on') {
- sliderOnOrOff('cl//å¤ę–ęÆå¦å¼€å…³å¤§ē±»
- th'));
- }
- }
- });
- } else {
- //å¤ę–ęÆå¦å¼€å…³å¤§ē±»
- var dlItem = $(th).parents('dl').parents('section').eq(0).siblings('dl'data-state'var bigTypeBtn = dlItem.find('.broad-heading');
- var bigTypeCurrentType = bigTypeBtn.children('.move').attr('data-state');
- var list = dlItem.parent().children('section').filter(function () {
- return $(//å…³é—总开关
- ath_sub .move').attr('data-state') === 'switch_on';
- });
- if (list.length === 0) {
- //å…³é—总开关
- if (bigTypeCu//å¼€åÆę€»å¼€å…³
- tch_on') {
- sliderOnOrOff('close', bigTypeBtn);
- }
- } else if (list.length === 1) {
- //å¼€åÆę€»å¼€å…³
- if (bigTypeCurrentType === 'switch_off') {
- sliderOnOrOff('open', bigTypeBtn);
- }
- }
- }
- }
- function sliderOnOrOff(type, th) {
- var ele = $(th).children(".move");
- var animateLen//å¼€åÆ
- ;
- if ($(th).hasClass('push-all-type')) {
- animateLen = '22px';
- } else {
- animateLen = '27px';
- }
- if (type === 'open') {
- //å¼€åÆ
- ele.attr("data-state", "switch_on");
- ele.animate({
- left: animateLen
- },
- 200,
- function () {
- ele.parent(".btn_fath").addClass("switch_on//å…³é—
- Class("switch_off"data-state" $(th).parents(".pushlist_m").children("p").text("已开åÆęˇØé€");
- });
- } else if (type === 'close') {
- //å…³é—
- ele.attr("data-state", "switch_off");
- ele.animate({
- left: "1"
- },
- 200,
- function () {
- ele.parent(//自åØå¤ę–
- dClass("switch_off").removeClass("switch_on");
- $(th).parents(".pushlist_m").children("p").text("不推é€");
- });
- } else if (t