123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- $(function(){
- var a,
- one,
- two,
- three,
- four,
- oneh,
- onet;
- /*$(document).on("touchmove","nav_expand",function(event){
- event.preventDefault();
- event.stopPropagation();
- });*/
- $(document).on("touchend click",".navmore",function(){
- var h = $(window).height(),
- navt = $(".nav_expand").css("top"),
- navn = navt.substring(0,2),
- navh = $(".nav_expand .nav_expand_head").height(),
- bnavh = $(".tabs-bottom .tab-nav").outerHeight(true);
- $(".nav_expand").slideDown()
- $(".nav_expand .nav_expand_body").css({"height":h - navn- navh - bnavh});
- openSelectPage=true;
- $nav_expand_no();
- });
- $(document).on("touchend",".nav_expand .nav_return,.nav_expand .nav_expand_head > h1",function(){
- nav_return()
- });
- $(document).on("touchend",".nav_expand .sort_delete",function(){
- var has = $(this).hasClass("active");
- if(has == true){
- $(this).removeClass("active").html("排序删除");
- $(".nav_column").removeClass("active");
- $(".nav_column ul").removeClass("sortable");
- $(".nav_column li .close_delete").hide();
- $(".nav_add").show();
- $add_Unfinished("complete");
- $(".nav_column ul li").removeAttr("style");
- $ui_sortable();
- $(".sortable ul").sortable("destroy");
- $nav_expand_no();
- }else{
- $(".nav_add").show();
- $(this).addClass("active").html("完成");
- $(".nav_column").addClass("active sortable");
- $.getScript("trsTop/js/jquery-ui.js");
- $.getScript("trsTop/js/jquery-ui-mobile.js",function(){
- //var items = $(".sortable ul").sortable("option", "items");
- //$(".sortable ul").sortable("option", "items", "> li");
- $(".sortable ul").sortable({items: "> li.port"});
- $(".sortable ul").disableSelection();
- });
- $.getScript("trsTop/images/mui.min.js");
- $(".nav_column li .close_delete").show();
- $(".nav_add").hide();
- }
- });
- $(document).on("touchend",".mui-scroll iframe",function(){
- console.log(2)
- });
- $(document).on("click",".nav_add li",function(event){
- //event.preventDefault();
- //event.stopPropagation();
- var text = $(this).text(),
- num = parseInt(Math.random()*(1000-10+1)+10,10),
- leng = $("#sliderSegmentedControl .mui-scroll a").length,
- url = $(this).find("h1").attr("data-active-url");
- text = text.substr(1,100);
- $(this).remove();
- $add_info(text,num,leng,url);
- $nav_expand_no();
- });
- $(document).on("touchend",".nav_column li .close_delete",function(){
- var text = $(this).parent().find("h1").text(),
- url = $(this).parent().find("h1").attr("data-active-url");
- $(this).parent().hide();
- $(".nav_add ul").prepend("<li class='Unfinished'><i class='ico_add'>+</i><h1 data-active-url="+url+"></h1></li>");
- $(".nav_add ul li:eq(0) h1").html(text);
- $("#sliderSegmentedControl .mui-scroll a").each(function(){
- var t = $(this).text();
- if(t == text){
- var i = $(this).index();
- $(this).addClass("Unfinished");
- $(".mui-slider-group .mui-slider-item").eq(i).addClass("Unfinished");
- }
- });
- });
- });
- function $ui_sortable(){
- $(".ui-sortable li").each(function(){
- var t = $(this).find("h1").text();
- //console.log(t);
- $("#sliderSegmentedControl .mui-scroll a").each(function(){
- var uit = $(this).text(),
- href = $(this).attr("href"),
- index = $(this).index(),
- has = $(this).hasClass("mui-active");
- //console.log(uit);
- if(t == uit && has == true){
- $("#sliderSegmentedControl .mui-scroll").append("<a class='mui-control-item "+ 'mui-active' +"' href='"+ href +"'>" + uit + "</a>");
- $(this).remove();
- }
- if(t == uit && has != true){
- $("#sliderSegmentedControl .mui-scroll").append("<a class='mui-control-item' href='"+ href +"'>" + uit + "</a>");
- $(this).remove();
- }
- $(".mui-slider-group .mui-slider-item").each(function(){
- var ut = $(this).attr("id"),
- uh = $(this).html(),
- has = $(this).hasClass("mui-active");
- if(ut == uit && has == true){
- $(".mui-slider-group").append("<div id='"+ ut +"' class='mui-slider-item mui-control-content" + 'mui-active' + "'>" + uh + "</div>");
- $(this).remove();
- }
- if(ut == uit && has != true){
- $(".mui-slider-group").append("<div id='"+ ut +"' class='mui-slider-item mui-control-content'>" + uh + "</div>");
- $(this).remove();
- }
- });
- });
- });
- var l = $("#sliderSegmentedControl .mui-scroll a").length;
- $("#sliderSegmentedControl .mui-scroll a").each(function(){
- var uit = $(this).attr("data-active-id");
- if(uit == "占位"){
- console.log(uit)
- $(this).remove();
- $("#sliderSegmentedControl .mui-scroll a").eq(l-2).after("<a class='mui-control-item' data-active-id='占位'> </a>");
- }
- });
- }
- function $add_Unfinished(b){
- $(".nav_add ul li").each(function(){
- var has = $(this).hasClass("Unfinished");
- if(has == true && b == "return"){
- $(this).remove();
- }
- if(has == true && b == "complete"){
- $(this).removeClass("Unfinished");
- }
- });
- $("#sliderSegmentedControl .mui-scroll a").each(function(){
- var has = $(this).hasClass("Unfinished");
- if(has == true && b == "return"){
- $(this).removeClass("Unfinished");
- console.log(1)
- }
- if(has == true && b == "complete"){
- $(this).remove();
- console.log(2)
- }
- });
- $(".mui-slider-group .mui-slider-item").each(function(){
- var has = $(this).hasClass("Unfinished"),
- $mg = $("#slider .mui-slider-group");
- if(has == true && b == "return"){
- $(this).removeClass("Unfinished");
- console.log(1)
- }
- if(has == true && b == "complete"){
- $(this).remove();
- var i = $(this).hasClass("mui-active")
- if(i == true){
- $("#sliderSegmentedControl a").removeClass("mui-active").eq(0).addClass("mui-active");
- $mg.css({"transform":"translate3d(0px,0,0) translateZ(0px)"});
- }
- }
- });
- $(".nav_column ul li").each(function(){
- var vis = $(this).is(":visible"),
- ut = $(this).text();
- console.log(vis)
- if(vis == false && b == "complete"){
- $(this).remove();
- }
- if(ut == ""){
- $(this).remove();
- }
- });
- }
- function $add_info(a,b,c,d){
- var height_jquery = $("#mainFarm1").height();
- //$(".nav_column ul").append("<li class='port'><i class='close_delete'>x</i><h1 data-active-url="+d+">"+a+"</h1></li>");
- $(".nav_column ul").append("<li class='port'><i class='close_delete'>x</i><h1 data-active-url="+d+"></h1></li>");
- var sl = $(".nav_column ul li").length;
- $(".nav_column ul li").eq(sl-1).find("h1").html(a);
-
- //$("#sliderSegmentedControl .mui-scroll a").eq(c - 2).after("<a class='mui-control-item' href='#item"+b+"mobile'>"+a+"</a>");
- $("#sliderSegmentedControl .mui-scroll a").eq(c - 2).after("<a class='mui-control-item' href='#item"+b+"mobile'></a>");
- $("#sliderSegmentedControl .mui-scroll a").eq(c - 1).html(a);
-
- $(".mui-slider-group").append("<div id='item"+b+"mobile' data-active-id="+b+" class='mui-slider-item mui-control-content'><div class='mui-scroll-wrapper'><div class='mui-scroll'><iframe id='mainFarm1' name='iframeAll' width='100%' height='"+height_jquery+"' src='"+d+"' seamless frameborder='0'></iframe></div></div></div>");
- }
- function nav_return(){
- $(".nav_expand").slideUp();
- $(".nav_expand .sort_delete").removeClass("active").html("排序删除");
- $(".nav_column").removeClass("active");
- $(".nav_column li .close_delete").hide();
- $(".nav_add").show();
- $(".nav_column ul li").removeAttr("style");
- $add_Unfinished("return");
- }
- function $nav_expand_no(){
- var l = $(".nav_add ul li").length;
- if(l > 0){
- $(".nav_add > h1").html("点击添加更多栏目");
- }else{
- $(".nav_add > h1").html("无更多栏目");
- }
- }
|