dropdown select for design test

This commit is contained in:
Jaromil 2014-05-11 19:56:08 +02:00
parent 547c493c92
commit ae4f0bf23b
2 changed files with 15 additions and 41 deletions

View File

@ -1,32 +0,0 @@
$(document).ready(function() {
function change_size(element, size) {
var current = parseInt(element.css('font-size'));
if (size == 'smaller') {
var new_size = current - 1;
} else if (size == 'bigger') {
var new_size = current + 1;
}
element.css('font-size', new_size + 'px');
}
$('#smaller').click(function() {
change_size($('p'), 'smaller');
});
$('#bigger').click(function() {
change_size($('p'), 'bigger');
});
});
function change_family(element, family) {
console.log('change font family');
element.css('font-family', family);
}

24
test
View File

@ -53,6 +53,8 @@ EOF
# start the body of article
cat <<EOF >> $dst
<p>&nbsp;</p>
<a id="menu" href="#sidr">Design test</a>
<article>
EOF
@ -66,20 +68,25 @@ cat <<EOF >> $dst
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.sidr.js"></script>
<script type="text/javascript" src="js/jquery.fontswitch.js"></script>
<a id="menu" href="#sidr">Design test</a>
<div id="sidr">
<h2>Design test</h2>
<h3>Font size</h3>
<ul>
<li><a href="#" id="smaller">smaller</a><li><a href="#" id="bigger">bigger</a></li>
<li><select id="h1size" name="size">
<option value="2">2</option>
<option value="4">4</option>
<option value="6">6</option>
</select></li>
</ul>
<h3>Font family</h3>
<ul>
<li><a href="#" id="h1courier">Courier</a></li>
</ul>
<select id="headerfamily" name="header font family">
<option value="Arial">Arial</option>
<option value="Courier">Courier</option>
</select>
</div>
<script>
@ -90,8 +97,8 @@ cat <<EOF >> $dst
displace: false
});
});
\$('#h1courier').click(function(){ change_family(\$('h1'), 'Courier'); })
\$('#h1size').change(function() { \$('h1').css('font-size', \$('#h1size').val() + "em" ); })
\$('#headerfamily').change(function(){ \$('h1').css('font-family', \$('#headerfamily').val() ); })
</script>
EOF
@ -113,4 +120,3 @@ done
mkdir -p test/js
cp $DIR/js/jquery.min.js test/js
cp $DIR/js/jquery.sidr.js test/js
cp $DIR/js/jquery.fontswitch.js test/js