How do I save a custom HTML page?
Do you mean the position of all elements? How about iterating through them and keeping their position? If you are using jQuery you can do something like this:
var positions = new Array();
function savePositionOfAllDivs() {
$('div').each( function(){
$this = $(this);
id = $this.attr('id');
position = $this.position();
left = position.left;
top = position.top;
positions[id] = new Array();
positions[id]['left'] = left;
positions[id]['top'] = top;
}
}
And then send the array of positions to some server side script that turns it into CSS, which can then be inserted into an HTML page that the user can download.
(With more details on how you are trying to do this, it might be easier and more efficient. Let's say this is a drag and drop order function, but you need to keep the order of the div s)
source to share
Most jQuery drag and drop libraries have the ability to serialize elements that are dragged into an array that you can save. If you give me a link to the specific library you are using, I can tell you how to use it.
However, if you've done it yourself, you'll have to try one of the above suggestions.
source to share
I need the same solution looking for a port. My scenario is I am creating a drag and drop cms. Users can drag and drop html elements to create their pages. Now how can I save these changes (in db or in var) of the session and should be able to create a static page with all the above changes that the user has made using php. Can someone shed some light. I am completely new to jquery and do not consider myself a php expert.