-1
我想通过滚动缩放div和内部,我看到这个小提琴并试图转载它http://jsfiddle.net/SHAPE/1/,但它不工作(没有缩放)。使用jquery缩放div
这里我的HTML:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="zoom.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="zoom.js"></script>
<script type="text/javascript" src="jquery/jquery.mousewheel.js"></script>
<script type="text/javascript" src="jquery/jquery-1.8.3.min.js"></script>
</head>
<body>
<h1>Zoom</h1>
<div id="zoomContent">
<p class="col1">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<p class="col2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
</body>
我的JS:
jQuery(function($) {
$('#zoomContent')
.bind('mousewheel', function(event, delta) {
var _elm = $(this),
_increment = delta * 1.2,
_current = Number(_elm.css("font-size").split("px")[0]);
console.log(_current + _increment);
_elm.css("font-size", _current + _increment);
return false;
});
});
我的CSS:
#zoomContent{
width: 600px;
height: 300px;
font-size: 16px;
overflow: scroll;
border: 5px solid #333;
}
.col1,
.col2{
width: 10em;
padding: 0.3em;
background: red;
float: left;
}
.col2{
background: green;
}
我忘记什么?
感谢
这是它。谢谢 – Laetis