小编Val*_* Do的帖子

如何在jquery中使用substr()函数?

如何在我需要的脚本中使用substr函数 substr(0,25);

<a class="dep_buttons" href="#"> something text something text something text something text something text something text </a>

$('.dep_buttons').mouseover(function(){
    if($(this).text().length > 30) {
        $(this).stop().animate({height:"150px"},150);
    }
    $(".dep_buttons").mouseout(function(){
        $(this).stop().animate({height:"40px"},150);
    });
});
Run Code Online (Sandbox Code Playgroud)

jquery

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

preventDefault在提交按钮中不起作用

我有html表单,当我点击submit按钮页面去insert.php我不会阻止防止不工作我有这个script HTML

HTML

<form action="insert.php" method="post">
<input  type="text" name="username" placeholder=""><br />
<input  type="text" name="name" placeholder=""><br />
<input  type="text" name="lastname" placeholder=""><br />
<input id="mail" name="email" type="text" placeholder="E-mail"><br />
<input id="mail_1" type="text" placeholder="reply E-mail"><br />
<input id="password" name="password" type="password" placeholder=""><br />
<input id="password_1"  type="password" placeholder=""><br /> 
<input id="submit" type="submit" value="registration">
</form>
Run Code Online (Sandbox Code Playgroud)

jQuery的

$("#submit").click(function(event){
    event.preventDefault();
});
Run Code Online (Sandbox Code Playgroud)

javascript jquery

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

当我在css中使用margin auto属性时,如何使用javascript获取边距左边的大小

我有div,margin:auto;我需要margin-left使用javascript 只获取大小值:)

//css
.test{
        margin: auto;
        width: 100px;
        height: 100px;
        outline: 1px solid red;
    }


 // html
        <div class="test">Test</div>
Run Code Online (Sandbox Code Playgroud)

实例

javascript jquery

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

在jquery中隐藏字符

我需要在35后隐藏角色,当我悬停文字显示全文帮助我

<a class="dep_buttons" href="#"> something text something text something text something text something text something text </a>

$('.dep_buttons').mouseover(function () { 
    if($(this).text().length > 30) {
       $(this).stop().animate({height:"150px"},150);
}
})
$(".dep_buttons").mouseout(function(){
    $(this).stop().animate({height:"40px"},150);
});
Run Code Online (Sandbox Code Playgroud)

jquery

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

jquery验证 - 使用表单标记

所有这些输入标签都在<form></form>标签内

<input  type="text" placeholder="username"><br />
<input  type="text" placeholder="Name"><br />
<input  type="text" placeholder="Lastname"><br />
<input id="mail" type="text" placeholder="E-mail"><br />
<input id="mail_1" type="text" placeholder="Re enter E-mail"><br />
<input id="password" type="password" placeholder="password"><br />
<input id="password_1"  type="password" placeholder="Re enter password"><br /> 
<input id="submit" type="submit" value="registration">
Run Code Online (Sandbox Code Playgroud)

下面的脚本不起作用.sombody可以帮帮我吗?

$("#submit").click(function(){
  var email = $("#mail").val();
  var email_1 = $("#mail_1").val();
  var password = $("#password").val();
  var password_1 = $("#password_1").val();
  if (email != email_1){
    $("#mail,#mail_1").css({"border":"1px solid red","background-color":"#FF9999"});
    alert("wrong mail");
  }
  else{
    $("#mail,#mail_1").css({"border":"1px solid green","background-color":"#C2FFC2"});
  }
  if (password != password_1){ …
Run Code Online (Sandbox Code Playgroud)

javascript jquery

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

如何在jquery函数之后获取默认的css值

嗨我有一个问题例如:

$("#menu").click(function(){
    $("#left_panel, #main_footer").fadeToggle(200);
    $("#input_content").css({width:"100%"});
});
Run Code Online (Sandbox Code Playgroud)

我希望在此函数之后css获取默认属性

jquery

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

媒体查询差异屏幕大小在一个CSS样式表中

你好我有这个脚本,我需要当屏幕尺寸为1600像素background-color 是红色,当屏幕尺寸为1366像素background-color是黑色,但我的代码不起作用,媒体查询只能工作1600像素

HTML

<div>

</div>
Run Code Online (Sandbox Code Playgroud)

CSS

div{
    width:100%;
    height:100%;
    background-color:grey;
}

@media screen and (max-width:1366px){
    div{
        background-color:black;
    }
}

@media screen and (max-width:1600px){
    div{
        background-color:red;
    }
}
Run Code Online (Sandbox Code Playgroud)

css

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

CSS3动画背景不适用于Firefox

你好,我有这个例子,它的工作正常铬和歌曲,但不能在Firefox中工作

检查小提琴

    body {
    width: 100%;
    height: 100%;
    background: url('http://www.picz.ge/img/s2/1505/17/1/1b588904a0d2.png');
    -webkit-animation: mymove 10s;
    /* Chrome, Safari, Opera */
    -webkit-animation-iteration-count: infinite;
    /* Chrome, Safari, Opera */
    -moz-animation: mymove 10s;
    -moz-animation-iteration-count: infinite;
    animation: mymove 10s;
    animation-iteration-count: infinite;
}
@-webkit-keyframes mymove {
    from {
        background: url('http://www.picz.ge/img/s2/1505/17/1/1b588904a0d2.png');
    }
    to {
        background: url('http://www.picz.ge/img/s4/1505/17/b/b2c36d72aaa6.png');
    }
}
@-moz-keyframes mymove {
    from {
        background: url('http://www.picz.ge/img/s2/1505/17/1/1b588904a0d2.png');
    }
    to {
        background: url('http://www.picz.ge/img/s4/1505/17/b/b2c36d72aaa6.png');
    }
}
@keyframes mymove {
    from {
        background: url('http://www.picz.ge/img/s2/1505/17/1/1b588904a0d2.png');
    }
    to {
        background: url('http://www.picz.ge/img/s4/1505/17/b/b2c36d72aaa6.png');
    }
}
Run Code Online (Sandbox Code Playgroud)

css css3 css-animations

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

如何在mouseover事件中每次计算img标记

我需要每次在mouseover事件上计算div 这里是例子

$(document).ready(function() {

  var thumb = $('.thm-img img');
  var outer = $('.mn-img');
  var full = $('.full-img');
  var count = $('.mn-img img').length;
  var count = $('.mn-img img').length;
  var sc_height = $(outer).height();

  $(thumb).mouseover(function() {

    console.log(count);
    $(full).hide();
    if (!$(this).hasClass('added')) {
      $(this).addClass('added').clone().insertAfter($(full));
      // $(outer).animate({scrollTop : sc_height + "px"},200);
    }
  });
});
Run Code Online (Sandbox Code Playgroud)
.det-sl-wrp {
  display: block;
  width: 100%;
  height: 480px;
  background: #FFFFFF;
  border: 1px solid #fff;
  margin: 8px 0 8px 0;
}
.mn-img {
  position: relative;
  width: 650px;
  height: 100%;
  background: …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery

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

mouseenter和append不好用

我需要mouseenter当前div将一些文本附加到div而不是工作好有时显示有时没有这里是小提琴的例子

码:

$(document).ready(function() {

  var thmb_wrap = $('.thm-img');
  var thumb = $('.thm-img img');
  var outer = $('.mn-img');
  var full = $('.mn-img img').length;
  var sc_height = $(outer).height();


  thmb_wrap.one('mouseenter', function() {

    var cur_im = $('.thm-img img').index($(this).children('img')) + 1;
    $(this).append('<span class="numeric">' + cur_im + '/' + (full) + '</span>');

  });

  thmb_wrap.on('mouseenter', function() {
    $(this).children('.numeric').stop().fadeIn(0);
  });

  thmb_wrap.on('mouseout', function() {
    $('.numeric').stop().fadeOut(0);
  });

  $(thumb).mouseenter(function() {

    var images = $('.thm-img img'); // get images

    // move mouseover onto actual images otherwise you won't know …
Run Code Online (Sandbox Code Playgroud)

javascript jquery

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

标签 统计

jquery ×8

javascript ×5

css ×2

css-animations ×1

css3 ×1

html ×1