duanmeng1858 2013-04-08 05:29
浏览 118
已采纳

jquery点击按钮改变div形状

i am showing user uploaded image into a div. there are four buttons for square, landscape, portrait and panoramic shape of div. user can change shape of div and according to div shape image set automatically. but i did not found any jquery or anything related to shapes. i want when user will click on square button div shape change according to this and same for landscape, portrait, panoramic. i have no idea how to start this. Please help. this is code and i have attached a screenshot. in this my image is not cutting according to height and width and it aligned left in place of center when i click on square.Please see the screenshot. $("#square").click(function(){

$(".resize-div").animate({width: 341,height: 341});


}); 
  • 写回答

3条回答 默认 最新

  • dpaal28266 2013-04-08 05:34
    关注

    set height width according to your requirement

    $(document).ready(function() {
    
        $("#btnSquare").click(function(){
            $("#div").width(100).height(100);
        }); 
    
     $("#btnlandscape").click(function(){
            $("#div").width(300).height(400);
        }); 
    
     $("#btnportrait").click(function(){
            $("#div").width(400).height(300);
        }); 
    
     $("#btnpanoramic").click(function(){
            $("#div").width(100).height(100);
        }); 
    });
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 关于#java#的问题,请各位专家解答!
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?
  • ¥30 求解达问题(有红包)