Skip to main content

How to use bootstrap plugin?

BOOTSTRAP EXTEND IN USING CUSTOM PLUGIN


Bootbox.js: Bootbox.js is a small JavaScript library that allows creating dialog boxes programmatically using the Bootstrap modal, without having to worry about creating, managing, or removing any required DOM elements or JS event handlers.

Example:


<!-set up the modal to start hidden and fade in and out ->

<div id="myModal" class="modal hide fade">

<!-- dialog contents -->

 <div class="modal-body">Hello world!</div>

<!-- dialog buttons -->

<div class="modal-footer">

<a href="#" class="btn primary">OK</a></div>

 </div>

 <!-- sometime later, probably inside your on load event callback -->

<script> 

$("#myModal").on("show" function() { // wire up the OK button to dismiss the modal when shown

$("#myModal a.btn").on("click", function(e){ consolelog ("button pressed"); // just as an example...

$("#myModal").modal ( "hide^ prime ); // dismiss the dialog

});

});

$("#myModal").on("hide", function() {//remove the event listeners when the dialog is dismissed 

$("#myModal a.btn").off("click"); });

 $("#my Modal") on("hidden". function() { // remove the actual elements from the DOM when fully hidden

$("#myModal").remove();

});

$("#myModal").modal({ // wire up the actual modal functionality and show the dialog

"backdrop": "static", 

"keyboard": true,

"show" true // ensure the modal is shown immediately

}); </script>

Scrollspy.js:

Scrollspy plug-in is used to automatically update navigation list links based on scroll position.


data-* attribute medium


Add the data-spy="scroll" attribute to the element in which the scrollspy will be used (most often in the <body> element). Then add the data-target attribute to the id value or the navigation bar (.navbar) class. Name must be added. It creates the scroll area connection with the navbar. The ID of the navbar's list item must be the same as the ID of the scroll area (<div id="section 1"> and <a href="#section 1").

When schooling, the optional data-offset attribute specifies how many pixels down from the top during schooling. This option is very important when it seems that the navbar's active state is changing too fast or too slow relative to the scroll element. Default value is 10 pixels.


Affix.js:

Plug-ins are used to fix an element to a specific location on the page. This is often navigation. Used for menu and social icons, so that they are fixed to a specific location on the page during page scrolling.

This plugin toggles the element's behavior based on the trueling position (Position is static in CSS). The Affix plugin basically toggles between three classes: affix, affix-top, and affix-bottom. Each class represents a specific state. You must use the position:fixed CSS property in the affix class to handle the actual position yourself.

Data-" attribute means: Add data-spy="afflix" attribute to the element to which you want to add affix and data-offset-top|bottom="number" attribute to specify the scroll position.

Example:


<!DOCTYPE html>

<html>

<head>

<title>Bootstrap Affix Example</title>

<meta charset="utf" >
<meta name="viewport"content="width=device-width, initial-scale=1">

 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> 

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 

<style>

affix{

top: 0;

width: 100%;

}

.affix + .container-fluid ( padding-top: 70px;

}

</style>

</head>

<body>

<div class="container-fluid" style="background-colour:#F44336; colour:#fff;height: 200px;"> 

<h1> Bootstrap Affix Example </h1>

<h3> Scrolling fixed (sticky) navbar </h3>

<p>data-spy="affix" results in page scrolling to see what the navbar looks like. </p>

<p><strong> The navbar will freeze on the page after scrolling a certain number of pixels. </strong></p>

</div>

<nav class="navbar navbar-inverse" data-spy="affix" data-offset-top="197" style="border-radius:0">

<ul class="nav navbar-nav">

<li class="active"><a href="#">Home page</a></li>

 <li><a href="#">Service page</a></li>

<li><a href="#">Contract page</a></li>

</ul>

</nav>

<div class="container-fluid" style="height:1000px">

<h1>This is some normal text.</h1>

<h1>This is some normal text.</h1>

<h1>This is some normal text.</h1>

<h1>This is some normal text.</h1>

<h1>This is some normal text.</h1>

<h1>This is some normal text.</h1>

<h1>This is some normal text.</h1> <h1>This is some normal text.</h1>

<h1>This is some normal text.</h1>

<h1>This is some normal text.</h1> <h1>This is some normal text.</h1>

<h1>This is some normal text.</h1>

<h1>This is some normal text.</h1>

<h1>This is some normal text.</h1>

<h1>This is some normal text.</h1>

<h1>This is some normal text.</h1>

<h1>This is some normal text.</h1>

<h1>This is some normal text.</h1>

</div>

</body>

</html>


 

 

 

Comments

Popular posts from this blog

Unlocking Online Success: Why Justoctane SEO Services are the Best Choice for Businesses in Boca Raton, Florida.

Best Justoctane SEO Services Boca Raton in Florida Are you looking for the best SEO services in Boca Raton, Florida? Look no further than Justoctane SEO services. As a leading provider of SEO services, Justoctane has helped numerous businesses in the Boca Raton area achieve top rankings on search engine results pages. In this blog post, we will explore why Justoctane is the best choice for SEO services in Boca Raton. Experience and Expertise Justoctane has a team of experienced and highly skilled SEO professionals who have a deep understanding of search engine algorithms and the latest SEO techniques. Their expertise allows them to create customized SEO strategies that are tailored to the specific needs of each client. The Justoctane team has worked with businesses in various industries and niches, providing them with a wealth of knowledge and experience to draw from when creating effective SEO strategies. Comprehensive Services Justoctane offers a wide range of SEO services, incl...

The Importance of SEO Services for Your Business: A Guide by Best SEO Company Primelis

Best SEO Company Primelis Are you looking for the best SEO company to help your business grow online? Look no further than Primelis – the leading provider of SEO services for businesses of all sizes. Why Choose Primelis? At Primelis, we understand that every business has unique needs and goals when it comes to their online presence. That's why we offer customized SEO solutions tailored to your specific needs. Our team of experts has years of experience working in the SEO industry, and we stay up-to-date with the latest trends and best practices to ensure that your website is optimized for success. We also offer a range of other digital marketing services to help your business succeed online, from PPC advertising to social media marketing and more. Our SEO Services Our SEO services are designed to help your website rank higher in search engine results pages, driving more traffic and leads to your business. Some of the SEO services we offer include: Keyword Research We'll help yo...

Which is the worst computer virus in the history of the world?

In the beginning I saw two screenshots of a computer infected with the worst virus in the history of the world. You must be surprised! These are screenshots of images from the operating system where the computer shows no signs of being infected with a virus. If the malware targets your computer's data, it will not cause you the slightest problem or difficulty in using the computer. You will feel free to use your computer and the malware will silently monitor your bank account number, debit or credit card number, your account PIN and password or personal information, photos, videos etc. The worst feature of the virus is that it will not enter your computer or mobile through the back door as a virus, but will enter your computer or mobile in the form of 'antivirus' in a friendly manner with your knowledge. Suppose you were visiting a new website on the Internet when an ad appeared on your screen saying 'Your computer or mobile may have been infected by a virus'. So pl...