Why would you put /* around your jQuery functions?
I trying to change a website that is already up and running.
I have noticed that around the jQuery functions there is /*
Any ideas why this would be there?
See below code:
<script type="text/javascript">
/*$(document).ready(function() {
$('.slideshow').cycle({
fx: 'fade'
});
});*/
/*$(function() {
$('.slideshow img').css({
opacity: 0
});
setTi开发者_如何学Gomeout(function() {
$('#slideshow').cycle({
random: 1
//delay: 1000
});
$('.slideshow img').css({
opacity: 0
});
}, 1000);
});*/
$(function() {
$('.slideshow').cycle({
fx: 'fade',
random: 1
});
});
</script>
Just wondering whether ther is any specific reasons for doing this, Any ideas?
Thought that was the case, but just thought I'd check if it had anything to do with the fact that the site seems to use jQuery.js aswell as prototype.js
Thought it might be some strange thing to stop problems between the two, as I've had similar problems in the past. Especially when using jcycle plugin. I much prefer jQuery, but when it's somebody elses site, what can you do. :o)
To comment them out so they do not run (presumably while alternative code is tested so it can be rolled back easily).
That would be "poor man's version control" at work. The functions are probably older versions commented out to be replaced with the actual one you see at bottom.
Of course, the proper way to do that would be to just trust your VCS, and delete code you don't use. :)
Those are comment delimiters; those functions are commented-out and are not part of the actual usable code.
They are commenting out an old function?
Just so you know:
$(function() {
should be equivalent to:
$(document).ready(function(){
Sometimes I leave vestigial reminders of other ways to run code (TMTOWTDI), so in the future, if I come back to it, it might be a re-learning experience. It could then be a good approach to another problem.
It's still not a good practice, but commenting out on the fly (especially on the net, which still transfers the data, since it's uncompiled) can still have it's uses. Generally, though, you want ot use comments for english reminders.
精彩评论