Skip to main content
added 434 characters in body
Source Link
Neil
  • 421
  • 3
  • 9

Okay, so a couple core things. You#Naming

You should start learningnaming your classes something a little more readable than div1 as all that tells me that it'sit's a div and programmers frequently use div.classname in CSS in order to form a more concise selectorbut nothing regarding functionality. Like, instead of div2div1 I'd use something like primary-content as my class name.

#Document.ready

$(document).ready(function(){  
  //button 1
  $("#button1").click(function(){
      $("#text1").toggle();
  });
  
  //button 2
  $("#button2").click(function(){
      $("#text2").fadeToggle();
  });
  //button 3
    $("#button3").click(function(){
      //Had to break this line into 2 so I could post this, wouldn't let me indent/space right
      $("#text3")
        .fadeIn()
        .slideUp(500)
        .slideDown(500)
        .slideUp(500)
        .slideDown(500)
        .fadeOut();
    });
});

Next, your#Indentation and trailing } and });

Your indentation seems to be a little off. This is a common thing that happens. Because of that it It is easy to fix (unless there is more than just indentation problems). I frequently Google <language name> beautifier>beautifier. What a beautifier does is formatindent your code with inhuman precision. Try a CSS beautifier. I say this because beautifying/indenting correctly can make debugging easier. I found a couple of extra tidbits that should not be there trailing }.

#CSS Selectors

It is also considered good practice to make your CSS selectors as precise as possible (without impeding your program), like instead of .primary-content, you could use div.container > div.primary-content. Where the container contains primary content. Having

Having imprecise CSS selectors can backfire. For instance, when you go to use h1 somewhere else and the page and it ends up being blue because you set h1{color:blue}. Of course, you can override that styling, but you may get a little sick of doing that after you have to manually set your tenthx-th h1's color back to default.

I'd personally try to steer away from manually setting width and height in the case of a button as your button will display wrong if you ever need to go back and modify the text. So, I'd instead use padding for what you're doing.

#coll_button {  
  border-radius: 6px;
  padding:10px 40px 10px 40px;
  margin-top: 30px;
  margin-left: 20px;
}

When I am chaining jQuery functions, I commonly use another indent for each function call. I find it to be more readable.

$("#button3").click(function(){
  $("#text3")
    .fadeIn()
    .slideUp(500)
    .slideDown(500)
    .slideUp(500)
    .slideDown(500)
    .fadeOut();
});
#text1, #text2, #text3 {
  padding: 10px 0 0 10px;
  display: none;
}

#Button formatting

I'd personally try to steer away from manually setting width and height in the case of a button because if you were to change the text at all in the future, it will not display as intended. There are cases where it's okay to set button size to the pixel but that is on a case-by-case basis. So, I'd instead use padding for what you're doing.

#coll_button {  
  border-radius: 6px;
  padding:10px 40px 10px 40px;
  margin-top: 30px;
  margin-left: 20px;
}

#jQuery indentation

When I am chaining jQuery functions, I commonly use another indent for each function call. I find it to be more readable.

$("#button3").click(function(){
  $("#text3")
    .fadeIn()
    .slideUp(500)
    .slideDown(500)
    .slideUp(500)
    .slideDown(500)
    .fadeOut();
});

Okay, so a couple core things. You should start learning your classes something a little more readable than div1 as all that tells me that it's a div and programmers frequently use div.classname in CSS in order to form a more concise selector. Like, instead of div2 I'd use something like primary-content as my class name.

Next, your indentation seems to be a little off. This is a common thing that happens. Because of that it is easy to fix (unless there is more than just indentation problems). I frequently Google <language name> beautifier>. What a beautifier does is format your code with inhuman precision. Try a CSS beautifier. I say this because beautifying/indenting correctly can make debugging easier. I found a couple of extra tidbits that should be there trailing }.

It is also considered good practice to make your CSS selectors as precise as possible, like instead of .primary-content, you could use div.container > div.primary-content. Where the container contains primary content. Having imprecise CSS selectors can backfire when you go to use h1 somewhere else and the page and it ends up being blue. Of course, you can override that, but you may get a little sick of doing that after you have to manually set your tenth h1's color back to default.

I'd personally try to steer away from manually setting width and height in the case of a button as your button will display wrong if you ever need to go back and modify the text. So, I'd instead use padding for what you're doing.

#coll_button {  
  border-radius: 6px;
  padding:10px 40px 10px 40px;
  margin-top: 30px;
  margin-left: 20px;
}

When I am chaining jQuery functions, I commonly use another indent for each function call. I find it to be more readable.

$("#button3").click(function(){
  $("#text3")
    .fadeIn()
    .slideUp(500)
    .slideDown(500)
    .slideUp(500)
    .slideDown(500)
    .fadeOut();
});
#text1, #text2, #text3 {
  padding: 10px 0 0 10px;
  display: none;
}

#Naming

You should start naming your classes something a little more readable than div1 as all that tells me that it's a div but nothing regarding functionality. Like, instead of div1 I'd use something like primary-content as my class name.

#Document.ready

$(document).ready(function(){  
  //button 1
  $("#button1").click(function(){
      $("#text1").toggle();
  });
  
  //button 2
  $("#button2").click(function(){
      $("#text2").fadeToggle();
  });
  //button 3
    $("#button3").click(function(){
      //Had to break this line into 2 so I could post this, wouldn't let me indent/space right
      $("#text3")
        .fadeIn()
        .slideUp(500)
        .slideDown(500)
        .slideUp(500)
        .slideDown(500)
        .fadeOut();
    });
});

#Indentation and trailing } and });

Your indentation seems to be a little off. This is a common thing that happens. It is easy to fix (unless there is more than just indentation problems). I frequently Google <language name> beautifier. What a beautifier does is indent your code with inhuman precision. Try a CSS beautifier. I say this because beautifying/indenting correctly can make debugging easier. I found a couple of extra tidbits that should not be there }.

#CSS Selectors

It is also considered good practice to make your CSS selectors as precise as possible (without impeding your program), like instead of .primary-content, you could use div.container > div.primary-content. Where the container contains primary content.

Having imprecise CSS selectors can backfire. For instance, when you go to use h1 somewhere else and the page and it ends up being blue because you set h1{color:blue}. Of course, you can override that styling, but you may get a little sick of doing that after you have to manually set your x-th h1's color back to default.

#text1, #text2, #text3 {
  padding: 10px 0 0 10px;
  display: none;
}

#Button formatting

I'd personally try to steer away from manually setting width and height in the case of a button because if you were to change the text at all in the future, it will not display as intended. There are cases where it's okay to set button size to the pixel but that is on a case-by-case basis. So, I'd instead use padding for what you're doing.

#coll_button {  
  border-radius: 6px;
  padding:10px 40px 10px 40px;
  margin-top: 30px;
  margin-left: 20px;
}

#jQuery indentation

When I am chaining jQuery functions, I commonly use another indent for each function call. I find it to be more readable.

$("#button3").click(function(){
  $("#text3")
    .fadeIn()
    .slideUp(500)
    .slideDown(500)
    .slideUp(500)
    .slideDown(500)
    .fadeOut();
});
added 434 characters in body
Source Link
Neil
  • 421
  • 3
  • 9

Grouping selectors can also reduce code (making it easier to error check and find what you're looking for and update all relevant elements):

This:

#text1 {
  padding-left: 10px;
  padding-top: 10px;
  display: none;
}

#text2 {
  padding-left: 10px;
  padding-top: 10px;
  display: none;
}

#text3 {
  padding-left: 10px;
  padding-top: 10px;
  display: none;
}

Should be:

#text1, #text2, #text3 {
  padding-left: 10px;
  padding-top: 10px;
  display: none;
}

But even then you could further reduce it by using padding: <top>px <right>px <bottom>px <left>px; or, for your code:

#text1, #text2, #text3 {
  padding: 10px 0 0 10px;
  display: none;
}
$(document).ready(function(){  
  //button 1
  $("#button1").click(function(){
      $("#text1").toggle();
  });
  
  //button 2
  $("#button2").click(function(){
      $("#text2").fadeToggle();
  });
  //button 3
    $("#button3").click(function(){
      //Had to break this line into 2 so I could post this, wouldn't let me indent/space right
      $("#text3")
        .fadeIn()
        .slideUp(500)
        .slideDown(500)
        .slideUp(500)
        .slideDown(500)
        .fadeOut();
    });
});
.div1 {
  background-color: #80bfff;
}

body {
  margin:0;
  padding:0;
}

.div2 {
  background-color: #ccffff;
  text-overflow: scroll;
}

.div3 {
  background-color: #80bfff;
}

.row {
  height: 200%;
}

#main {
  background-color: #3333ff;
}

#main_head {
  height: 150px;
  margin: 0;
}

#main_foot {
  height: 150px;
  background-color: #3333ff;
  padding:0;
}

h1 {
  color: black;
}

.drop1 li {
  background-color: #66ff99;
  border-color:#66ff99;
}

#coll_button {  
  border-radius: 6px;
  padding:10px 40px 10px 40px;
  margin-top: 30px;
  margin-left: 20px;
}

#text1.textContainer {
  padding-left: 10px;
  padding-top: 10px;
  display: none;
}

#text2 {
  padding-left:.textContainer 10px;
>  padding-top:h4 10px;{
  display: none;
}

#text1, #text2, #text3 {
  padding-left: 10px;
10px 0 padding-top:0 10px;
  display: none;
}

#modalbutton1 {
  height: 50px;
  margin-left: 20px;
  margin-top: 20px;
}
<!DOCTYPE html>
<html>
   <html lang="en">
      <head>
         <meta charset="utf-8">
         <meta name="viewport" content="width=device-width, initial-scale=1">
         <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
         <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css">
         <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.6/umd/popper.min.js">    </script>
         <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script>
      </head>
      <body>
         <link rel="stylesheet" href="test.css">
         <script src="test.js"></script>
         <div class="container-fluid" id="main">
            <h1 id="main_head">This is a heading</h1>
            <div class="row">
               <div class="col-sm-2 div1">
                  <div class="btn-group-vertical">
                     <h4>These buttons don't work yet because I haven't implemented anything yet</h4>
                     <button id="button1" type="button" class="btn btn-warning">Toggle text</button>
                     <button id="button2" type="button" class="btn btn-info">Fade text</button>
                     <button id="button3" type="button" class="btn btn-success">Text animation</button>
                  </div>
               </div>
               <div class="col-sm-8 div2">
                  <button data-toggle="collapse" data-target="#main_collapse" class="btn-danger coll_button" id="coll_button">Collapsible</button>
                  <div id="main_collapse" class="collapse">
                     <h3>Some pretty neat random text that just appears when you click on the collapse thing</h3>
                  </div>
                  <br>
                  <!--Start modal-->
                  <!-- Trigger the modal with a button -->
                  <button type="button" class="btn btn-info btn-lg" id="modalbutton1" data-toggle="modal" data-target="#myModal">Open Modal</button>
                  <!-- Modal -->
                  <div id="myModal" class="modal fade" role="dialog">
                     <div class="modal-dialog">
                        <!-- Modal content-->
                        <div class="modal-content">
                           <div class="modal-header">
                              <h4 class="modal-title">Modal Header</h4>
                              <button type="button" class="close" data-dismiss="modal">&times;</button>
                           </div>
                           <div class="modal-body">
                              <p>This is a modal. It's a cool way of displaying pop up text at the click of a button.</p>
                           </div>
                           <div class="modal-footer">
                              <button type="button" class="btn btn-success" data-dismiss="modal">Close</button>
                           </div>
                        </div>
                     </div>
                  </div>
                  <!--End modal-->
                  <h4 id="text1">This is some toggleable text</h4>
                  <h4 id="text2">You can fade this text in and out</h4>
                  <h4 id="text3">You can make this text slide up and down</h4>
               </div>
               <div class="col-sm-2 div3">
                  <div class="container">
                     <h4>This is a dropdown menu</h4>
                     <div class="dropdown">
                        <button class="btn btn-success dropdown-toggle" type="button" data-toggle="dropdown">Click the dropdown menu
                        <span class="caret"></span></button>
                        <ul class="dropdown-menu drop1">
                           <li><a href="#">Dropdown 1</a></li>
                           <li><a href="#">Dropdown 2</a></li>
                           <li><a href="#">Dropdown 3</a></li>
                        </ul>
                     </div>
                  </div>
               </div>
            </div>
            <div id="main_foot" class="container-fluid">
               <h1>This is a footer</h1>
            </div>
         </div>
         <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
      </body>
   </html>
$(document).ready(function(){  
  //button 1
  $("#button1").click(function(){
      $("#text1").toggle();
  });
  
  //button 2
  $("#button2").click(function(){
      $("#text2").fadeToggle();
  });
  //button 3
    $("#button3").click(function(){
      //Had to break this line into 2 so I could post this, wouldn't let me indent/space right
      $("#text3")
        .fadeIn()
        .slideUp(500)
        .slideDown(500)
        .slideUp(500)
        .slideDown(500)
        .fadeOut();
    });
});
.div1 {
  background-color: #80bfff;
}

body {
  margin:0;
  padding:0;
}

.div2 {
  background-color: #ccffff;
  text-overflow: scroll;
}

.div3 {
  background-color: #80bfff;
}

.row {
  height: 200%;
}

#main {
  background-color: #3333ff;
}

#main_head {
  height: 150px;
  margin: 0;
}

#main_foot {
  height: 150px;
  background-color: #3333ff;
  padding:0;
}

h1 {
  color: black;
}

.drop1 li {
  background-color: #66ff99;
  border-color:#66ff99;
}

#coll_button {  
  border-radius: 6px;
  padding:10px 40px 10px 40px;
  margin-top: 30px;
  margin-left: 20px;
}

#text1 {
  padding-left: 10px;
  padding-top: 10px;
  display: none;
}

#text2 {
  padding-left: 10px;
  padding-top: 10px;
  display: none;
}

#text3 {
  padding-left: 10px;
  padding-top: 10px;
  display: none;
}

#modalbutton1 {
  height: 50px;
  margin-left: 20px;
  margin-top: 20px;
}
<!DOCTYPE html>
<html>
   <html lang="en">
      <head>
         <meta charset="utf-8">
         <meta name="viewport" content="width=device-width, initial-scale=1">
         <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
         <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css">
         <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.6/umd/popper.min.js">    </script>
         <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script>
      </head>
      <body>
         <link rel="stylesheet" href="test.css">
         <script src="test.js"></script>
         <div class="container-fluid" id="main">
            <h1 id="main_head">This is a heading</h1>
            <div class="row">
               <div class="col-sm-2 div1">
                  <div class="btn-group-vertical">
                     <h4>These buttons don't work yet because I haven't implemented anything yet</h4>
                     <button id="button1" type="button" class="btn btn-warning">Toggle text</button>
                     <button id="button2" type="button" class="btn btn-info">Fade text</button>
                     <button id="button3" type="button" class="btn btn-success">Text animation</button>
                  </div>
               </div>
               <div class="col-sm-8 div2">
                  <button data-toggle="collapse" data-target="#main_collapse" class="btn-danger coll_button" id="coll_button">Collapsible</button>
                  <div id="main_collapse" class="collapse">
                     <h3>Some pretty neat random text that just appears when you click on the collapse thing</h3>
                  </div>
                  <br>
                  <!--Start modal-->
                  <!-- Trigger the modal with a button -->
                  <button type="button" class="btn btn-info btn-lg" id="modalbutton1" data-toggle="modal" data-target="#myModal">Open Modal</button>
                  <!-- Modal -->
                  <div id="myModal" class="modal fade" role="dialog">
                     <div class="modal-dialog">
                        <!-- Modal content-->
                        <div class="modal-content">
                           <div class="modal-header">
                              <h4 class="modal-title">Modal Header</h4>
                              <button type="button" class="close" data-dismiss="modal">&times;</button>
                           </div>
                           <div class="modal-body">
                              <p>This is a modal. It's a cool way of displaying pop up text at the click of a button.</p>
                           </div>
                           <div class="modal-footer">
                              <button type="button" class="btn btn-success" data-dismiss="modal">Close</button>
                           </div>
                        </div>
                     </div>
                  </div>
                  <!--End modal-->
                  <h4 id="text1">This is some toggleable text</h4>
                  <h4 id="text2">You can fade this text in and out</h4>
                  <h4 id="text3">You can make this text slide up and down</h4>
               </div>
               <div class="col-sm-2 div3">
                  <div class="container">
                     <h4>This is a dropdown menu</h4>
                     <div class="dropdown">
                        <button class="btn btn-success dropdown-toggle" type="button" data-toggle="dropdown">Click the dropdown menu
                        <span class="caret"></span></button>
                        <ul class="dropdown-menu drop1">
                           <li><a href="#">Dropdown 1</a></li>
                           <li><a href="#">Dropdown 2</a></li>
                           <li><a href="#">Dropdown 3</a></li>
                        </ul>
                     </div>
                  </div>
               </div>
            </div>
            <div id="main_foot" class="container-fluid">
               <h1>This is a footer</h1>
            </div>
         </div>
         <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
      </body>
   </html>

Grouping selectors can also reduce code (making it easier to error check and find what you're looking for and update all relevant elements):

This:

#text1 {
  padding-left: 10px;
  padding-top: 10px;
  display: none;
}

#text2 {
  padding-left: 10px;
  padding-top: 10px;
  display: none;
}

#text3 {
  padding-left: 10px;
  padding-top: 10px;
  display: none;
}

Should be:

#text1, #text2, #text3 {
  padding-left: 10px;
  padding-top: 10px;
  display: none;
}

But even then you could further reduce it by using padding: <top>px <right>px <bottom>px <left>px; or, for your code:

#text1, #text2, #text3 {
  padding: 10px 0 0 10px;
  display: none;
}
$(document).ready(function(){  
  //button 1
  $("#button1").click(function(){
      $("#text1").toggle();
  });
  
  //button 2
  $("#button2").click(function(){
      $("#text2").fadeToggle();
  });
  //button 3
    $("#button3").click(function(){
      //Had to break this line into 2 so I could post this, wouldn't let me indent/space right
      $("#text3")
        .fadeIn()
        .slideUp(500)
        .slideDown(500)
        .slideUp(500)
        .slideDown(500)
        .fadeOut();
    });
});
.div1 {
  background-color: #80bfff;
}

body {
  margin:0;
  padding:0;
}

.div2 {
  background-color: #ccffff;
  text-overflow: scroll;
}

.div3 {
  background-color: #80bfff;
}

.row {
  height: 200%;
}

#main {
  background-color: #3333ff;
}

#main_head {
  height: 150px;
  margin: 0;
}

#main_foot {
  height: 150px;
  background-color: #3333ff;
  padding:0;
}

h1 {
  color: black;
}

.drop1 li {
  background-color: #66ff99;
  border-color:#66ff99;
}

#coll_button {  
  border-radius: 6px;
  padding:10px 40px 10px 40px;
  margin-top: 30px;
  margin-left: 20px;
}

.textContainer {
  padding:10px;
}

.textContainer >  h4 {
  display:none;
}

#text1, #text2, #text3 {
  padding: 10px 0 0 10px;
  display: none;
}

#modalbutton1 {
  height: 50px;
  margin-left: 20px;
  margin-top: 20px;
}
<!DOCTYPE html>
<html>
   <html lang="en">
      <head>
         <meta charset="utf-8">
         <meta name="viewport" content="width=device-width, initial-scale=1">
         <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
         <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css">
         <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.6/umd/popper.min.js">    </script>
         <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script>
      </head>
      <body>
         <link rel="stylesheet" href="test.css">
         <script src="test.js"></script>
         <div class="container-fluid" id="main">
            <h1 id="main_head">This is a heading</h1>
            <div class="row">
               <div class="col-sm-2 div1">
                  <div class="btn-group-vertical">
                     <h4>These buttons don't work yet because I haven't implemented anything yet</h4>
                     <button id="button1" type="button" class="btn btn-warning">Toggle text</button>
                     <button id="button2" type="button" class="btn btn-info">Fade text</button>
                     <button id="button3" type="button" class="btn btn-success">Text animation</button>
                  </div>
               </div>
               <div class="col-sm-8 div2">
                  <button data-toggle="collapse" data-target="#main_collapse" class="btn-danger coll_button" id="coll_button">Collapsible</button>
                  <div id="main_collapse" class="collapse">
                     <h3>Some pretty neat random text that just appears when you click on the collapse thing</h3>
                  </div>
                  <br>
                  <!--Start modal-->
                  <!-- Trigger the modal with a button -->
                  <button type="button" class="btn btn-info btn-lg" id="modalbutton1" data-toggle="modal" data-target="#myModal">Open Modal</button>
                  <!-- Modal -->
                  <div id="myModal" class="modal fade" role="dialog">
                     <div class="modal-dialog">
                        <!-- Modal content-->
                        <div class="modal-content">
                           <div class="modal-header">
                              <h4 class="modal-title">Modal Header</h4>
                              <button type="button" class="close" data-dismiss="modal">&times;</button>
                           </div>
                           <div class="modal-body">
                              <p>This is a modal. It's a cool way of displaying pop up text at the click of a button.</p>
                           </div>
                           <div class="modal-footer">
                              <button type="button" class="btn btn-success" data-dismiss="modal">Close</button>
                           </div>
                        </div>
                     </div>
                  </div>
                  <!--End modal-->
                  <h4 id="text1">This is some toggleable text</h4>
                  <h4 id="text2">You can fade this text in and out</h4>
                  <h4 id="text3">You can make this text slide up and down</h4>
               </div>
               <div class="col-sm-2 div3">
                  <div class="container">
                     <h4>This is a dropdown menu</h4>
                     <div class="dropdown">
                        <button class="btn btn-success dropdown-toggle" type="button" data-toggle="dropdown">Click the dropdown menu
                        <span class="caret"></span></button>
                        <ul class="dropdown-menu drop1">
                           <li><a href="#">Dropdown 1</a></li>
                           <li><a href="#">Dropdown 2</a></li>
                           <li><a href="#">Dropdown 3</a></li>
                        </ul>
                     </div>
                  </div>
               </div>
            </div>
            <div id="main_foot" class="container-fluid">
               <h1>This is a footer</h1>
            </div>
         </div>
         <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
      </body>
   </html>
added 434 characters in body
Source Link
Neil
  • 421
  • 3
  • 9

I removed the following because it didn't seem to do anything (maybe it was left over from testing)You can also massively reduce repetitive class setting by using parent selectors:

$('[data-toggle="tooltip"]').tooltip();drop1 > li, drop1 {
  background-color: #66ff99;
  border-color:#66ff99;
}

Goes from:

<ul class="dropdown-menu drop1">
  <li class="drop1"><a href="#">Dropdown 1</a></li>
  <li class="drop1"><a href="#">Dropdown 2</a></li>
  <li class="drop1"><a href="#">Dropdown 3</a></li>
</ul>

To:

<ul class="dropdown-menu drop1">
   <li><a href="#">Dropdown 1</a></li>
   <li><a href="#">Dropdown 2</a></li>
   <li><a href="#">Dropdown 3</a></li>
</ul>
$(document).ready(function(){  
  //button 1
  $("#button1").click(function(){
      $("#text1").toggle();
  });
  
  //button 2
  $("#button2").click(function(){
      $("#text2").fadeToggle();
  });
  //button 3
    $("#button3").click(function(){
      //Had to break this line into 2 so I could post this, wouldn't let me indent/space right
      $("#text3")
        .fadeIn()
        .slideUp(500)
        .slideDown(500)
        .slideUp(500)
        .slideDown(500)
        .fadeOut();
    });
});
.div1 {
  background-color: #80bfff;
}

body {
  margin:0;
  padding:0;
}

.div2 {
  background-color: #ccffff;
  text-overflow: scroll;
}

.div3 {
  background-color: #80bfff;
}

.row {
  height: 200%;
}

#main {
  background-color: #3333ff;
}

#main_head {
  height: 150px;
  margin: 0;
}

#main_foot {
  height: 150px;
  background-color: #3333ff;
  padding:0;
}

h1 {
  color: black;
}

.drop1 li {
  background-color: #66ff99;
  border-color:#66ff99;
}

#coll_button {  
  border-radius: 6px;
  padding:10px 40px 10px 40px;
  margin-top: 30px;
  margin-left: 20px;
}

#text1 {
  padding-left: 10px;
  padding-top: 10px;
  display: none;
}

#text2 {
  padding-left: 10px;
  padding-top: 10px;
  display: none;
}

#text3 {
  padding-left: 10px;
  padding-top: 10px;
  display: none;
}

#modalbutton1 {
  height: 50px;
  margin-left: 20px;
  margin-top: 20px;
}
<!DOCTYPE html>
<html>
   <html lang="en">
      <head>
         <meta charset="utf-8">
         <meta name="viewport" content="width=device-width, initial-scale=1">
         <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
         <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css">
         <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.6/umd/popper.min.js">    </script>
         <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script>
      </head>
      <body>
         <link rel="stylesheet" href="test.css">
         <script src="test.js"></script>
         <div class="container-fluid" id="main">
            <h1 id="main_head">This is a heading</h1>
            <div class="row">
               <div class="col-sm-2 div1">
                  <div class="btn-group-vertical">
                     <h4>These buttons don't work yet because I haven't implemented anything yet</h4>
                     <button id="button1" type="button" class="btn btn-warning">Toggle text</button>
                     <button id="button2" type="button" class="btn btn-info">Fade text</button>
                     <button id="button3" type="button" class="btn btn-success">Text animation</button>
                  </div>
               </div>
               <div class="col-sm-8 div2">
                  <button data-toggle="collapse" data-target="#main_collapse" class="btn-danger coll_button" id="coll_button">Collapsible</button>
                  <div id="main_collapse" class="collapse">
                     <h3>Some pretty neat random text that just appears when you click on the collapse thing</h3>
                  </div>
                  <br>
                  <!--Start modal-->
                  <!-- Trigger the modal with a button -->
                  <button type="button" class="btn btn-info btn-lg" id="modalbutton1" data-toggle="modal" data-target="#myModal">Open Modal</button>
                  <!-- Modal -->
                  <div id="myModal" class="modal fade" role="dialog">
                     <div class="modal-dialog">
                        <!-- Modal content-->
                        <div class="modal-content">
                           <div class="modal-header">
                              <h4 class="modal-title">Modal Header</h4>
                              <button type="button" class="close" data-dismiss="modal">&times;</button>
                           </div>
                           <div class="modal-body">
                              <p>This is a modal. It's a cool way of displaying pop up text at the click of a button.</p>
                           </div>
                           <div class="modal-footer">
                              <button type="button" class="btn btn-success" data-dismiss="modal">Close</button>
                           </div>
                        </div>
                     </div>
                  </div>
                  <!--End modal-->
                  <h4 id="text1">This is some toggleable text</h4>
                  <h4 id="text2">You can fade this text in and out</h4>
                  <h4 id="text3">You can make this text slide up and down</h4>
               </div>
               <div class="col-sm-2 div3">
                  <div class="container">
                     <h4>This is a dropdown menu</h4>
                     <div class="dropdown">
                        <button class="btn btn-success dropdown-toggle" type="button" data-toggle="dropdown">Click the dropdown menu
                        <span class="caret"></span></button>
                        <ul class="dropdown-menu drop1">
                           <li class="drop1"><a<li><a href="#">Dropdown 1</a></li>
                           <li class="drop1"><a<li><a href="#">Dropdown 2</a></li>
                           <li class="drop1"><a<li><a href="#">Dropdown 3</a></li>
                        </ul>
                     </div>
                  </div>
               </div>
            </div>
            <div id="main_foot" class="container-fluid">
               <h1>This is a footer</h1>
            </div>
         </div>
         <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
      </body>
   </html>

I removed the following because it didn't seem to do anything (maybe it was left over from testing):

$('[data-toggle="tooltip"]').tooltip();
$(document).ready(function(){  
  //button 1
  $("#button1").click(function(){
      $("#text1").toggle();
  });
  
  //button 2
  $("#button2").click(function(){
      $("#text2").fadeToggle();
  });
  //button 3
    $("#button3").click(function(){
      //Had to break this line into 2 so I could post this, wouldn't let me indent/space right
      $("#text3")
        .fadeIn()
        .slideUp(500)
        .slideDown(500)
        .slideUp(500)
        .slideDown(500)
        .fadeOut();
    });
});
.div1 {
  background-color: #80bfff;
}

body {
  margin:0;
  padding:0;
}

.div2 {
  background-color: #ccffff;
  text-overflow: scroll;
}

.div3 {
  background-color: #80bfff;
}

.row {
  height: 200%;
}

#main {
  background-color: #3333ff;
}

#main_head {
  height: 150px;
  margin: 0;
}

#main_foot {
  height: 150px;
  background-color: #3333ff;
  padding:0;
}

h1 {
  color: black;
}

.drop1 {
  background-color: #66ff99;
}

#coll_button {  
  border-radius: 6px;
  padding:10px 40px 10px 40px;
  margin-top: 30px;
  margin-left: 20px;
}

#text1 {
  padding-left: 10px;
  padding-top: 10px;
  display: none;
}

#text2 {
  padding-left: 10px;
  padding-top: 10px;
  display: none;
}

#text3 {
  padding-left: 10px;
  padding-top: 10px;
  display: none;
}

#modalbutton1 {
  height: 50px;
  margin-left: 20px;
  margin-top: 20px;
}
<!DOCTYPE html>
<html>
   <html lang="en">
      <head>
         <meta charset="utf-8">
         <meta name="viewport" content="width=device-width, initial-scale=1">
         <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
         <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css">
         <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.6/umd/popper.min.js">    </script>
         <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script>
      </head>
      <body>
         <link rel="stylesheet" href="test.css">
         <script src="test.js"></script>
         <div class="container-fluid" id="main">
            <h1 id="main_head">This is a heading</h1>
            <div class="row">
               <div class="col-sm-2 div1">
                  <div class="btn-group-vertical">
                     <h4>These buttons don't work yet because I haven't implemented anything yet</h4>
                     <button id="button1" type="button" class="btn btn-warning">Toggle text</button>
                     <button id="button2" type="button" class="btn btn-info">Fade text</button>
                     <button id="button3" type="button" class="btn btn-success">Text animation</button>
                  </div>
               </div>
               <div class="col-sm-8 div2">
                  <button data-toggle="collapse" data-target="#main_collapse" class="btn-danger coll_button" id="coll_button">Collapsible</button>
                  <div id="main_collapse" class="collapse">
                     <h3>Some pretty neat random text that just appears when you click on the collapse thing</h3>
                  </div>
                  <br>
                  <!--Start modal-->
                  <!-- Trigger the modal with a button -->
                  <button type="button" class="btn btn-info btn-lg" id="modalbutton1" data-toggle="modal" data-target="#myModal">Open Modal</button>
                  <!-- Modal -->
                  <div id="myModal" class="modal fade" role="dialog">
                     <div class="modal-dialog">
                        <!-- Modal content-->
                        <div class="modal-content">
                           <div class="modal-header">
                              <h4 class="modal-title">Modal Header</h4>
                              <button type="button" class="close" data-dismiss="modal">&times;</button>
                           </div>
                           <div class="modal-body">
                              <p>This is a modal. It's a cool way of displaying pop up text at the click of a button.</p>
                           </div>
                           <div class="modal-footer">
                              <button type="button" class="btn btn-success" data-dismiss="modal">Close</button>
                           </div>
                        </div>
                     </div>
                  </div>
                  <!--End modal-->
                  <h4 id="text1">This is some toggleable text</h4>
                  <h4 id="text2">You can fade this text in and out</h4>
                  <h4 id="text3">You can make this text slide up and down</h4>
               </div>
               <div class="col-sm-2 div3">
                  <div class="container">
                     <h4>This is a dropdown menu</h4>
                     <div class="dropdown">
                        <button class="btn btn-success dropdown-toggle" type="button" data-toggle="dropdown">Click the dropdown menu
                        <span class="caret"></span></button>
                        <ul class="dropdown-menu drop1">
                           <li class="drop1"><a href="#">Dropdown 1</a></li>
                           <li class="drop1"><a href="#">Dropdown 2</a></li>
                           <li class="drop1"><a href="#">Dropdown 3</a></li>
                        </ul>
                     </div>
                  </div>
               </div>
            </div>
            <div id="main_foot" class="container-fluid">
               <h1>This is a footer</h1>
            </div>
         </div>
         <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
      </body>
   </html>

You can also massively reduce repetitive class setting by using parent selectors:

.drop1 > li, drop1 {
  background-color: #66ff99;
  border-color:#66ff99;
}

Goes from:

<ul class="dropdown-menu drop1">
  <li class="drop1"><a href="#">Dropdown 1</a></li>
  <li class="drop1"><a href="#">Dropdown 2</a></li>
  <li class="drop1"><a href="#">Dropdown 3</a></li>
</ul>

To:

<ul class="dropdown-menu drop1">
   <li><a href="#">Dropdown 1</a></li>
   <li><a href="#">Dropdown 2</a></li>
   <li><a href="#">Dropdown 3</a></li>
</ul>
$(document).ready(function(){  
  //button 1
  $("#button1").click(function(){
      $("#text1").toggle();
  });
  
  //button 2
  $("#button2").click(function(){
      $("#text2").fadeToggle();
  });
  //button 3
    $("#button3").click(function(){
      //Had to break this line into 2 so I could post this, wouldn't let me indent/space right
      $("#text3")
        .fadeIn()
        .slideUp(500)
        .slideDown(500)
        .slideUp(500)
        .slideDown(500)
        .fadeOut();
    });
});
.div1 {
  background-color: #80bfff;
}

body {
  margin:0;
  padding:0;
}

.div2 {
  background-color: #ccffff;
  text-overflow: scroll;
}

.div3 {
  background-color: #80bfff;
}

.row {
  height: 200%;
}

#main {
  background-color: #3333ff;
}

#main_head {
  height: 150px;
  margin: 0;
}

#main_foot {
  height: 150px;
  background-color: #3333ff;
  padding:0;
}

h1 {
  color: black;
}

.drop1 li {
  background-color: #66ff99;
  border-color:#66ff99;
}

#coll_button {  
  border-radius: 6px;
  padding:10px 40px 10px 40px;
  margin-top: 30px;
  margin-left: 20px;
}

#text1 {
  padding-left: 10px;
  padding-top: 10px;
  display: none;
}

#text2 {
  padding-left: 10px;
  padding-top: 10px;
  display: none;
}

#text3 {
  padding-left: 10px;
  padding-top: 10px;
  display: none;
}

#modalbutton1 {
  height: 50px;
  margin-left: 20px;
  margin-top: 20px;
}
<!DOCTYPE html>
<html>
   <html lang="en">
      <head>
         <meta charset="utf-8">
         <meta name="viewport" content="width=device-width, initial-scale=1">
         <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
         <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css">
         <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.6/umd/popper.min.js">    </script>
         <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script>
      </head>
      <body>
         <link rel="stylesheet" href="test.css">
         <script src="test.js"></script>
         <div class="container-fluid" id="main">
            <h1 id="main_head">This is a heading</h1>
            <div class="row">
               <div class="col-sm-2 div1">
                  <div class="btn-group-vertical">
                     <h4>These buttons don't work yet because I haven't implemented anything yet</h4>
                     <button id="button1" type="button" class="btn btn-warning">Toggle text</button>
                     <button id="button2" type="button" class="btn btn-info">Fade text</button>
                     <button id="button3" type="button" class="btn btn-success">Text animation</button>
                  </div>
               </div>
               <div class="col-sm-8 div2">
                  <button data-toggle="collapse" data-target="#main_collapse" class="btn-danger coll_button" id="coll_button">Collapsible</button>
                  <div id="main_collapse" class="collapse">
                     <h3>Some pretty neat random text that just appears when you click on the collapse thing</h3>
                  </div>
                  <br>
                  <!--Start modal-->
                  <!-- Trigger the modal with a button -->
                  <button type="button" class="btn btn-info btn-lg" id="modalbutton1" data-toggle="modal" data-target="#myModal">Open Modal</button>
                  <!-- Modal -->
                  <div id="myModal" class="modal fade" role="dialog">
                     <div class="modal-dialog">
                        <!-- Modal content-->
                        <div class="modal-content">
                           <div class="modal-header">
                              <h4 class="modal-title">Modal Header</h4>
                              <button type="button" class="close" data-dismiss="modal">&times;</button>
                           </div>
                           <div class="modal-body">
                              <p>This is a modal. It's a cool way of displaying pop up text at the click of a button.</p>
                           </div>
                           <div class="modal-footer">
                              <button type="button" class="btn btn-success" data-dismiss="modal">Close</button>
                           </div>
                        </div>
                     </div>
                  </div>
                  <!--End modal-->
                  <h4 id="text1">This is some toggleable text</h4>
                  <h4 id="text2">You can fade this text in and out</h4>
                  <h4 id="text3">You can make this text slide up and down</h4>
               </div>
               <div class="col-sm-2 div3">
                  <div class="container">
                     <h4>This is a dropdown menu</h4>
                     <div class="dropdown">
                        <button class="btn btn-success dropdown-toggle" type="button" data-toggle="dropdown">Click the dropdown menu
                        <span class="caret"></span></button>
                        <ul class="dropdown-menu drop1">
                           <li><a href="#">Dropdown 1</a></li>
                           <li><a href="#">Dropdown 2</a></li>
                           <li><a href="#">Dropdown 3</a></li>
                        </ul>
                     </div>
                  </div>
               </div>
            </div>
            <div id="main_foot" class="container-fluid">
               <h1>This is a footer</h1>
            </div>
         </div>
         <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
      </body>
   </html>
added 434 characters in body
Source Link
Neil
  • 421
  • 3
  • 9
Loading
added 434 characters in body
Source Link
Neil
  • 421
  • 3
  • 9
Loading
Post Undeleted by Neil
added 434 characters in body
Source Link
Neil
  • 421
  • 3
  • 9
Loading
Post Deleted by Neil
added 434 characters in body
Source Link
Neil
  • 421
  • 3
  • 9
Loading
Source Link
Neil
  • 421
  • 3
  • 9
Loading