简体   繁体   中英

Bootstrap Tabs - Next and Previous Buttons

I have the following: http://goo.gl/FZMd33

My desired output would be if the first tab is selected, the previous button becomes disabled and at the other end when the last tab is selected the next tab becomes disabled.

Also as a separate thought I would also like to achieve the Next button show the first tab if the last tab is currently selected and the opposite with the Previous button on first tab to show last tab on click

Try bellow code

//Put this code on click of **Next Button**

        if ($tabs.filter('.active').next('li').length > 0) {
             $('#wheel-right').removeAttr("disabled");
         } else {
             $('#wheel-right').attr("disabled", "disabled");
         }




// Put this code on click  of **Previous Button**

     if ($tabs.filter('.active').prev('li').length > 0) {
         $('#wheel-left').removeAttr("disabled");
     } else {
         $('#wheel-left').attr("disabled", "disabled");
     }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM