jQuery Mobile Toolbar transition Option
Last Updated :
10 Feb, 2022
jQuery Mobile is a JavaScript library built using jQuery & is based on the user interface system designed to make responsive websites and apps that are accessible on all smartphone, tablet, and desktop devices. The jQuery toolbar is a widget that can be utilized to enhance headers and footers. These widgets are used to add toolbars to the top &/or bottom of the page.
In this article, we will be using the jQuery Mobile Toolbar transition option. It is used to set the type of transition that we want while the toolbar is hiding/showing. This transition option is facilitated by the fixed Toolbar extension & is only applicable with the fixed toolbar. The default value is "slide" & it is of string type.
.Syntax: Initializing the toolbar by specifying the transition option:
$( "Selector" ).toolbar({
transition: "none"
});
Setting & returning the transition option, after initialization:
- Get the transition option:
var transition = $( "Selector" ).toolbar( "option", "transition" );
- Set the transition option:
$( "Selector" ).toolbar( "option", "transition", "fade" );
Accepted values:
- none: The toolbar will appear and disappear without any transition.
- slide: The toolbar will slide in/out when it is toggled.
- fade: The toolbar will fade in/out when it is toggled.
CDN Links: Use the following CDN links for jQuery Mobile.
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="https://code.jquery.com/jquery-2.1.3.js"></script>
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.js"></script>
Example 1: We will set the transition option to "slide".
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content=
"width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href=
"https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="https://code.jquery.com/jquery-2.1.3.js">
</script>
<script src=
"https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.js">
</script>
<script>
$(document).ready(function () {
// Setting to "slide" by default
$("#GFG").toolbar({
transition: "slide"
});
})
</script>
</head>
<body>
<div data-role="page">
<center>
<h2 style="color: green">GeeksforGeeks</h2>
<h3>jQuery Mobile Toolbar transition option</h3>
<div id="GFG" data-role="header" data-position="fixed">
<h1>Toolbar</h1>
</div>
<h2>What is GeekforGeeks?</h2>
<p style="padding: 0px 20px;">
GeeksforGeeks is a computer science portal
for geeks by geeks. Here you can find articles
on various computer science topics like
Data Structures, Algorithms and many more....
GeekforGeeks was founded by Sandeep Jain in 2009.
GeeksforGeeks also provide courses, you can
find the courses at
<a href="https://www.geeksforgeeks.org/courses">
https://www.geeksforgeeks.org/courses
</a>
For cracking interviews of top product based companies,
you need to have good and deep understanding of topics
like DSA, System design etc. GeeksforGeeks provide you
quality content so that you can prepare for the interviews.
GeeksforGeeks also have a practice portal where you can
practice problems and brush on your skills. You can visit
the practice portal at
<a href="https://practice.geeksforgeeks.org">
https://practice.geeksforgeeks.org
</a>
</p>
</center>
</div>
</body>
</html>
Output: From the output, observe the transition of the toolbar which is set to slide & it disappears with a sliding effect in the upward direction, while on click.
Example 2: We will set the transition option to "none".
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content=
"width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href=
"https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="https://code.jquery.com/jquery-2.1.3.js">
</script>
<script src=
"https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.js">
</script>
<script>
$(document).ready(function () {
$("#GFG").toolbar({
transition: "none"
});
})
</script>
</head>
<body>
<div data-role="page">
<center>
<h2 style="color: green">GeeksforGeeks</h2>
<h3>jQuery Mobile Toolbar transition option</h3>
<div id="GFG" data-role="header" data-position="fixed">
<h1>Toolbar</h1>
</div>
<h2>What is GeekforGeeks?</h2>
<p style="padding: 0px 20px;">
GeeksforGeeks is a computer science portal
for geeks by geeks. Here you can find articles
on various computer science topics like
Data Structures, Algorithms and many more....
GeekforGeeks was founded by Sandeep Jain in 2009.
GeeksforGeeks also provide courses, you can
find the courses at
<a href="https://www.geeksforgeeks.org/courses">
https://www.geeksforgeeks.org/courses
</a>
For cracking interviews of top product based companies,
you need to have good and deep understanding of topics
like DSA, System design etc. GeeksforGeeks provide you
quality content so that you can prepare for the interviews.
GeeksforGeeks also have a practice portal where you can
practice problems and brush on your skills. You can visit
the practice portal at
<a href="https://practice.geeksforgeeks.org">
https://practice.geeksforgeeks.org
</a>
</p>
</center>
</div>
</body>
</html>
Output: From the output, observe the transition of the toolbar which is set to none & it disappears abruptly, without any transition.
Reference: https://api.jquerymobile.com/toolbar/#option-transition
Similar Reads
jQuery Mobile Popup Widget transition Option
jQuery Mobile is a web-based technology used to make responsive content that can be accessed on all smartphones, tablets, and desktops. In this article, we will be using jQuery Mobile Popup Widget transition option to set the default transition for the popup. The default value will result in no tran
1 min read
jQuery Mobile Toolbar trackPersistentToolbars Option
jQuery Mobile is a web-based technology used to make responsive content that can be accessed on all smartphones, tablets, and desktops. In this article, we will use the jQuery Mobile Toolbar trackPersistentToolbars option to persist the toolbar across pages. Syntax: Initializing the toolbar with the
1 min read
jQuery Mobile Toolbar visibleOnPageShow Option
jQuery Mobile is a web-based technology used to make responsive content that can be accessed on all smartphones, tablets, and desktops. In this article, we will use the jQuery Mobile Toolbar visibleOnPageShow option to check whether the toolbar is shown along with the page or not. Syntax: Initializi
2 min read
jQuery Mobile panel position Option
jQuery Mobile is a web-based technology used to make responsive content that can be accessed on all smartphones, tablets, and desktops. In this article, we will be using the jQuery Mobile panel position option that specifies the side of the screen the panel appears on. This option accepts two possib
2 min read
jQuery Mobile Toolbar updatePagePadding Option
jQuery Mobile is a web-based technology used to make responsive content that can be accessed on all smartphones, tablets, and desktops. In this article, we will use the jQuery Mobile Toolbar updatePagePadding option to check whether to set the page content div's top and bottom padding to the height
2 min read
jQuery Mobile Toolbar theme Option
jQuery Mobile is a web-based technology used to make responsive content that can be accessed on all smartphones, tablets, and desktops. In this article, we will use the jQuery Mobile Toolbar theme option. The Toolbar theme option is used to set the color scheme for the toolbar. It accepts a single l
2 min read
jQuery Mobile Toolbar option() Method
jQuery Mobile is an HTML5 based user interface system designed to make responsive websites and apps that are accessible on all smartphone, tablet, and desktop devices. The rangeslider widget of jQuery Mobile is a double handle slider. The sliders have a min and a max value to be set and we can choos
3 min read
jQuery Mobile Pagecontainer transition Event
jQuery Mobile is a web-based technology that can be used to make responsive content for websites that can be accessed on all types of smartphones, tablets, and desktops. Â In this article, we will be using the jQuery Mobile Pagecontainer transition Event. This event is triggered after the page chang
2 min read
jQuery Mobile Toolbar classes Option
jQuery Mobile is a web-based technology used to make responsive content that can be accessed on all smartphones, tablets, and desktops. In this article, we will use the jQuery Mobile Toolbar classes option to add additional classes to the widget's elements. Syntax: Initializing the toolbar with the
2 min read
jQuery Mobile Toolbar defaults Option
jQuery Mobile is a web-based technology used to make responsive content that can be accessed on all smartphones, tablets, and desktops. In this article, we will use the jQuery Mobile Toolbar defaults option. When the value of this option is set to true that means other widgets options have default v
2 min read