mirror of
https://github.com/hanzoai/jube-fork.git
synced 2026-11-02 14:29:36 +00:00
108 lines
4.3 KiB
HTML
Executable File
108 lines
4.3 KiB
HTML
Executable File
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Attribute binding</title>
|
|
<meta charset="utf-8">
|
|
<link href="../content/shared/styles/examples-offline.css" rel="stylesheet">
|
|
<link href="../../styles/kendo.common.min.css" rel="stylesheet">
|
|
<link href="../../styles/kendo.rtl.min.css" rel="stylesheet">
|
|
<link href="../../styles/kendo.default.min.css" rel="stylesheet">
|
|
<link href="../../styles/kendo.default.mobile.min.css" rel="stylesheet">
|
|
<script src="../../js/jquery.min.js"></script>
|
|
<script src="../../js/jszip.min.js"></script>
|
|
<script src="../../js/kendo.all.min.js"></script>
|
|
<script src="../content/shared/js/console.js"></script>
|
|
<script>
|
|
|
|
</script>
|
|
|
|
|
|
</head>
|
|
<body>
|
|
|
|
<a class="offline-button" href="../index.html">Back</a>
|
|
|
|
<div id="example">
|
|
<div class="demo-section k-content">
|
|
<img data-bind="attr: { src: imageSrc, alt: imageAlt, title: imageTitle }" />
|
|
<h4 style="padding-top: 2em;">Src</h4>
|
|
<select data-text-field="name" data-value-field="url" data-bind="source: food, value: imageSrc" style="width: 100%;" ></select>
|
|
<h4 style="padding-top: 2em;">Alt</h4>
|
|
<input type="textbox" data-bind="value: imageAlt" class="k-textbox" style="width: 100%;" />
|
|
<h4 style="padding-top: 2em;">Title</h4>
|
|
<input type="textbox" data-bind="value: imageTitle" class="k-textbox" style="width: 100%;" />
|
|
</div>
|
|
<script>
|
|
$(document).ready(function() {
|
|
var viewModel = kendo.observable({
|
|
imageSrc: null,
|
|
food: [
|
|
{ name: "Mishi Kobe Niku", url: "../content/web/foods/9.jpg" },
|
|
{ name: "Chef Anton's Cajun Seasoning", url: "../content/web/foods/4.jpg" },
|
|
{ name: "Queso Manchego La Pastora", url: "../content/web/foods/12.jpg" }
|
|
],
|
|
imageAlt: "Alt attribute value",
|
|
imageTitle: "Title attribute value"
|
|
});
|
|
|
|
viewModel.imageSrc = viewModel.food[0].url;
|
|
|
|
kendo.bind($("#example"), viewModel);
|
|
});
|
|
</script>
|
|
<div class="box wide">
|
|
<img src="<span data-bind='text: imageSrc'></span>" alt="<span data-bind='text: imageAlt'></span>" title="<span data-bind='text: imageTitle'></span>" />
|
|
</div>
|
|
<div class="box wide">
|
|
<h4>View source code:</h4>
|
|
<pre class="prettyprint">
|
|
<div class="demo-section k-content">
|
|
<img data-bind="attr: { src: imageSrc, alt: imageAlt, title: imageTitle }" />
|
|
<h4 style="padding-top: 2em;">Src</h4>
|
|
<select data-text-field="name" data-value-field="url" data-bind="source: food, value: imageSrc" style="width: 100%;" ></select>
|
|
<h4 style="padding-top: 2em;">Alt</h4>
|
|
<input type="textbox" data-bind="value: imageAlt" class="k-textbox" style="width: 100%;" />
|
|
<h4 style="padding-top: 2em;">Title</h4>
|
|
<input type="textbox" data-bind="value: imageTitle" class="k-textbox" style="width: 100%;" />
|
|
</div>
|
|
</pre>
|
|
<h4 style="padding-top: 2em;">View model source code:</h4>
|
|
<pre class="prettyprint">
|
|
var viewModel = kendo.observable({
|
|
imageSrc: null,
|
|
food: [
|
|
{ name: "Mishi Kobe Niku", url: "../content/web/foods/9.jpg" },
|
|
{ name: "Chef Anton's Cajun Seasoning", url: "../content/web/foods/4.jpg" },
|
|
{ name: "Queso Manchego La Pastora", url: "../content/web/foods/12.jpg" },
|
|
],
|
|
imageAlt: "Alt attribute value",
|
|
imageTitle: "Title attribute value"
|
|
});
|
|
|
|
viewModel.imageSrc = viewModel.food[0].url;
|
|
|
|
kendo.bind($("#example"), viewModel);
|
|
</pre>
|
|
</div>
|
|
<style>
|
|
.demo-section img {
|
|
border-radius: 100px;
|
|
border: 1px solid #ccc;
|
|
display: block;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.prettyprint {
|
|
background-color: #fff;
|
|
border: 1px solid #ccc;
|
|
overflow: auto;
|
|
padding: 5px;
|
|
}
|
|
</style>
|
|
</div>
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|