javascript-ej1-demos/accordion/events.html

162 строки
8.2 KiB
HTML

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Essential JS 1: Accordion - Events</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" charset="utf-8" />
<link href="../content/bootstrap.min.css" rel="stylesheet" />
<link href="../content/ejthemes/default-theme/ej.web.all.min.css" rel="stylesheet" />
<link href="../content/default.css" rel="stylesheet" />
<link href="../content/default-responsive.css" rel="stylesheet" />
<!--[if lt IE 9]>
<script src="../scripts/jquery-1.11.3.min.js" type="text/javascript"></script>
<![endif]-->
<!--[if gte IE 9]><!-->
<script src="../scripts/jquery-3.4.1.min.js" type="text/javascript"></script>
<!--<![endif]-->
<script src="../scripts/ej.web.all.min.js" type="text/javascript"></script>
<script src="../scripts/properties.js" type="text/javascript"></script>
<script>
window.sample = { name: "" };
</script>
</head>
<body>
<div class="content-container-fluid">
<div class="row">
<div class="cols-sample-area">
<div id="eventAccordion" class="control_frame">
<h3>
<a href="#">ASP.NET</a>
</h3>
<div>
Microsoft ASP.NET is a set of technologies in the Microsoft .NET Framework for building Web applications and XML Web services. ASP.NET pages execute on the server and generate markup such as HTML, WML, or XML that is sent to a desktop or mobile browser. ASP.NET pages use a compiled, event-driven programming model that improves performance and enables the separation of application logic and user interface.
</div>
<h3>
<a href="#">ASP.NET MVC</a>
</h3>
<div>
The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller. The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating Web applications. The ASP.NET MVC framework is a lightweight, highly testable presentation framework that (as with Web Forms-based applications) is integrated with existing ASP.NET features, such as master pages and membership-based authentication.
</div>
<h3>
<a id="ajaxcontent">Javascript (Ajax Load)</a>
</h3>
<div>
</div>
</div>
</div>
<div class="cols-prop-area event-tracer">
<div>
<div class="heading">
<span>Event Trace</span>
<div class="pull-right">
<select name="selectevtprops" id="selectControls">
<option value="beforeActivate">Before Activate</option>
<option value="activate">Activate</option>
<option value="beforeInactivate">Before InActivate</option>
<option value="inActivate">InActivate</option>
<option value="ajaxBeforeLoad">Ajax Before Load</option>
<option value="ajaxLoad">Ajax Load</option>
<option value="ajaxSuccess">Ajax Success</option>
<option value="ajaxError">AjaxError</option>
</select>
</div>
</div>
<div class="prop-grid content">
<div class="eventarea">
<div class="EventLog" id="EventLog">
</div>
</div>
<div class="evtbtn">
<input type="button" class="eventclear e-btn" value="Clear" onclick="onClear()" />
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" class="jsScript">
var acrdnObj;
$(function () {
contentUrl = window.location.hash.indexOf(window.sample.name) ? "content/samplecontent/jscontent.html" : "../content/samplecontent/jscontent.html";
$("#ajaxcontent").attr("href", contentUrl);
// declaration
$("#eventAccordion").ejAccordion(
{
create: "onCreate",
beforeActivate: "onBeforeActivate",
activate: "onActivate",
beforeInactivate: "onBeforeInActivate",
inActivate: "onInActivate",
ajaxBeforeLoad: "onBeforeLoad",
ajaxLoad: "onLoad",
ajaxSuccess: "onAjaxSuccess",
ajaxError: "onError"
});
acrdnObj = $("#eventAccordion").data("ejAccordion");
$("#selectControls").ejDropDownList(
{
popupShown: "adjustpopupposition",
showCheckbox: true,
checkAll: true,
change: "evtpropscheckedevent"
});
});
// Client side Events
function onCreate(args) {
jQuery.addEventLog("Accordion has been <span class='eventTitle'>created</span>.");
}
function onBeforeActivate(args) {
if (!ej.isNullOrUndefined(args.activeIndex))
jQuery.addEventLog("<span class='eventTitle'>BeforeActiveClick</span> event is fired for Index " + args.activeIndex + ".");
}
function onActivate(args) {
if (!ej.isNullOrUndefined(args.activeIndex))
jQuery.addEventLog("<span class='eventTitle'>ActiveClick</span> event is fired for Index " + args.activeIndex + ".");
}
function onBeforeInActivate(args) {
if (!ej.isNullOrUndefined(args.inActiveIndex))
jQuery.addEventLog("Index " + args.inActiveIndex + " is on <span class='eventTitle'>BeforeInActive</span>.");
}
function onInActivate(args) {
if (!ej.isNullOrUndefined(args.inActiveIndex))
jQuery.addEventLog("Index " + args.inActiveIndex + " is on <span class='eventTitle'>inActive</span>.");
}
function onBeforeLoad(args) {
jQuery.addEventLog("<span class='eventTitle'>BeforeLoad</span> event is fired.");
}
function onLoad(args) {
jQuery.addEventLog("Ajax content is <span class='eventTitle'>loaded</span>.");
}
function onAjaxSuccess(args) {
jQuery.addEventLog("Ajax content is loaded <span class='eventTitle'>successfully</span>.");
}
function onError(args) {
jQuery.addEventLog("Ajax content is loaded with an <span class='eventTitle'>error</span>.");
}
function onClear() {
jQuery.clearEventLog();
}
// Event wire and unwire
function evtpropscheckedevent(args) {
if (args.isChecked) {
switch (args.selectedValue) {
case "create": acrdnObj.option(args.selectedValue, "onCreate"); break;
case "beforeActivate": acrdnObj.option(args.selectedValue, "onBeforeActivate"); break;
case "activate": acrdnObj.option(args.selectedValue, "onActivate"); break;
case "beforeInactivate": acrdnObj.option(args.selectedValue, "onBeforeInActivate"); break;
case "inActivate": acrdnObj.option(args.selectedValue, "onInActivate"); break;
case "ajaxBeforeLoad": acrdnObj.option(args.selectedValue, "onBeforeLoad"); break;
case "ajaxLoad": acrdnObj.option(args.selectedValue, "onLoad"); break;
case "ajaxSuccess": acrdnObj.option(args.selectedValue, "onAjaxSuccess"); break;
case "ajaxError": acrdnObj.option(args.selectedValue, "onError"); break;
}
}
else acrdnObj.option(args.selectedValue, null);
}
</script>
</body>
</html>