HTML file size minimization / maxzoom not working

I’m making animations where geospatial polygons get re-colored. The code works great, except the file size is too large for the use case. One attempted solution is to set the max zoom. However, the arguments in the code below have NO effect the graphic (the user can still zoom all the way in or out). Any suggestions?

opts = {
‘locations’ : ‘locations’,
‘color’ : ‘color’,
‘color_discrete_sequence’ : px.colors.qualitative.T10,
‘mapbox_style’ : ‘carto-positron’,
‘opacity’ : 0.4,
‘center’ : {‘lon’: -100.05, ‘lat’: 31.0},
‘hover_data’ : {‘color’:False,
‘locations’:False,
‘cd’: True,
‘plan’: True,
‘total_pop’: True,
‘polsby_popper’: True
}
}
fig = px.choropleth_mapbox(X, geojson=X.geometry, **opts)
fig.update_geos(fitbounds=‘locations’, visible=False)
fig.update(layout_showlegend=False)
fig.update_mapboxes(layers = [{
‘maxzoom’:5,
# ‘minzoom’: 1
}
])
fig,write_html(file, auto_play=True, include_plotlyjs = ‘cdn’, full_html = False)