Categories: Development

CSS changing Bootstrap well or jumbotron on hover

If you have ever wanted to add CSS hover effects to a Bootstrap well or jumbotron you will have found out that .well:hover{} doesn’t work. To add effects on hover you need to use JS.

Use this example and tweak it to your liking, adding the script just inside the </body> tag.

<script>
    $(".well,.jumbotron").mouseenter(function () {
        $(this).css({'background-color': '#ff0052'})
    });
    $(".well,.jumbotron").mouseleave(function () {
        $(this).css({'background-color': '#ef0050'})
    })
</script>

Now when the mouse enters a well or jumbotron the color goes #ff0052 and will return to #ef0050 when the mouse leaves and/or is not hovering on the element.

You can also add other features  like

<script>
    $(".well,.jumbotron").mouseenter(function () {
        $(this).css({'background-color': '#ff0052', 'box-shadow': '9px 9px 7px #08080833'})
    });
    $(".well,.jumbotron").mouseleave(function () {
        $(this).css({'background-color': '#ef0050'})
    })
</script>

This will add a box shadow on hover.

Share

Recent Posts

Kennington reservoir drained drone images

A drained and empty Kennington reservoir images from a drone in early July 2024. The…

2 years ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

2 years ago

Early September spring shots

Some early September spring shots from a bushwalk, It is still too early for wildflowers.

3 years ago

Cloning an NVMe to SK Hynix Platinum P41 NVMe

I recently needed to clone over a smaller NVMe to a 2TB SK Hynix Platinum…

3 years ago

Using Laravel’s deleteDirectory to delete folders and their contents

If you ever needed a simple solution in Laravel to delete an entire directory and…

3 years ago

How to allow only 1 user to register in a Laravel application

How to enforce only one user to register or be registered in a Laravel web…

3 years ago