如何从右到左增加输入框大小

时间:2015-06-04 13:49:26

标签: jquery

如何从右向左增加输入框大小

$('#search').live('focus', function () {

    $(this).animate({
        width: ($(this).width() + 60) + 'px'
    }, 300);

}).live('blur', function () {

    if ($(this).val() == '') {

        $(this).animate({
            width: ($(this).width() - 60) + 'px'
        }, 300);

    }

1 个答案:

答案 0 :(得分:0)

试试这个

        <div style="position:absolute; float:right; right:160px; top:-14px;">
          <input class="boxHomeFilterButton" id="searchInInstitudesButton" style="width:100px; padding-left:15px;"
     

占位符=“Hizli Ara”onfocus =“focusSearch(this);”   的onblur = “bluurSearch(本);”/&GT;               

和这个

   function focusSearch(e) {
        $('#searchInInstitudesButton').animate({
            'margin-left': '-=60px',
             width : 160,
            "opacity": "9"
        }, 200);
        //e.style.width = "115px";
        //e.style.backgroundColor = '#62b930';//'#666';
        document.getElementById('searchInInstitudesButton').removeAttribute('placeholder');
    }

    function bluurSearch(e) {
        //e.style.backgroundColor = '#528834';
        $('#searchInInstitudesButton').attr("placeholder", "Hızlı Ara");
        $('#searchInInstitudesButton').animate({
            'margin-left': '+=60px',
            width: 100,
            "opacity": "4"
        }, 200);
        $('#searchInInstitudesButton').style.opacity = "0.5";
    }