Javascript / Jquery - Cropping Images
Monday, December 15th, 2008http://deepliquid.com/content/Jcrop.html
http://deepliquid.com/content/Jcrop.html
SWFObject - Standard de facto. It takes the file to embed as an input.
If you are in a different situation, you could use:
http://www.featureblend.com/javascript-flash-detection-library.html
http://jquery.lukelutman.com/plugins/flash/
http://sorgalla.com/jcarousel/
This is an example of the Structure of a file that will manage a page.
This is also a good example on how to manage dropdown boxes.
$(document).ready(
function ()
{
// shows the tags related to the selected category
function showTags()
{
var categoryValue = $('#category').val(); // the selected value of the dropdown menu
var categoryIds = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
for (var i in categoryIds)
{
if ($('#tags_' + categoryIds[i]).css('display') == 'block')
{
$('#tags_' + categoryIds[i]).slideUp('fast');
$('#tags_' + categoryIds[i]).css('display', 'none');
}
}
$('#tags_' + categoryValue).slideDown('fast');
$('#tags_' + categoryValue).css('display', 'block');
// other examples
if ( ($('#smallImage').html() == "") ) // it checkes the actual content of the div
{
var id = $('#bigImageDiv').children('span').attr('id');
}
if ($('#featured:checked').val() != null) // it checkes whether the checkbox is ticked
{
// something
}
}
// showTags must be shown both when the page is loaded
// and in the event of a change in the dropdown 'category'
showTags();
$('#category').change(function() { showTags() });
// set up tool tips
$('label').Tooltip({showURL: false, delay: 0, track: true});
return false;
});
<script type=”text/javascript”>
/* < ![CDATA[ */
// content of your Javascript goes here
/* ]]> */
</script>
/*
* It checks all the checkboxes of a certain group (that shares a name like this: checkboxes[])
*
* @param the Javascript Element that contains all the checkboxes of a certain group
*
* Example of usage:
* var checkboxesObj = document.getElementsByName(’checkboxes[]’);
* selectAllCheckboxes(checkboxesObj);
*/
function checkAllCheckboxes(checkboxesObj)
{
var checkboxesLength = checkboxesObj.length;
for(var i = 0; i < checkboxesLength; i++) {
checkboxesObj[i].checked = true;
}
}
http://sourceforge.net/projects/ie7/
http://dean.edwards.name/IE7/
<a href=”#” onClick=”if( confirm(’Are you sure?’) ) document.location=’http://www.google.it/index.php?del={$points[index].pointID}’; return false;”>delete</a>
To make it disappear (as usual):
xxxx.style.display = “none”;
To make it appear:
xxxx.style.display = “”;
The last trick is because, this:
xxxx.style.display = “table-row”;
wouldn’t work in IE6 and IE7
// Example: // var els = getElementsByClass(document, 'cool_row', '‘); // var elsLen = els.length; // for (i = 0; i < elsLen; i++) { // els[i].style.display = ""; // this // } function getElementsByClass(node, searchClass, tag) { var classElements = new Array(); var els = node.getElementsByTagName(tag); var elsLen = els.length; for (i = 0, j = 0; i < elsLen; i++) { if ( searchClass == els[i].className) { classElements[j] = els[i]; j++; } } return classElements; }