Drag and Drop images from another website to mine

前端 未结 3 682
南旧
南旧 2020-12-14 01:12

I ran a quick google and SO search and found similar questions but none were well formed and most were old and looked abandoned (no answers, and no comments for a while). So

3条回答
  •  悲哀的现实
    2020-12-14 01:49

    You can use this

    $(document).bind('drop', function (e) {        
        var url = $(e.originalEvent.dataTransfer.getData('text/html')).filter('img').attr('src');
        if (url) {
            jQuery('', {
                src: url,
                alt: "resim"
            }).appendTo('#yourId');            
        }
        return false;
    })
    

提交回复
热议问题