I am trying to change a data attribute of a div element base on the users screen resolution, i am using the impress.js library and i want to set the div overview that has a data attribute of scale
, the value that i want to toggle is 2.0 for desktop and 2.5 for laptop.
So far below is my code.
<div id="overview" class="step" data-x="-700" data-y="-500" data-scale="2">
</div>
My jquery code is.
$(window).resize(function() {
if(window.innerWidth == 1680){
$('#overview').data('scale', 2);
}else{
$('#overview').data('scale', 2.5);
}
})
I am able to get the value of the innerWidth but cannot get to change the value of the data attribute, Any suggestion would be great!