I am working on a jQuery plug-in the will style a plug in for quotes.
Spoiler
I call it like this
The test page
(function($) {
$.fn.quoteme = function(options) {
var
defaults = {
backgroundColor : '#d0d0d0',
cornerRadius : "5px",
borderWidth : "1px",
borderStyle : "dotted",
borderColor : "black",
textColor : "black",
boxShadowColor : "gray"
},
settings = $.extend({}, defaults, options);
this.each(function(){
$(this).css({
"padding" : "3px 7px 5px 1px",
"margin" : "3px",
"font-style" : "italic",
"box-shadow" : "inset -3px -3px 8px " + settings.boxShadowColor,
"background-color" : settings.backgroundColor,
"border-radius" : settings.cornerRadius,
"border-style" : settings.borderStyle,
"border-width" : settings.borderWidth,
"border-color" : settings.borderColor,
"color" : settings.textColor
});
});
return this;
};
})(jQuery)
I call it like this
$(document).ready(function(){
$("span.quote").quoteme();
});
// or
$(document).ready(function(){
$("span.quote").quoteme({settings: "here"});
});
The test page
<!DOCTYPE html>
<html>
<head>
<title>Quote_me jQuery plug-in</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="js/jquery.min.js"></script>
<script src="js/jQuery.quoteme.js"></script>
<script>
$(document).ready(function(){
$("span.quote").quoteme();
$("span.quote.blue").quoteme({
textColor: "blue",
backgroundColor: "white"
});
$("span.quote.red").quoteme({
textColor: "red",
backgroundColor: "white",
borderColor: "red",
boxShadowColor: "#ff208c"
});
});
</script>
</head>
<body>
<div id="container" style="width:75%; margin:auto auto">
<h1>Quotes</h1>
<p>No quote</p>
<p><span class="quote">"It takes less time to do a thing right, than it does to explain why you did it wrong."</span></p>
<p><span class="quote">"Hello World!"</span> is what he said.</p>
<div>
<p>A new <span class="quote red">"DIV"</span> and <span class="quote blue">"P"</span> tag to test with</p>
</div>
</div>
</body>
</html>
My question is do you guys/gals see anything that may come and bite me later? I am interested in any thoughts you may have. Thank you for your time.
This post has been edited by laytonsdad: 03 June 2013 - 06:21 PM

New Topic/Question
Reply



MultiQuote


|