单击时,文本会消失,这会移动代码中更进一步的块。我希望它落在上面。使用添加,position: absolute
一切正常,但按钮消失。我希望按钮与文本一起离开。也许有人遇到并可以帮助解决这个问题?
主页
/
user-234310
Misha Rodnoy's questions
问题是它突然打开,但在相反的方向上它应该正常工作。
$('.test').click(function() {
var test = $(this).prev();
if (test.innerHeight() == 106) {
test.animate({
height: "100%",
}, 1000);
} else {
test.animate({
height: 106,
}, 1000);
}
});
p {
background-color: #E3DEDE;
height: 106px;
overflow: hidden;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.1/jquery.min.js"></script>
<p>The best products begin with the best ingredients. Flour is milled only from select grades of the best wheat grains; the best nature has to offer, it looks like white powder. We have many varieties and formats for diverse applications.High quality grade.
This sort of flour is pretty clear from which is preparing only from well-peeled grains. This grade of flour characterize by a low content of gluten and large amount of starch. This grade of flour has white color with a light milky shade. This grade
often use in cooking, because batch turns out splendid and porous.The first grade of flout. This is the most popular grade, which allows for a small number of grain shells. This grade of flour is characterize large amount of gluten, which makes it possible
to get a very elastic dough. This grade of flour has a light yellow color. Batches turns out volumetric and fragrant.The second grade of flour. This grate is characterized by a darker grayish color, which has a large number of grain envelopes this is
allowing in the composition. Batches turns out lush and porous. This grade of flour don’t use for turn out for saltwater fish splashDifferent grade of flour differ from each other parameters: the amount of flour, which turn our from 100 kg of grain,
product color, ash content, particle size, as well as the presence of bran and the amount of gluten.</p>
<button class="test">test</button>
如何出行?您需要单击以将块打开到最大高度。我觉得问题就出在这里。
height: "100%"
我试着把 auto 放在这里,它不起作用。只需要一个整数值。
jsfiddle示例
echo Accordion::widget([
'items' => [
[
'header' => 'Section 1',
'content' => 'Mauris mauris ante, blandit et, ultrices a, suscipit eget...',
'options' => ['tag' => 'div', 'active' => false],
],
[
'header' => 'Section 2',
'headerOptions' => ['tag' => 'h3'],
'content' => 'Sed non urna. Phasellus eu ligula. Vestibulum sit amet purus...',
'options' => ['tag' => 'div'],
],
],
'options' => ['tag' => 'div'],
'itemOptions' => ['tag' => 'div'],
'headerOptions' => ['tag' => 'h2'],
'clientOptions' => ['collapsible' => true],
]);
请告诉我如何使第一个选项卡默认处于非活动状态。它没有写在停靠栏中,但在 jquery 手风琴中有一个活动选项。我尝试应用它,但显然不在那些地方。
.description-wrap {
background: #FFD700;
width: 1200px;
height: 600px;
text-align: center;
}
.description-table {
display: table;
border: 1px solid green;
width: 100%;
height: 100%;
}
.description-cell {
border: 1px dashed red;
display: table-cell;
vertical-align: middle;
}
.description-text {
border-top: 3px solid #000;
border-bottom: 3px solid #000;
padding: 15px 0;
font-size: 40px;
font-weight: normal;
color: #000;
}
.description-text:first-child {
margin-bottom: 5%;
}
<body>
<div class="description-wrap">
<div class="description-table">
<div class="description-cell">
<div class="description-text">БИРЮЧИЙ ОСТРОВ</div>
<div class="description-text">АЗОВО-СИВАШСКИЙ НАЦИОНАЛЬНЫЙ
<br>ПРИРОДНЫЙ ПАРК</div>
</div>
</div>
</div>
</body>
问题是你需要根据 div 块中的内容来制作宽度。我想保留顶部和底部边框(比如
) 进行造型。像这样
我会很感激你的帮助。
我正在尝试使用命名空间制作单调 PDO。这是连接 Db 类
namespace liw\components;
class Db {
private static $_db = null;
private function __construct() {}
private function __clone() {}
private function __wakeup() {}
public static function getInstance() {
if (self::$_db === null) {
$dsn = "mysql:host=localhost;dbname=table";
self::$_db = new PDO($dsn, 'root', '');
}
return self::$_db;
}
}
尝试访问模型中的 Db 类会导致错误
找不到类“liw\components\PDO”
namespace liw\models;
class Test {
private $_db = null;
public function __construct() {
$this->_db = \liw\components\Db::getInstance();
}
public function getList() {
$list= array();
$result = $this->_db->query("SELECT * FROM table");
$i = 0;
while ($row = $result->fetch()) {
$list[$i]['id'] = $row['id'];
$i++;
}
return $list;
}
}
我知道有人试图创建一个没有命名空间的 PDO 类。如何解决?
再会。
假设有一个变量$className = "Test"
。您需要使用命名空间创建类的实例。
$classObject = new liw\controllers\$className;
会报错:
语法错误,意外的“$className”(T_VARIABLE)
如何摆脱这个问题?
如果你这样做,那么一切都会奏效,但这是对的吗?
$className = "Test";
$className = "liw\\controllers\\{$className}";
$classObject = new $className();
有一个连接到数据库:
class Db {
public static function getConnection() {
$paramsPath = ROOT . '/config/db_params.php';
$params = include($paramsPath);
$dsn = "mysql:host={$params['host']};dbname={$params['dbname']}";
$db = new PDO($dsn, $params['user'], $params['password']);
$db->exec("set names utf8");
return $db;
}
}
在每个类中,在每个方法中,我都这样做:
public static function getCategoriesList() {
$db = Db::getConnection();
$result = $db->query('SELECT id, name FROM category '
. 'ORDER BY sort_order ASC');
.........
}
如何摆脱这个糟糕的代码? $db = Db::getConnection();
如何在索引文件中调用连接而不是在每个方法中每次都连接?怎么可能创建一个连接类,在其他类中通过构造函数敲它呢?