I have simple web page having html, css and jquery. Purpose of this page is to demo horizontal collapse pane.
<html>
<head>
<script type="text/javascript" src="//code.jquery.com/jquery-1.10.1.js"></script>
<title>Sample HTML</title>
<style type="text/css">
html, body {
width: 100%;
height: 100%;
}
#map {
width: 10%;
height: 100%;
float: left;
}
#sidebar {
width: 89%;
height: 100%;
float: left;
border: 1px solid;
}
#toggle {
height: 10%;
float: right;
}
</style>
<script type="text/javascript">
$(window).load(function () {//this is error line
$(document).ready(function () {
$("#toggle").click(function () {
if ($(this).data('name') == 'show') {
$("#sidebar").animate({
width: '10%'
}).hide()
$("#map").animate({
width: '89%'
});
$(this).data('name', 'hide')
} else {
$("#sidebar").animate({
width: '89%'
}).show()
$("#map").animate({
width: '10%'
});
$(this).data('name', 'show')
}
});
});
});
</script>
</head>
<body>
<div id="map">
<input type="button" data-name="show" value="Toggle" id="toggle"></div>
<div id="sidebar">SIDEBAR</div>
</body>
</html>
I used IE debugger and it hits at $(window).load(function ()
saying Object expected. I do not understand why it is not working.
Also this page is taking long time to load.