123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- function getParams(url) {
- var theRequest = new Object();
- if (!url)
- url = location.href;
- if (url.indexOf("?") !== -1)
- {
- var str = url.substr(url.indexOf("?") + 1) + "&";
- var strs = str.split("&");
- for (var i = 0; i < strs.length - 1; i++)
- {
- var key = strs[i].substring(0, strs[i].indexOf("="));
- var val = strs[i].substring(strs[i].indexOf("=") + 1);
- theRequest[key] = val;
- }
- }
- return theRequest;
- }
- var objUrl = {};
- var url = window.location.href;
- var osi = $(".siwh ul li").eq(0).attr('data-id');
- var params = getParams(url);
- if(!$.isEmptyObject(params)){
- $.each(params,function(key,val){
- objUrl[key] = val;
- })
- }
- var page = 0;
- var size = 10;
- var thisID=0;
- function AjaxFn(){
- page = 0;
- page++;
- $.ajax({
- type: 'GET',
- url: '/news/homeform?&page='+page+'&limit='+size + '&cid='+thisID,
- dataType: 'json',
- success: function(data){
- if(data.code == 200){
- $('.news_list .ns').append(ModuleWay(data.data))
- }
- },
- error: function(xhr, type){
- }
- });
- }
- function ModuleWay(conditions){
- var _html="";
- $.each(conditions.data,function (key,val) {
-
- _html +='<div class="plan_one">';
- _html +='<a href="/news/details/'+val.id+'/">';
- _html +='<div class="plan_one_title">';
- _html +='<p class="text">'+val.subject+'</p>';
- _html +=' <p> <span class="guis">'+val.source+' </span><i>·</i><span class="data">'+val.open_time+'</span></p>';
- _html +='</div>';
- _html +='<div class="plan_one_img"><img src="'+conditions.url+val.thumb[0]+'" alt=""></div>';
- _html +='</a>';
- _html +='</div>';
- })
- return _html ;
- }
- $(function(){
- thisID=$('#demo06 ul li').eq(0).attr('data-id');
-
- if(typeof objUrl.cid == "string"){
- thisID = objUrl.cid;
-
- }
- var ali= 0;
-
- $(".siwh ul").on('click','li',function(){
- $('.news_list .dropload-down').remove();
- var $this = $(this);
- thisID = $this.attr('data-id');
- $(".siwh ul li").removeClass('cur');
- $('.siwh ul li[data-id="'+thisID+'"]').addClass('cur');
- osi = thisID;
- $('.news_list .ns').html("");
- AjaxFn();
- fun();
- })
- function fun(){
-
- $('.news_list').dropload({
-
- scrollArea : window,
- threshold:4/10,
- loadDownFn : function(me){
- page++;
- $.ajax({
- type: 'GET',
- url: '/news/homeform?&page='+page+'&limit='+size + '&cid='+thisID,
- dataType: 'json',
- success: function(data){
-
- if(data.code == 200){
- $('.news_list .ns').append(ModuleWay(data.data))
-
- $(".news_list .plan_one").each(function(){
- var maxwidth=35;
- var _lenght = $(this).find('.plan_one_title .text').text().length
- var that = $(this).find('.plan_one_title .text')
- if(_lenght > maxwidth){
- that.text(that.text().substring(0,maxwidth));
- that.html(that.html()+'…');
- }
- });
- }else{
-
- me.lock();
-
- me.noData();
- }
-
-
- setTimeout(function(){
-
-
-
- me.resetload();
- },1000);
-
-
- },
- error: function(xhr, type){
-
-
- me.resetload();
- }
- });
- }
- });
- }
- fun();
-
-
- })
- var mySwiper = new Swiper ('.swiper-container2', {
- autoplay: true,
- speed:300,
- loop : true,
- autoplay:5000,
- pagination: '.swiper-pagination'
- })
- $('#demo06').navbarscroll({
- defaultSelect:0,
- scrollerWidth:6,
- fingerClick:1,
- endClickScroll:function(obj){
-
-
- }
- });
- $(window).scroll(function (){
- var st = $(this).scrollTop();
-
- if(st >300){
- $('.find_nav').show();
-
- $('#demo05').navbarscroll({
- defaultSelect:0,
- scrollerWidth:6,
- fingerClick:1,
- endClickScroll:function(obj){
- $(".siwh ul li").removeClass('cur');
- $('.siwh ul li[data-id="'+osi+'"]').addClass('cur');
- }
- });
- }else{
- $('.find_nav').hide();
- }
- });
|