Did you ever want to create your own jquery so that users can modify it accordingly they want.So you need to create plugins for that,That are very easy to create and manage.
Here is the simple demo code to see
<script src="Scripts/jquery-2.1.1.js"></script>
<script src="Scripts/jquery-ui.js"></script>
<script type="text/javascript">
$.fn.greenify = function (options) {
//default values
var settings = $.extend({
color: "yellow",
backgroundColor: "black",
height: "100px",
width:"100px"
}, options);
return this.css({
color: settings.color,
backgroundColor: settings.backgroundColor,
height: settings.height,
width:settings.width
})
};
$(document).ready(function () {
$("div").greenify({
});
});
</script>
<div id="one">just testing with default values
</div>
Now you can sutomize it accordingly as follow
$(document).ready(function () {
$("div").greenify({
color: "orange",
backgroundColor:"blue"
});
});
<div id="one">just testing with customized values values
</div>
Here is the simple demo code to see
<script src="Scripts/jquery-2.1.1.js"></script>
<script src="Scripts/jquery-ui.js"></script>
<script type="text/javascript">
$.fn.greenify = function (options) {
//default values
var settings = $.extend({
color: "yellow",
backgroundColor: "black",
height: "100px",
width:"100px"
}, options);
return this.css({
color: settings.color,
backgroundColor: settings.backgroundColor,
height: settings.height,
width:settings.width
})
};
$(document).ready(function () {
$("div").greenify({
});
});
</script>
<div id="one">just testing with default values
</div>
Now you can sutomize it accordingly as follow
$(document).ready(function () {
$("div").greenify({
color: "orange",
backgroundColor:"blue"
});
});
<div id="one">just testing with customized values values
</div>
DONE :)
Comments
Post a Comment