Ajax jquery demo

2014.05.02 2357 人浏览 留言
  1. //2014-05-01 by huilang.me
    $('#header ul li a').bind('click', function(){
  2.     $('#content').stop().hide();
  3.     $('#loading').show();
  4.     $("#main").show(); //show #main
  5.     $('#main .close').show();
  6.     $('#main .close').click(function(){
  7.         $('#main').hide();
  8.     });
  9.         $('#header ul li a').removeClass('current');//remove current
  10.         $(this).addClass('current');//add current
  11.         $url = $(this).attr('href');//get current url
  12.         $.ajax({
  13.                 url: $url,
  14.                 cache: false,
  15.                 success: function(data){
  16.                     var content = $(data).find('#content').html();
  17.                     // alert(content);
  18.                     $('#loading').hide();
  19.                     $("#content").html(content).stop().fadeIn(400);//load content
  20.                     if( $("#content").find(".banner").length>0 ){
  21.                         slider = $('.banner ul').bxSlider({
  22.                             autoHover: true,
  23.                             auto: true,
  24.                         });
  25.                         // load current sliders
  26.                         function hl_count(){
  27.                             var $count = slider.getSlideCount();
  28.                             var $hl_count = ' / ' + $count;
  29.                             $(".bx-pager").append($hl_count);
  30.                         };
  31.                         hl_count()
  32.                     }
  33.                 }
  34.         });
  35.         return false;
  36. });

文章地址:https://huilang.me/isay/ajax-jq-demo/

回复本文

电子邮件地址不会被公开。 必填项已用*标注

icon_wink.gif icon_neutral.gif icon_mad.gif icon_twisted.gif icon_smile.gif icon_eek.gif icon_sad.gif icon_rolleyes.gif icon_razz.gif icon_redface.gif icon_surprised.gif icon_mrgreen.gif icon_lol.gif icon_idea.gif icon_biggrin.gif icon_evil.gif icon_cry.gif icon_cool.gif icon_arrow.gif icon_confused.gif icon_question.gif icon_exclaim.gif