jquery - 如何修剪图像?

时间:2014-05-02 07:34:50

标签: javascript jquery

我想知道如何在jquery中修剪图像而不是文本。我知道如何修剪内容的唯一方法是通过.text。

<div class="portfolio-works-container"><!--portfolio-works-container-->
    <div class="portfolio-text">
         <h2>Hybrid Designs</h2>
         <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sodales id risus convallis aliquet. Sed eget felis risus. 
            Nullam nec nisi a tellus suscipit porta. Praesent odio lectus, lobortis vel iaculis eu, dignissim id quam. 
            Vestibulum non iaculis leo. Ut nec mi vitae magna aliquam consequat. Nam eget gravida nunc. 
            In eu sem dictum, pretium nisl ut, imperdiet risus. Sed pellentesque tincidunt ligula eget convallis. 
            Curabitur et odio elit. Aliquam at lacus vitae est iaculis pellentesque. Duis dignissim lobortis metus id malesuada. 
            Sed tincidunt molestie arcu, quis sollicitudin lacus laoreet ac. 
            Sed non augue magna. Quisque blandit vestibulum arcu sit amet suscipit.
        </p>
    </div>
    <div class="portfolio-img">
        <a href="#.html"><img src="graphics/hybrid-screenshoot.jpg" width="327" height="119"></a> 
    </div>

</div><!--/portfolio-works-container-->

$(function() {

    /* check all columns */
    $('.portfolio-img').each(function(){
        if ($.trim( $(this).val() ).length === 0) {
            $(this).hide();
             $(".portfolio-text").css('width','100%');
        }
    });

});

我已将其上传到jsfiddle:http://jsfiddle.net/Sf8aH/2/

0 个答案:

没有答案