You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
200 lines
6.5 KiB
JavaScript
200 lines
6.5 KiB
JavaScript
6 years ago
|
function activation () {
|
||
|
var _index;
|
||
|
$("#feedback-content .tab-content .tab-pane").each(function () {
|
||
|
if ($(this).is(":visible")) {
|
||
|
$("#"+ $(this).attr("id")).infinitescroll('resume');
|
||
|
_index = $("#feedback-content #"+ $(this).attr("id")).attr("findex") || 0;
|
||
|
if (_index <= 0) {
|
||
|
$("#feedback-content #"+ $(this).attr("id")).infinitescroll('retrieve', 6);
|
||
|
}
|
||
|
}else{
|
||
|
$("#"+ $(this).attr("id")).infinitescroll('pause');
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function infinite(el_name, url, index, dNode) {
|
||
|
var _index = index || 0;
|
||
|
$("#feedback-content #"+ el_name).after('<a id="' + el_name + '_next" class="next" href="'+ url + '1' +'">next page?</a>');
|
||
|
$("#feedback-content #"+ el_name).infinitescroll({
|
||
|
navSelector : "#"+ el_name +"_next:last",
|
||
|
nextSelector : "a#"+ el_name +"_next:last",
|
||
|
itemSelector : "#"+ el_name +"",
|
||
|
dataType : 'html',
|
||
|
maxPage : 100,
|
||
|
path: function(index) {
|
||
|
return url + index;
|
||
|
},
|
||
|
appendCallback : false
|
||
|
}, function(newElements, data, url) {
|
||
|
$(newElements).imagesLoaded(function(){
|
||
|
var el = $(newElements).find(".item");
|
||
|
if (index <= 0) {
|
||
|
_index = $("#feedback-content #"+ el_name).attr("findex") || 0;
|
||
|
}
|
||
|
if (_index <= 0) {
|
||
|
dNode.append( el );
|
||
|
dNode.masonry({
|
||
|
itemSelector : '.item',
|
||
|
columnWidth: '.item',
|
||
|
transitionDuration: 0,
|
||
|
gutter: 105
|
||
|
});
|
||
|
_index = el.length;
|
||
|
$("#"+ el_name +" .item").each(function () {
|
||
|
arrow_points($(this));
|
||
|
});
|
||
|
$("#feedback-content #"+ el_name).attr({"findex": _index});
|
||
|
}else{
|
||
|
dNode.masonry({
|
||
|
itemSelector : '.item',
|
||
|
columnWidth: '.item',
|
||
|
transitionDuration: 0
|
||
|
}).append( el ).masonry("appended", el, true );
|
||
|
$("#"+ el_name +" .item:gt(" + _index + ")").each(function () {
|
||
|
arrow_points($(this));
|
||
|
});
|
||
|
_index = parseInt(_index) + el.length;
|
||
|
$("#feedback-content #"+ el_name).attr({"findex": _index});
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
|
||
|
//goTop
|
||
|
function gotop()
|
||
|
{
|
||
|
var $backToTopEle = $('<div class="topIcon"><a href="javascript:;" title="Top"><img src="http://data.chinahighlights.com/css/images/tour/top-icon.jpg" alt="Top" /></a></div>').appendTo($("body")).click(function() {
|
||
|
$("html, body").animate({ scrollTop: 0 }, 120);
|
||
|
}), $backToTopFun = function() {
|
||
|
var st = $(document).scrollTop(), winh = $(window).height();
|
||
|
(st > 0)? $backToTopEle.show(): $backToTopEle.hide();
|
||
|
//IE6下的定位
|
||
|
if (!window.XMLHttpRequest) {
|
||
|
$backToTopEle.css("top", st + winh - 166);
|
||
|
}
|
||
|
};
|
||
|
$(window).bind("scroll", $backToTopFun);
|
||
|
$(function() { $backToTopFun(); });
|
||
|
}
|
||
|
|
||
|
function arrow_points(o){
|
||
|
var item = o.find(".item");
|
||
|
if (item.size() == 0) {
|
||
|
item = o;
|
||
|
}
|
||
|
$.each(item, function(i, obj){
|
||
|
var poslef = $(obj).css("left");
|
||
|
if(poslef <= "20px"){
|
||
|
$(obj).find(".arrow").addClass("arrow-left");
|
||
|
$(obj).find(".arrow").append("<img src='/image/aboutus/feedback/arrow.png' />");
|
||
|
} else {
|
||
|
$(obj).find(".arrow").addClass("arrow-right");
|
||
|
$(obj).find(".arrow").append("<img src='/image/aboutus/feedback/arrow-left.png' />");
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function index_initialize () {
|
||
|
$(".feedbacnation .country div:lt(8)").show();
|
||
|
$(".feedbacnation .last").toggle(function() {
|
||
|
//$(".feedbacnation .country div:lt(8)").hide();
|
||
|
$(".feedbacnation .country div:gt(7)").show();
|
||
|
$(this).html("+ hide");
|
||
|
|
||
|
}, function() {
|
||
|
$(".feedbacnation .country div:lt(8)").show();
|
||
|
//$(".feedbacnation .country div:gt(7)").hide();
|
||
|
$(this).html("+ show more");
|
||
|
});
|
||
|
itemIndex = $('#feedback-content #all .item').size();
|
||
|
|
||
|
allNode = $('#feedback-content #all');
|
||
|
allNode.imagesLoaded(function(){
|
||
|
allNode.masonry({
|
||
|
itemSelector : '.item',
|
||
|
columnWidth: '.item',
|
||
|
transitionDuration: 0,
|
||
|
gutter: 105
|
||
|
});
|
||
|
|
||
|
arrow_points($("#all"));
|
||
|
});
|
||
|
|
||
|
beijingNode = $('#feedback-content #beijing');
|
||
|
xianNode = $('#feedback-content #xian');
|
||
|
shanghaiNode = $('#feedback-content #shanghai');
|
||
|
guilinNode = $('#feedback-content #guilin');
|
||
|
chengduNode = $('#feedback-content #chengdu');
|
||
|
yangtzeNode = $('#feedback-content #yangtze');
|
||
|
|
||
|
|
||
|
|
||
|
infinite("all", "/feedback/api-list.asp?page=", itemIndex, allNode);
|
||
|
infinite("beijing", "/feedback/api-list.asp?city=beijing&page=", 0, beijingNode);
|
||
|
infinite("xian", "/feedback/api-list.asp?city=xian&page=", 0, xianNode);
|
||
|
infinite("shanghai", "/feedback/api-list.asp?city=shanghai&page=", 0, shanghaiNode);
|
||
|
infinite("guilin", "/feedback/api-list.asp?city=guilin&page=", 0, guilinNode);
|
||
|
infinite("chengdu", "/feedback/api-list.asp?city=chengdu&page=", 0, chengduNode);
|
||
|
infinite("yangtze", "/feedback/api-list.asp?city=yangtze&page=", 0, yangtzeNode);
|
||
|
|
||
|
activation();
|
||
|
$("#feedback-content .switch-tags").click(function (e) {
|
||
|
e.preventDefault();
|
||
|
$(this).tab("show");
|
||
|
});
|
||
|
$('#feedback-content .switch-tags a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||
|
e.target; // activated tab
|
||
|
e.relatedTarget; // previous tab
|
||
|
activation();
|
||
|
});
|
||
|
gotop();
|
||
|
}
|
||
|
|
||
|
function list_initialize (domid) {
|
||
|
var _domid = domid;
|
||
|
$(".feedbacnation .country div:lt(8)").show();
|
||
|
$(".feedbacnation .last").toggle(function() {
|
||
|
//$(".feedbacnation .country div:lt(8)").hide();
|
||
|
$(".feedbacnation .country div:gt(7)").show();
|
||
|
$(this).html("+ hide");
|
||
|
|
||
|
}, function() {
|
||
|
$(".feedbacnation .country div:lt(8)").show();
|
||
|
$(".feedbacnation .country div:gt(7)").hide();
|
||
|
$(this).html("+ show more");
|
||
|
});
|
||
|
itemIndex = $('#feedback-content #' + _domid + ' .item').size();
|
||
|
|
||
|
allNode = $('#feedback-content #' + _domid + '');
|
||
|
allNode.imagesLoaded(function(){
|
||
|
allNode.masonry({
|
||
|
itemSelector : '.item',
|
||
|
columnWidth: '.item',
|
||
|
transitionDuration: 0,
|
||
|
gutter: 105
|
||
|
});
|
||
|
|
||
|
arrow_points($("#" + _domid ));
|
||
|
});
|
||
|
|
||
|
var uri_param = "domid=" + _domid + "&country=" + _domid + "&page=";
|
||
|
|
||
|
if ((/list-video.asp/).test(location.href)) {
|
||
|
uri_param = "video=1&domid=all&page=";;
|
||
|
}
|
||
|
|
||
|
infinite(_domid , "/feedback/api-list.asp?" + uri_param, itemIndex, allNode);
|
||
|
|
||
|
activation();
|
||
|
$("#feedback-content .switch-tags").click(function (e) {
|
||
|
e.preventDefault();
|
||
|
$(this).tab("show");
|
||
|
});
|
||
|
$('#feedback-content .switch-tags a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||
|
e.target; // activated tab
|
||
|
e.relatedTarget; // previous tab
|
||
|
activation();
|
||
|
});
|
||
|
}
|