无法在固定位置div下使用滚动条

时间:2019-10-02 12:31:56

标签: html css

在div内有一个带有滚动条的HTML表。还有一个绝对位置与表格div重叠的div。问题是,表div的滚动条位于绝对div(飞行气球动画)的后面,因此我无法使用它。有没有办法使用绝对div下面的滚动条?

enter image description here

HTML:

from sklearn.pipeline import Pipeline
from nltk.tokenize import word_tokenize
from nltk.stem import WordNetLemmatizer
from sklearn.feature_extraction.text import TfidfVectorizer
import pandas as pd
from sklearn.pipeline import Pipeline
from sklearn.model_selection import train_test_split

dataset = pd.read_csv('./train.csv', encoding='ISO-8859-1')
text = dataset['SentimentText']
sentiment = dataset['Sentiment']
import re
from sklearn.base import TransformerMixin, BaseEstimator


from sklearn.pipeline import Pipeline


class Preprocess(BaseEstimator, TransformerMixin):

    def fit(self, X):
        return self

    def transform(self, X):


        x = X.str.replace('[^a-zA-Z]', ' ')
        x = x.str.lower()
        return x


def lamma(text):
    lam = WordNetLemmatizer()
    return [lam.lemmatize(token) for token in word_tokenize(text)]


vectorizer = TfidfVectorizer(tokenizer=lamma, ngram_range=(1, 2))
pipeline = Pipeline([
    ('text_pre_processing', Preprocess()),
    ('vectorizer', vectorizer)
])
train_x, test_x, train_y, test_y = train_test_split(text, sentiment, test_size=0.3, random_state=7)
learn_data = pipeline.fit_transform(train_x)


test_data = pipeline.transform(test_x)

import warnings

warnings.filterwarnings('ignore')
import tensorflow as tf
import numpy as np
import pandas as pd

learning_rate = 0.1
epochs = 10
loss_history = np.empty(shape=[1], dtype=float)
n_dim = learn_data.shape[1]
print(n_dim)
n_class = 2
hidden_1 = 60
hidden_2 = 60
hidden_3 = 60
hidden_4 = 60

x = tf.placeholder(tf.float32, [None, n_dim])
w = tf.Variable(tf.zeros([n_dim, n_class]))
b = tf.Variable(tf.zeros([n_class]))
y_ = tf.placeholder(tf.float32, [None, n_class])


def perceptron(x, weights, biases):
    layer_1 = tf.add(tf.matmul(x, weights['h1']), biases['b1'])
    layer_1 = tf.nn.relu(layer_1)
    print(layer_1)

    layer_2 = tf.add(tf.matmul(layer_1, weights['h2']), biases['b2'])
    layer_2 = tf.nn.relu(layer_2)

    print(layer_2)

    layer_3 = tf.add(tf.matmul(layer_2, weights['h3']), biases['b3'])
    layer_3 = tf.nn.relu(layer_3)

    print(layer_3)

    layer_4 = tf.add(tf.matmul(layer_3, weights['h4']), biases['b4'])
    layer_4 = tf.nn.relu(layer_4)
    print(layer_4)

    out_layer = tf.matmul(layer_4, weights['out']) + biases['out']
    return out_layer


weights = {
    'h1': tf.Variable(tf.truncated_normal([n_dim, hidden_1])),
    'h2': tf.Variable(tf.truncated_normal([hidden_1, hidden_2])),
    'h3': tf.Variable(tf.truncated_normal([hidden_2, hidden_3])),
    'h4': tf.Variable(tf.truncated_normal([hidden_3, hidden_4])),
    'out': tf.Variable(tf.truncated_normal([hidden_4, n_class]))

}

biases = {
    'b1': tf.Variable(tf.truncated_normal([hidden_1])),
    'b2': tf.Variable(tf.truncated_normal([hidden_2])),
    'b3': tf.Variable(tf.truncated_normal([hidden_3])),
    'b4': tf.Variable(tf.truncated_normal([hidden_4])),
    'out': tf.Variable(tf.truncated_normal([n_class]))
}

init = tf.global_variables_initializer()
saver = tf.train.Saver()
y = perceptron(x, weights, biases)
loss_function = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=y, labels=y_))
training_step = tf.train.GradientDescentOptimizer(learning_rate).minimize(loss_function)
sess = tf.Session()
sess.run(init)

mse_history = []
accuracy_history = []

for epoch in range(epochs):
    sess.run(training_step, feed_dict={x: learn_data, y_: train_y})
    loss = sess.run(loss_function, feed_dict={x: learn_data, y_: train_y})
    loss_history = np.append(loss_history, loss)
    correct_prediction = tf.equal(tf.argmax(y, 1), tf.argmax(y_, 1))
    accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))
    pred_y = sess.run(y, feed_dict={x: test_data})
    mse = tf.reduce_mean(tf.square(pred_y - test_y))
    mse_ = sess.run(mse)
    mse_history.append(mse_)
    accuracy = (sess.run(accuracy, feed_dict={x: learn_data, y_: train_y}))
    accuracy_history.append(accuracy)
    print('epoch:', epoch, '-', 'loss', loss, '- MSE:', mse_, 'Train Accuarcy: ', accuracy)

#parent {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 100;
  width: 400px;
  height: 100vh;
  overflow: hidden;
}

.message {
  position: absolute;
  left: 0;
  bottom: -120px;
  height: 120px;
  width: 120px;
  background-color: white;
  color: white;
  line-height: 115px;
  text-align: center;
  font-family: Arial, sans-serif;
  font-weight: bold;
  border-radius: 60px;
  animation: move 6s infinite linear;
  opacity: 0.8;
}

.message:nth-child(2) {
  left: 120px;
  animation-delay: 2s;
}

.message:nth-child(3) {
  left: 240px;
  animation-delay: 4s;
}

@keyframes move {
  0% {
    bottom: -120px;
  }
  100% {
    bottom: 100%;
  }
}

0 个答案:

没有答案