为什么imagepicker程序js中的这个功能不起作用?
Why this function in imagepicker program js doesn't work?
我对这个功能有疑问,我使用这个 http://rvera.github.io/image-picker/ 并且我想创建选项让用户在选择合适的图片后转发到合适的网站。转发有效,但图像随此代码消失。有什么想法吗?
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" href="css.css">
<script src="js.js"></script>
<!-- scripts for imagepicker -->
<link rel="stylesheet" href="image-picker.css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="image-picker.js"></script>
<script type="text/javascript" src="image-picker.min.js"></script>
<script type="text/javascript">
"use strict";
//wait for the page to be fully loaded
window.onload = function() {
initialize();
}
</script>
</head>
<body>
<!--code for imagepicker-->
<select multiple="multiple" class="image-picker show-html" id="selectImg">
<option data-img-src="http://placekitten.com/220/200" value="http://cats.com">Cute Kitten 1</option>
<option data-img-src="http://placekitten.com/180/200" value="http://dogs.com">Cute Kitten 2</option>
<option data-img-src="http://placekitten.com/130/200" value="http://dogsandcats.com">Cute Kitten 3</option>
</select>
<button href="#" id="forwardButton">Forward</button>
<script>
function initialize() {
var choice = document.getElementById("selectImg").value;
//changes destination when you set or change your choice
document.getElementById("selectImg").onchange = function() {
choice = document.getElementById("selectImg").value;
}
//when button is clicked
document.getElementById("forwardButton").onclick = function() {
if (choice !== ("" || "undefined")) {
window.location = choice;
}
}
}
</script>
</body>
</html>
我想你还没有初始化图像选择器。
来自 http://rvera.github.io/image-picker/
Then just call imagepicker on the target elements.
$("select").imagepicker()
为什么加载图像-picker.js 和同一个压缩版本的文件?
我对这个功能有疑问,我使用这个 http://rvera.github.io/image-picker/ 并且我想创建选项让用户在选择合适的图片后转发到合适的网站。转发有效,但图像随此代码消失。有什么想法吗?
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" href="css.css">
<script src="js.js"></script>
<!-- scripts for imagepicker -->
<link rel="stylesheet" href="image-picker.css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="image-picker.js"></script>
<script type="text/javascript" src="image-picker.min.js"></script>
<script type="text/javascript">
"use strict";
//wait for the page to be fully loaded
window.onload = function() {
initialize();
}
</script>
</head>
<body>
<!--code for imagepicker-->
<select multiple="multiple" class="image-picker show-html" id="selectImg">
<option data-img-src="http://placekitten.com/220/200" value="http://cats.com">Cute Kitten 1</option>
<option data-img-src="http://placekitten.com/180/200" value="http://dogs.com">Cute Kitten 2</option>
<option data-img-src="http://placekitten.com/130/200" value="http://dogsandcats.com">Cute Kitten 3</option>
</select>
<button href="#" id="forwardButton">Forward</button>
<script>
function initialize() {
var choice = document.getElementById("selectImg").value;
//changes destination when you set or change your choice
document.getElementById("selectImg").onchange = function() {
choice = document.getElementById("selectImg").value;
}
//when button is clicked
document.getElementById("forwardButton").onclick = function() {
if (choice !== ("" || "undefined")) {
window.location = choice;
}
}
}
</script>
</body>
</html>
我想你还没有初始化图像选择器。
来自 http://rvera.github.io/image-picker/
Then just call imagepicker on the target elements. $("select").imagepicker()
为什么加载图像-picker.js 和同一个压缩版本的文件?