小编Cod*_*000的帖子

如何在<a></a>(链接图像)之间调整图像大小?

代码:

<div class="marquee">
   <ul>
      <li>
       <a href="https://developer.apple.com/swift/"><img class="marquee-itm" src="Vendors/Images/Apple_Swift_Logo.png" /></a>
Run Code Online (Sandbox Code Playgroud)

情况:

当我删除<a>标签时,这有效:

.marquee ul li img {
    max-height: 80%;
}
Run Code Online (Sandbox Code Playgroud)

问题:

添加 时<a>,我找不到设置图像样式的方法。

1) 不起作用。

.marquee ul li a img {
    max-height: 80%;
}
Run Code Online (Sandbox Code Playgroud)

2)不起作用。

.marquee ul li a {
    max-height: 80%;
}
Run Code Online (Sandbox Code Playgroud)

3)不起作用。

.marquee-items {
    max-height: 80%;
}
Run Code Online (Sandbox Code Playgroud)

题:


我怎样才能让它与<a>标签一起工作来保持我的图片链接?


编辑:

只是想确保没有误解。我正在使用一个已经定义了宽度的轮播。旋转木马中有许多图像。我只需要定义图像的最大高度,这样它们就不会溢出。通过添加<a></a>标签制作可点击的图像后,我似乎无法选择它们。

还:

4) 不起作用。

.marquee ul li a{
    display: inline-block; 
    max-height: 80%;
}

.marquee ul li a img {
    max-height: …
Run Code Online (Sandbox Code Playgroud)

html css size styles image

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

如何使用 Node.js 在 Firebase 中注册用户?

问题:

0)用户是在 Firebase 的身份验证系统中创建的(我在“身份验证”选项卡中看到它),

1)但没有对数据库进行任何更改。

2)页面似乎无限加载。

3) 仅“Started 1...”记录到控制台。


代码:

router.post('/register', function(req, res, next) {
    var username = req.body.username;
    var email = req.body.email;
    var password = req.body.password;
    var password2 = req.body.password2;

    // Validation
    req.checkBody('username', 'Username is required').notEmpty();
    req.checkBody('email', 'Email is required').notEmpty();
    req.checkBody('email', 'Email is not valid').isEmail();
    req.checkBody('password', 'Password is required').notEmpty();
    req.checkBody('password2', 'Passwords do not match').equals(req.body.password);

    var errors = req.validationErrors();

    if(errors){
        res.render('users/register', {
            errors: errors
        });
    } else {
        console.log("Started 1...");
        firebase.auth().createUserWithEmailAndPassword(email, password).catch(function(error, userData) {
            console.log("Started 2...");
            if(error){
                var errorCode = …
Run Code Online (Sandbox Code Playgroud)

javascript node.js express firebase firebase-realtime-database

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

AJAX 响应错误:net::ERR_EMPTY_RESPONSE

代码:

前端

$(document).ready(function(){
        $('.delete-post').on('click', function(){
            var id = $(this).data('id');
            var section = $(this).data('section');
            var url = '/users/delete/'+id;
            if(confirm("Delete Post ?")){
                $.ajax({
                    url: url,
                    type:'DELETE',
                    success: function(result){
                        console.log('Deleting post...');
                        window.location.href='/users/profile';
                    },
                    error: function(err){
                        console.log(err);
                    }
                });
            }
        });
    });
Run Code Online (Sandbox Code Playgroud)

后端:

router.delete('/delete/:id', function(req, res, next) {

    var id = req.params.id;
    var section = req.params.section;

    var image = "";
    var author = "";

    var postRef = firebase.database().ref("posts/"+section+"/"+id);
    var userRef = firebase.database().ref("users/posts/"+id);
    var likesRef = firebase.database().ref("users/likes/"+id);
    var hotRef = firebase.database().ref("hot/"+section+"/"+id);

    postRef.once('value', function(snapshot){
        image = …
Run Code Online (Sandbox Code Playgroud)

javascript ajax jquery node.js firebase

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

错误语法错误:JSON 中位置 0 处出现意外标记 &lt;

错误:

core.es5.js?0445:1084 ERROR SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>
Run Code Online (Sandbox Code Playgroud)

情况:

我想要实现的是预先选择用户之前已经做出的选择并防止他投票两次。


代码:

组件.html

<article class="panel panel-default">
    <div class="panel-body">
      {{ poll.title }}
      <br>
      <br>
      <form #form="ngForm">
        <fieldset [disabled]="alreadyVotedFor(-1)">
          {{ poll.counter1 }} votes <input type="radio" id="{{ poll.choice1 }}" name="my_radio" value="{{ poll.choice1 }}" (click)="onChoice1(form)" [checked]="alreadyVotedFor(1)">  {{ poll.choice1 }}
          <br>
          {{ poll.counter2 }} votes <input type="radio" id="{{ poll.choice2  }}" name="my_radio" value="{{ poll.choice2 }}" (click)="onChoice2(form)" [checked]="alreadyVotedFor(2)">  {{ poll.choice2 }}
        </fieldset>
      </form>

    </div>
    <footer class="panel-footer">
        <div class="author">
            {{ poll.username }} …
Run Code Online (Sandbox Code Playgroud)

javascript mongodb node.js typescript angular

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

将鼠标悬停在图表上时如何显示百分比?

情况:

我希望在将鼠标悬停在图表上时获得的数字工具提示旁边添加一个百分比。我怎样才能做到这一点?例如,我想在%旁边添加一个标志83.33

在此处输入图片说明


错误:

ERROR TypeError: Cannot read property '0' of undefined
at i.label (eval at <anonymous> (http://localhost:3000/js/app/bundle.js:1564:1), <anonymous>:37:63)
Run Code Online (Sandbox Code Playgroud)

代码:

// Pie
public pieChartLabels:string[] = [];
public pieChartData:number[] = [];
public pieChartType:string = 'pie';
public pieChartOptions:any = {};

ngOnInit() {
    var result1 = parseFloat(((this.poll.counter1/(this.poll.counter2+this.poll.counter1))*100).toFixed(2));
    var result2 = parseFloat(((this.poll.counter2/(this.poll.counter2+this.poll.counter1))*100).toFixed(2));
    this.pieChartData = [result1, result2];
    this.pieChartLabels = [this.poll.choice1, this.poll.choice2];
    this.pieChartType = 'pie';
    this.pieChartOptions  = {
                            tooltips: {
                                callbacks: {
                                    label: function (tooltipItems, data) {
                                            return data.datasets[tooltipItems.datasetIndex].label + ': ' + …
Run Code Online (Sandbox Code Playgroud)

javascript chart.js ng2-charts angular

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