Hello guys,
I need some advice about a issue I'm dealing with for the past 2 days
I trying to take a screenshot of a specific div which holds a couple of images that change every refresh.
I've managed to do that, using the following script - html2canvas (link: http://html2canvas.hertzen.com/)
Now, the script works just perfect until a specific point...
I have 2 div elements called "Tab_1" and "Tab_2", and both of them are been displayed using another .js script (for creating tabs).
Actualy, the tabs are created using the CSS-display options (the active one has "display: block;" - and the inactive one has "display: none;")
This is where the html2canvas script kinda fails....
It will take a screenshot of the images under the <div> tag which has the attribute "display: block" (the active tab) but it will not take a screenshot of the image under the <div> tag which has the attribute "display: none" (the inactive tab)
Basically this is my issue...
I want to call the function and be able to take the screenshot of both tabs (the active and the inactive)
Below is the script i'm working one:
function saveModel(usermamePic, firstPic, secondPic) {
var first_elm = document.getElementById(firstPic);
var second_elm = document.getElementById(secondPic);
html2canvas([first_elm],{
onrendered: function(canvas) {
var dataUrl_tabActive = canvas.toDataURL();
$.post('phpinclude/save.php',
{'encoded_img': ''+ dataUrl_tabActive +'',
'username_img': ''+ usermamePic +'',
'location_img': 'tabActive'
},
function(img) {
alert(img);
html2canvas([second_elm],{
onrendered: function(canvas) {
var dataUrl_tabInactive = canvas.toDataURL();
$.post('phpinclude/model_save.php',
{'encoded_img': ''+ dataUrl_tabInactive +'',
'username_img': ''+ usermamePic +'',
'location_img': 'tabInactive'
},
function(img) {
alert(img);
});
}
});
});
}
});
}
- the html2canvas.js from the webpage shown above.
Any help will be appreciated!
My best regards,
Michael