jquery how to add pin to image and save the position to SQL

前端 未结 3 2202
独厮守ぢ
独厮守ぢ 2021-02-06 18:12

How can I pin an image, and save the position of my pins?

I found this plugin, but I don\'t know how to save the position of these pins.

The idea is like Google

3条回答
  •  南笙
    南笙 (楼主)
    2021-02-06 18:46

    You can get nodes information like this:

    function getNodes(){
        var nodes = [];
        $('img', $('#container')).each(function(){
            nodes.push([$(this).css('top'), $(this).css('left')]);
        });
    
        $.post('save.php', {nodes: nodes}, function(data){}, 'json');
    }
    

    Then the position of the nodes will be post to save.php.

提交回复
热议问题