manoon
V2EX  ›  Node.js

jCrop使用记录。

  •  
  •   manoon · Jun 20, 2013 · 3936 views
    This topic created in 4725 days ago, the information mentioned may be changed or developed.
    貌似发这里不合适。也找不到合适的地方,除了自言自语以外。

    $(".imgitem div span a").click(function(){
    alert("clickme");
    var newimg=$(this).parent().parent().prev("div");
    var newimg_src=newimg.children("img").attr("src")
    alert ($("#target").attr("src"));
    $("#target").removeAttr("src");
    $("#target").attr("src",newimg_src);//这条一直上不去,郁闷得狠。


    alert( $("#target").parent().html());//原来是这样子。
    $("#target").parent().find("img").attr("src",newimg_src); //原因,找到了。所以最后这样子。

    });

    $('#target').Jcrop();
    5 replies    1970-01-01 08:00:00 +08:00
    loethen
        1
    loethen  
       Jun 20, 2013
    你想说什么。。。
    manoon
        2
    manoon  
    OP
       Jun 20, 2013
    @loethen 就是。用了jCrop以后的元素的innerhtml。其实是被jCrop修改了的。而且,修改的面目全非。
    所以,如果你想替换需要被jCrop的图片的话,需要$("#target").parent().find("img") 而不是$("#target")
    reorx
        3
    reorx  
       Jun 20, 2013 via iPad   ❤️ 1
    如果只是想做笔记,发在这里比较合适: http://www.sunp.eu.org/notes
    manoon
        4
    manoon  
    OP
       Jun 20, 2013 via Android
    @reorx

    谢谢. . . 纠结的是
    我想让以后遇到同样问题的人在google的时候能有个参考. 虽然说木有啥子技术含量.
    loethen
        5
    loethen  
       Jun 21, 2013
    这个看dom结构不就知道了么?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1354 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 23:55 · PVG 07:55 · LAX 16:55 · JFK 19:55
    ♥ Do have faith in what you're doing.