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
});
setTimeout(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)
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
});
setTimeout(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)
Share Improve this question edited May 6, 2011 at 15:55 ade123 asked May 6, 2011 at 15:39 ade123ade123 2,8338 gold badges30 silver badges33 bronze badges 1- 1 /* */ is used to ment out multiple lines of code in JavaScript – nuffGigs Commented May 6, 2011 at 15:41
5 Answers
Reset to default 9To ment 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 mented 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 ment delimiters; those functions are mented-out and are not part of the actual usable code.
They are menting 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 e 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 menting out on the fly (especially on the net, which still transfers the data, since it's unpiled) can still have it's uses. Generally, though, you want ot use ments for english reminders.