如何将此功能实现到我的索引.html
How to implement this to my index.html?
我想 http://rvera.github.io/image-picker/实现此功能,并将我的互联网商店与购买商品联系起来,因此您选择项目(在图像上)并选择保存到变量,该变量表示支持付款用户想要支付给我多少钱。问题是我不知道该怎么做。我从内部链接了js,css,但在源代码中有一些文件带有咖啡和时髦等文件夹。有什么想法吗?:)我没有Javascript和jQuery的经验,我只想:)做这个功能。
这是某个文件索引.html
<html>
<head>
<link rel="stylesheet" href="css.css">
<script src="js.js"></script>
<!-- scripts for imagepicker -->
<link rel="stylesheet" href="css/image-picker.css">
<script type="text/javascript" src="js/image-picker.js"></script>
<script type="text/javascript" src="ja/image-picker.min.js"></script>
<!--code for imagepicker-->
<select multiple="multiple" class="image-picker show-html">
<option data-img-src="http://placekitten.com/220/200" value="1">Cute Kitten 1</option>
<option data-img-src="http://placekitten.com/180/200" value="2">Cute Kitten 2</option>
<option data-img-src="http://placekitten.com/130/200" value="3">Cute Kitten 3</option>
<option data-img-src="http://placekitten.com/270/200" value="4">Cute Kitten 4</option>
</select>
</head>
<body><script>
$("select").imagepicker()
</script>
<select class="image-picker show-html">
<option value=""></option>
<option data-img-src="image-path goes here" value="1">Image 1</option>
<option data-img-src="image-path goes here" value="2">Image 2</option>
</select></body>
</html>
一旦,您已经下载了文件并添加到项目中。在您的 HTML 页面上添加以下内容:
编辑:我想这应该对你有用
<html>
<head>
<!-- scripts for imagepicker -->
<link rel="stylesheet" href="css/image-picker.css">
<script type="text/javascript" src="js/image-picker.js"></script>
<script type="text/javascript" src="js/image-picker.min.js"></script>
<script type="text/javascript">
$("select").imagepicker();
</script>
</head>
<body>
<!--code for imagepicker-->
<select multiple="multiple" class="image-picker show-html">
<option data-img-src="http://placekitten.com/220/200" value="1">Cute Kitten 1</option>
<option data-img-src="http://placekitten.com/180/200" value="2">Cute Kitten 2</option>
<option data-img-src="http://placekitten.com/130/200" value="3">Cute Kitten 3</option>
<option data-img-src="http://placekitten.com/270/200" value="4">Cute Kitten 4</option>
</select>
<select class="image-picker show-html">
<option value=""></option>
<option data-img-src="image-path goes here" value="1">Image 1</option>
<option data-img-src="image-path goes here" value="2">Image 2</option>
</select>
</body>
</html>
如果您更喜欢使用咖啡文件夹,则需要先安装 CoffeeScript 才能使用此 http://rvera.github.io/image-picker/。
在 ubuntu 机器上,您可以使用以下命令
sudo npm install -g coffee-script
并且比您从此处下载的脚本 - http://rvera.github.io/image-picker/执行以下操作:
a. 创建名为"img"的文件夹和一些名称为 - 01.jpg、02.jpg、03.jpg、04.jpg 的图像。授予完全权限。
b. 创建一个文件图像选取器.html。此文件应放置在目录"图像选取器"之外,并在该文件中复制以下代码。
c. 在浏览器中运行 HTML 文件。
<link rel="stylesheet" type="text/css" href="image-picker/image-picker.css">
<script src="http://code.jquery.com/jquery-1.11.2.min.js" type="text/javascript"></script>
<script src="image-picker/image-picker.js" type="text/javascript"></script>
<div class="picker">
<select multiple="multiple" class='image-picker show-html'>
<option data-img-src='img/01.jpg' value='1'> Page 1 </option>
<option data-img-src='img/02.jpg' value='2'> Page 2 </option>
<option data-img-src='img/03.jpg' value='3'> Page 3 </option>
<option data-img-src='img/04.jpg' value='4'> Page 4 </option>
</select>
</div>
<ul class="thumbnails image_picker_selector" style="display: none">
<li><div class="thumbnail"><img class="image_picker_image" src="img/01.jpg"></div></li>
<li><div class="thumbnail"><img class="image_picker_image" src="img/02.jpg"></div></li>
<li><div class="thumbnail"><img class="image_picker_image" src="img/03.jpg"></div></li>
<li><div class="thumbnail"><img class="image_picker_image" src="img/04.jpg"></div></li>
</ul>
<script type="text/javascript">
jQuery("select.image-picker").imagepicker({
hide_select: false,
});
jQuery("select.image-picker.show-labels").imagepicker({
hide_select: false,
show_label: true,
});
jQuery("select.image-picker.limit_callback").imagepicker({
limit_reached: function(){alert('We are full!')},
hide_select: false
});
//Return total amount on click of options in drop down. considering $50 for each item
$('.image-picker').click(function(){
var amount = 0;
$('.image-picker option:selected').each(function()
{
amount = amount + 50;
});
alert("Final Amount - "+amount);
});
相关文章:
- 我想将数组的索引附加到
中,其中选择选项是数组的索引 - Javascript:我可以根据提示输入在数组中找到数字的索引吗
- 如何将此功能实现到我的索引.html
- 节点如何找到我的应用.js索引
- 构建现实世界的AngularJS应用程序,我应该如何在html中声明我的控制器.我需要在索引中声明所有.html吗?
- 我需要找到素数索引,但我的 while 循环正在退出
- 想要上传和解析 json 文本,并通过使用 ajax 单击按钮将其加载到我的索引页
- 角度.js如何告诉谷歌索引我的网站
- 在我的情况下,如何检测数组的索引
- 我可以重载JavaScript的索引运算符吗?
- 从我的索引.html中的<脚本>标签中发出 GET 请求
- 阻止 Internet Explorer 将我的索引转换为整数
- 我得到一个空白值和未定义的索引
- 为什么我的输入被插入到具有相同索引的两个diff数组中?(js)
- 我得到一个未定义的索引
- 为什么这个索引中的1+1出现在我的指令中
- 七吃九:为什么我的索引8在这个d3选择中被跳过了
- 为什么我的索引视图不工作时,我在我的rails应用程序实现日期picker
- 如何在表单提交后刷新我的索引页
- 包括头php文件到我的索引php文件-没有错误产生