草庐IT

javascript - Bootstrap 3 表单向导

coder 2023-08-04 原文

您好,我在使用用于 bootstrap 3.0.3 的表单向导时遇到问题

它实际上在工作,但下一个和上一个按钮不起作用,但是当我点击导航时它在工作。

不知道版本是否兼容我下载了这个插件

https://github.com/VinceG/twitter-bootstrap-wizard

但它在文档上说它与 3.0.3 兼容

任何适用于 bootstrap 3.0.3 表单向导的建议?

谢谢。非常感谢您的评论:)

这是我的html代码

<div class="row">
        <div id="rootwizard">
            <ul>
                <li><a href="#tab1" data-toggle="tab"><span class="label">1</span> First</a></li>
                <li><a href="#tab2" data-toggle="tab"><span class="label">2</span> Second</a></li>
                <li><a href="#tab3" data-toggle="tab"><span class="label">3</span> Third</a></li>
                <li><a href="#tab4" data-toggle="tab"><span class="label">4</span> Forth</a></li>
                <li><a href="#tab5" data-toggle="tab"><span class="label">5</span> Fifth</a></li>
                <li><a href="#tab6" data-toggle="tab"><span class="label">6</span> Sixth</a></li>
                <li><a href="#tab7" data-toggle="tab"><span class="label">7</span> Seventh</a></li>
            </ul>
            <div class="tab-content">
                <div class="tab-pane" id="tab1">
                  1
                </div>
                <div class="tab-pane" id="tab2">
                  2
                </div>
                <div class="tab-pane" id="tab3">
                    3
                </div>
                <div class="tab-pane" id="tab4">
                    4
                </div>
                <div class="tab-pane" id="tab5">
                    5
                </div>
                <div class="tab-pane" id="tab6">
                    6
                </div>
                <div class="tab-pane" id="tab7">
                    7
                </div>
                <ul class="pager wizard">
                    <li class="previous first" style="display:none;"><a href="#">First</a></li>
                    <li class="previous"><a href="#">Previous</a></li>
                    <li class="next last" style="display:none;"><a href="#">Last</a></li>
                    <li class="next"><a href="#">Next</a></li>
                </ul>
            </div>  
        </div>
    </div>

这是我的CSS

.bwizard-steps {
display: inline-block;
margin: 0; padding: 0;
background: #fff }
.bwizard-steps .active {
    color: #fff;
    background: #007ACC }
.bwizard-steps .active:after {
    border-left-color: #007ACC }
.bwizard-steps .active a {
    color: #fff;
    cursor: default }
.bwizard-steps .label {
    position: relative;
    top: -1px;
    margin: 0 5px 0 0; padding: 1px 5px 2px }
.bwizard-steps .active .label {
    background-color: #333;}
.bwizard-steps li {
    display: inline-block; position: relative;
    margin-right: 5px;
    padding: 12px 17px 10px 30px;
    *display: inline;
    *padding-left: 17px;
    background: #efefef;
    line-height: 18px;
    list-style: none;
    zoom: 1; }
.bwizard-steps li:first-child {
    padding-left: 12px;
    -moz-border-radius: 4px 0 0 4px;
    -webkit-border-radius: 4px 0 0 4px;
    border-radius: 4px 0 0 4px; }
.bwizard-steps li:first-child:before {
    border: none }
.bwizard-steps li:last-child {
    margin-right: 0;
    -moz-border-radius: 0 4px 4px 0;
    -webkit-border-radius: 0 4px 4px 0;
    border-radius: 0 4px 4px 0; }
.bwizard-steps li:last-child:after {
    border: none }
.bwizard-steps li:before {
    position: absolute;
    left: 0; top: 0;
    height: 0; width: 0;
    border-bottom: 20px inset transparent;
    border-left: 20px solid #fff;
    border-top: 20px inset transparent;
    content: "" }
.bwizard-steps li:after {
    position: absolute;
    right: -20px; top: 0;
    height: 0; width: 0;
    border-bottom: 20px inset transparent;
    border-left: 20px solid #efefef;
    border-top: 20px inset transparent;
    content: "";
    z-index: 2; }
.bwizard-steps a {
    color: #333 }
.bwizard-steps a:hover {
    text-decoration: none }
     .bwizard-steps.clickable li:not(.active) {
cursor: pointer }
    .bwizard-steps.clickable li:hover:not(.active) {
background: #ccc }
    .bwizard-steps.clickable li:hover:not(.active):after {
border-left-color: #ccc }
    .bwizard-steps.clickable li:hover:not(.active) a {
color: #08c }
    @media (max-width: 480px) { 
/* badges only on small screens */
.bwizard-steps li:after,
.bwizard-steps li:before {
    border: none }
.bwizard-steps li,
.bwizard-steps li.active,
.bwizard-steps li:first-child,
.bwizard-steps li:last-child {
    margin-right: 0;
    padding: 0;
    background-color: transparent }
     }

这是我的JS

    $(document).ready(function() {
    $('#rootwizard').bootstrapWizard({'tabClass': 'bwizard-steps'});    
    window.prettyPrint && prettyPrint()
}); 

最佳答案

来自 github

We will not longer be updating the bower version of bootstrap wizard or any other package manager. See #81 for the reason why. Please use 'master' branch instead.

使用 bower 安装 twitter-bootstrap-wizard#master

关于javascript - Bootstrap 3 表单向导,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22461862/

有关javascript - Bootstrap 3 表单向导的更多相关文章

  1. ruby-on-rails - Rails 编辑表单不显示嵌套项 - 2

    我得到了一个包含嵌套链接的表单。编辑时链接字段为空的问题。这是我的表格:Editingkategori{:action=>'update',:id=>@konkurrancer.id})do|f|%>'Trackingurl',:style=>'width:500;'%>'Editkonkurrence'%>|我的konkurrencer模型:has_one:link我的链接模型:classLink我的konkurrancer编辑操作:defedit@konkurrancer=Konkurrancer.find(params[:id])@konkurrancer.link_attrib

  2. ruby - 将 Bootstrap Less 添加到 Sinatra - 2

    我有一个ModularSinatra应用程序,我正在尝试将Bootstrap添加到应用程序中。get'/bootstrap/application.css'doless:"bootstrap/bootstrap"end我在views/bootstrap中有所有less文件,包括bootstrap.less。我收到这个错误:Less::ParseErrorat/bootstrap/application.css'reset.less'wasn'tfound.Bootstrap.less的第一行是://CSSReset@import"reset.less";我尝试了所有不同的路径格式,但它

  3. ruby - 如何在 Rails 4 中使用表单对象之前的验证回调? - 2

    我有一个服务模型/表及其注册表。在表单中,我几乎拥有服务的所有字段,但我想在验证服务对象之前自动设置其中一些值。示例:--服务Controller#创建Action:defcreate@service=Service.new@service_form=ServiceFormObject.new(@service)@service_form.validate(params[:service_form_object])and@service_form.saverespond_with(@service_form,location:admin_services_path)end在验证@ser

  4. ruby-on-rails - 使用 javascript 更改数据方法不会更改 ajax 调用用户的什么方法? - 2

    我遇到了一个非常奇怪的问题,我很难解决。在我看来,我有一个与data-remote="true"和data-method="delete"的链接。当我单击该链接时,我可以看到对我的Rails服务器的DELETE请求。返回的JS代码会更改此链接的属性,其中包括href和data-method。再次单击此链接后,我的服务器收到了对新href的请求,但使用的是旧的data-method,即使我已将其从DELETE到POST(它仍然发送一个DELETE请求)。但是,如果我刷新页面,HTML与"new"HTML相同(随返回的JS发生变化),但它实际上发送了正确的请求类型。这就是这个问题令我困惑的

  5. ruby-on-rails - 从 ActiveAdmin has_many 表单助手中删除 "Add new"按钮 - 2

    我在事件管理员编辑页面中有嵌套资源,但我只想允许管理员编辑现有资源的内容,而不是添加新的嵌套资源。我的代码看起来像这样:formdo|f|f.inputsdof.input:authorf.input:contentf.has_many:commentsdo|comment_form|comment_form.input:contentcomment_form.input:_destroy,as::boolean,required:false,label:'Remove'endendf.actionsend但它在输入下添加了“添加新评论”按钮。我怎样才能禁用它,并只为主窗体保留f.ac

  6. css - Rails 4.1 和 Bootstrap 3 字形图标不工作 - 2

    我正在尝试消除使用Bootstrap3的Rails4元素中的glyphicon错误。我没有使用任何Bootstrapgem将其添加到Assets管道中。我手动将bootstrap.css和bootstrap.js添加到各自的app/assets目录下,分别添加到application.css和application.js什么的我现在在网络浏览器的控制台中看到以下内容:GEThttp://localhost:3000/fonts/glyphicons-halflings-regular.woff404(NotFound)localhost/:1GEThttp://localhost:30

  7. ruby - 在 Mechanize 中使用 JavaScript 单击链接 - 2

    我有这个:AccountSummary我想单击该链接,但在使用link_to时出现错误。我试过:bot.click(page.link_with(:href=>/menu_home/))bot.click(page.link_with(:class=>'top_level_active'))bot.click(page.link_with(:href=>/AccountSummary/))我得到的错误是:NoMethodError:nil:NilClass的未定义方法“[]” 最佳答案 那是一个javascript链接。Mechan

  8. ruby-on-rails - 用于 Rails 的 HAML 表单 - 2

    我目前正在尝试将ERB布局转换为HAML。这是我不断收到的错误:index.html.haml:18:syntaxerror,unexpected')'));}\n#{_hamlout.format_...这是HAML页面:.row-fluid.span6%h2TodoList.span6%h2{:style=>"text-align:right;"}document.write(today)%hr.divider.row-fluid.span6%h2.small_headNewTask=render:partial=>'layouts/form_errors',:locals=>{:

  9. ruby-on-rails - 如何在 Rails 中为现有模型生成表单? - 2

    为现有模型生成单个文件(_form.html.erb)的命令是什么?在Rails3中工作。谢谢。 最佳答案 这听起来可能很傻,但请听我说完……当我想开始清洁时,我自己也做过几次这样的事情。以下是一个脚本,它将读取您的模式并生成必要的生成命令来重现它:require'rubygems'require'active_support/core_ext'schema=File.read('db/schema.rb')schema.scan(/create_table"(\w+)",.*?\n(.*?)\nend/m).eachdo|name

  10. ruby-on-rails - Ruby on Rails : if current page? 是主页,不显示表单 - 2

    我不想显示表单,但前提是当前页面不是主页这是我目前所拥有的...我有我的路线设置:root'projects#index'我的看法:'projects',:action=>'index'))%>showsomestuff如果url是localhost:3000/projects,则不会显示但是它显示了它的localhost:3000所以我需要以某种方式确保它不会显示主页。另外,我有主页的搜索参数,但我仍然不想显示它是否像localhost:3000/projects?search=blahblahblah 最佳答案 使用root_p

随机推荐