2013-07-15 17 views
0

这是我的js代码:

<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> 
     <script src="http://jquery-ui.googlecode.com/svn/tags/latest/ui/jquery.effects.core.js"></script> 
    <script src="http://jquery-ui.googlecode.com/svn/tags/latest/ui/jquery.effects.slide.js"></script> 

    <script src="js/mr_lp_minimizr.js"></script> 
    <script> 
$(document).ready(function(){ 

if(!Modernizr.input.placeholder){ 

    $('[placeholder]').focus(function() { 
     var input = $(this); 
     if (input.val() == input.attr('placeholder')) { 
     input.val(''); 
     input.removeClass('placeholder'); 
     } 
    }).blur(function() { 
     var input = $(this); 
     if (input.val() == '' || input.val() == input.attr('placeholder')) { 
     input.addClass('placeholder'); 
     input.val(input.attr('placeholder')); 
     } 
    }).blur(); 
    $('[placeholder]').parents('form').submit(function() { 
     $(this).find('[placeholder]').each(function() { 
     var input = $(this); 
     if (input.val() == input.attr('placeholder')) { 
      input.val(''); 
     } 
     }) 
    }); 

} 

}); 
</script> 
<script type="text/javascript"> 
jQuery.fn.extend({ 
    slideRightShow: function(speed) { 
    return this.each(function() { 
     $(this).show('slide', {direction: 'right'}, +speed || 1000); 
    }); 
    }, 
    slideLeftHide: function(speed) { 
    return this.each(function() { 
     $(this).hide('slide', {direction: 'left'}, +speed || 1000); 
    }); 
    }, 
    slideRightHide: function(speed) { 
    return this.each(function() { 
     $(this).hide('slide', {direction: 'right'}, +speed || 1000); 
    }); 
    }, 
    slideLeftShow: function(speed) { 
    return this.each(function() { 
     $(this).show('slide', {direction: 'left'}, +speed || 1000); 
    }); 
    } 
}); 


$(document).ready(function() { 
    $("#slides :first-child").addClass("currentSlide"); 
    $("#slides :not(:first-child)").hide(); 

    $(".left_hand_icon").button().click(function() { //This is the line where issue is 
     currentSlide = $("#slides .currentSlide"); 

     if(currentSlide.prev().prev().size() < 1) { 
      // The incoming slide is the first - disable Left button 
      $(".left_hand_icon").button("disable"); 
     } 

     currentSlide.prev().addClass("currentSlide"); 
     currentSlide.removeClass("currentSlide"); 

     currentSlide.prev().slideLeftShow(); 
     currentSlide.slideRightHide(); 

     $(".right_hand_icon").button("enable"); 
    }).button("disable"); 

    $(".right_hand_icon").button().click(function() { 
     currentSlide = $("#slides .currentSlide"); 

     if(currentSlide.next().next().size() < 1) { 
      // The incoming slide is the last - disable Right button 
      $(".right_hand_icon").button("disable"); 
     } 

     currentSlide.next().addClass("currentSlide"); 
     currentSlide.removeClass("currentSlide"); 

     currentSlide.next().slideRightShow(); 
     currentSlide.slideLeftHide(); 

     $(".left_hand_icon").button("enable"); 
    }); 
}); 
</script> 

我添加到其错误显示行此评论: //这是问题所在的行

回答

4

您还没有包含jQuery ui小部件。有按钮在哪里。

http://api.jqueryui.com/category/widgets/

+0

Thanks @musa!我不想使用按钮,而是想使用左右选项的图像。我如何调整脚本? – KPO

+0

图片仍然可以作为一个按钮,按钮是功能,你需要包括小部件js –

+0

我是新来的JS,所以我不知道这是正确的: KPO

相关问题