小编Cha*_*kar的帖子

如何在虚拟框中更改UUID

我正在尝试使用已有的硬盘在虚拟盒中创建一个新VM,但是当我尝试选择现有的硬盘文件(.vhd文件)时,它会显示一个错误,即无法使用虚拟硬盘,因为UUID已经存在.

所以我尝试了这个命令:

VBoxManage internalcommands sethduuid /home/user/VirtualBox VMs/drupal/drupal.vhd
Run Code Online (Sandbox Code Playgroud)

更改.vhd文件的UUID.但后来我得到了这个错误:

VBoxManage internalcommands sethduuid /home/user/VirtualBox VMs/drupal/drupal.vhd
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题?

virtualbox virtual-machine

125
推荐指数
7
解决办法
21万
查看次数

如何通过多行实现CSS文本加载动画?

我正在尝试用文本加载动画CSS.我所拥有的是一个黑色的文本,然后当页面加载文本将填充开始填充红色几秒钟.

我面临的问题是文本加载动画工作正常,但是当文本结束并以新行开头时,动画文本仍然在同一行上继续.

我怎样才能解决这个问题?

在此输入图像描述

码:

    body {
    background: #3498db;
    font-family: sans-serif;
    }
    h1 {
        position: relative;
        color: rgba(0, 0, 0, .3);
        font-size: 5em;
        white-space: wrap;
    }
    h1:before {
        content: attr(data-text);
        position: absolute;
        overflow: hidden;
        max-width: 100%;
        white-space: nowrap;
        word-break: break-all;
        color: #fff;
        animation: loading 8s linear;
    }
    @keyframes loading {
        0% {
            max-width: 0;
        }
    }
Run Code Online (Sandbox Code Playgroud)
<h1 data-text="Suspendisse mollis dolor vitae porta egestas. Nunc nec congue odio.">Suspendisse mollis dolor vitae porta egestas. Nunc nec congue odio.</h1>
Run Code Online (Sandbox Code Playgroud)

html css css3 css-animations

31
推荐指数
1
解决办法
2100
查看次数

如何将href定位到div

在这里,我试图打开并获取一个div的内容到目标div点击一个href.在这里,我有一个表,我有hrefs有div ID的链接,我有一个目标div是空的.

当我点击href链接时,链接的div内容应该在目标div中打开.

对于ex:对于链接fea1我已经链接了id #m1,当我点击它时fea1,#m1内容应该出现在目标div中.

我怎样才能做到这一点???

这是我的代码:

HTML:

<!DOCTYPE html>
<html>
  <head>
    <title>
      Example
      </title>
      <link rel="stylesheet" type="text/css" href="css/style.css" />
      </head>
      <body>

        <table border="0">
          <tr>
            <td>
              <hr>
              <a href="#m1">
                fea1
              </a>
              <br>
              <hr>
              <a href="#m2">
                fea2
              </a>
              <br>
              <hr>
              <a href="#m3">
                fea3
              </a>
              <br>
              <hr>
              <a href="#m4">
                fea4
              </a>
              <br>
              <hr>
              <a href="#m5">
                fea5
              </a>
              <br>
              <hr>
              <a href="#m6">
                fea6
              </a>
              <br>
              <hr>
              <a href="#m7">
                fea7
              </a>
              <br>
              <hr>
              <a href="#m8">
                fea8
              </a> …
Run Code Online (Sandbox Code Playgroud)

html css

17
推荐指数
2
解决办法
14万
查看次数

如何从锚子中获取父div id

<div class="wizard-rules" id="wizard-rule">If <a href="#" onclick="alert(this.id)" id="dashboard-rule-2" class="highlight">ALL DASHBOARD</a> encounters an error</div>
Run Code Online (Sandbox Code Playgroud)

在这里,我想wizard-rule在锚标签上点击div id .我怎样才能做到这一点?

现在锚标签只是获取锚标签本身的id.但不是其父元素的id.

html javascript

9
推荐指数
1
解决办法
6984
查看次数

如何在Bootstrap中创建切片布局

我在我的网站上使用Bootstrap 3,我有很多帖子.现在我使用bootstrap列和面板来显示索引页面上的帖子.

但我想在瓷砖视图中显示相同的帖子,如Pinterest页面.

在bootstrap 3中有没有办法做到这一点?现在我的布局看起来像

<div class="row product-list">
    <?php getList(); ?>
</div>
Run Code Online (Sandbox Code Playgroud)

函数获取帖子列表的位置.它们显示在这样的面板中:

<a href="product-des.php?1">
<div class='col-xs-12 col-sm-4 col-md-3 col-lg-3'><div class='panel panel-warning'>
<div class='panel-heading'>Microsoft Lumia 575</div>
<div class='panel-body'>
<img class='product_listing_img img-responsive' src=files/uploaded_images/mobile-2.jpg></div>
</div>
</div>
</a>
Run Code Online (Sandbox Code Playgroud)

目前来看

现在使用面板看起来像什么

预期的观点

我喜欢它的样子(Pinterest风格)

css twitter-bootstrap

9
推荐指数
2
解决办法
5万
查看次数

如何检查用户是否已登录rails devise?

我正在尝试根据用户身份验证向我的rails应用程序添加标头.所以我在这里检查,如果用户已登录或登录,然后添加登录/注销链接基于此.

但我得到错误:

application.html.erb:16: syntax error, unexpected tSYMBEG, expecting keyword_do or '{' or '(' ...roy_user_session_path, method :delete );@output_buffer.safe_
Run Code Online (Sandbox Code Playgroud)

这是我尝试过的:

<% if user_signed_in? do %> 
    <%= link_to "Log out", destroy_user_session_path, method :delete %>
<% else %>
    <%= link_to "login", new_user_session_path %>
<% end %>
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题?

ruby-on-rails devise

9
推荐指数
2
解决办法
1万
查看次数

如何从php输出到typeahead?

我使用twitter typeahead和php作为后端从mysql获取数据.但是当我开始在文本框中输入时,我无法看到任何建议.我认为因为php输出必须是JSON编码..

我该如何编码输出

输出:

echo '<a href="results.html" class="searchres" onclick="navigate()" style="color:#696969;text-decoration:none;"><img src='.$iurl.' class="icons" /><div class="results" style="color:#696969;text-decoration:none;">'."$fname".'</div><span style="color:#696969;text-decoration:none;" class="author">'.$caption.'</span></a>'."\n";
Run Code Online (Sandbox Code Playgroud)

HTML:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example of Twitter Typeahead</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script  type="text/javascript" src="../js/typeahead.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    $('input.typeahead').typeahead({
        name: 'countries',
        prefetch: 'getvalues.php',
        limit: 10
    });
});  
</script>
<style type="text/css">
.bs-example{
    font-family: sans-serif;
    position: relative;
    margin: 100px;
}
.typeahead, .tt-query, .tt-hint {
    border: 2px solid #CCCCCC;
    border-radius: 8px;
    font-size: 24px;
    height: 30px;
    line-height: 30px;
    outline: medium none;
    padding: 8px 12px;
    width: …
Run Code Online (Sandbox Code Playgroud)

php mysql jquery typeahead.js

8
推荐指数
1
解决办法
5521
查看次数

如何检查对象数组中是否存在键

我试图找出给定的键是否存在于对象数组中。如果值键存在,那么我想返回 true 否则返回 false。

我从文本框中输入键,然后检查键是否存在于对象数组中,但我无法得到它。

这是我尝试过的

代码:

var obj = [{
    "7364234":"hsjd",
    "tom and jerry":"dsjdas",
    "mickey mouse":"kfjskdsad",
    "popeye the sailor man":"alkdsajd",
    "the carribean":"kasjdsjad"
}]

var val = $("input[name='type_ahead_input']").val();

if (obj[val]) {
    console.log('exists');
} else {
    console.log('does not exist');
}
Run Code Online (Sandbox Code Playgroud)

如果我将输入作为the carribean对象数组中存在的' '给出,即使它在控制台中的输出也不存在。

我该如何解决这个问题?

javascript arrays

8
推荐指数
3
解决办法
3万
查看次数

在工具提示中显示的 div 顶部添加一个三角形?

我有一个 div,它将显示在某个元素的悬停上。当我们将鼠标悬停在元素上时将显示的 div 显示在元素下方。我需要/\使用 css将三角形添加到 div 的顶部。

我怎样才能做到这一点?

HTML

<div class="user-options">
        <ul class="settings">
            <li><a href="home.html">JOHN DOE</a></li>
            <li><a href="user-customization.html">My Playground</a></li>
            <li><a href="myrules.html">Settings</a></li>
            <li><a href="index.html">Logout</a></li>
        </ul>
    </div>
Run Code Online (Sandbox Code Playgroud)

CSS

.user > .user-options {
    background: none repeat scroll 0 0 #eeeeee;
    display: none;
    margin-top: 25px;
    overflow: auto;
    padding: 0 0 0 10px;
    position: absolute;
    width: 125px;
    z-index: 999;
    border:solid #cccccc 1px;
    margin-left:-24px;
}
Run Code Online (Sandbox Code Playgroud)

html css

5
推荐指数
1
解决办法
4173
查看次数

如何遍历具有随机元素的表单

我试图遍历在随机元素中有标签的表单,并检查标签是否与给定的标签名称匹配,如果匹配,我正在为该元素添加一个类.但是我无法让它工作,我该怎么做?

这是我尝试过的.

在div之类的随机元素中包含标签的表单

<form id="grtform">
    <div id="section-1">
        <lable>Currency type</lable>
        <input type="text" name="currencyType">
    </div>

    <div id="section-2">
        <lable>Currency rate</lable>
        <input type="text" name="currencyRate">
    </div>

        <lable>Currency of country</lable>
        <input type="text" name="currencyCountry">

    <div id="section-3">
        <div class="formData">
            <lable>Currency due</lable>
            <input type="text" name="currencyDue">
        </div>
    </div>
  </form>
Run Code Online (Sandbox Code Playgroud)

Jquery代码:

$("#grtform").each(function(){
                var matchLable = "Currency due"
                var lable = $(this).find('label').text();
                if(matchLable == lable){
                    $(this).addClass('matchFound');
                }
      });
Run Code Online (Sandbox Code Playgroud)

javascript jquery

4
推荐指数
1
解决办法
49
查看次数