Flyout tooltips不同位置,不同效果的演示
JavaScript Code
- <script type="text/javascript">
- $(function() {
- $('#trigger_top').flyout({
- title: 'My Flyout Top',
- content: '<i>My flyout contents!</i> It works! kljsdkfljkls dfks djfkl sjdkfj skd fksdfjks d',
- html: true
- });
- $('#trigger_right').flyout({
- title: 'My Flyout Right',
- content: '<i>My flyout contents!</i> It works! kljsdkfljkls dfks djfkl sjdkfj skd fksdfjks d',
- html: true,
- placement: 'right'
- });
- $('#trigger_bottom').flyout({
- title: 'My Flyout Bottom',
- content: '<i>My flyout contents!</i> It works! kljsdkfljkls dfks djfkl sjdkfj skd fksdfjks d',
- html: true,
- placement: 'bottom'
- });
- $('#trigger_left').flyout({
- title: 'My Flyout Left',
- content: '<i>My flyout contents!</i> It works! kljsdkfljkls dfks djfkl sjdkfj skd fksdfjks d',
- html: true,
- placement: 'left'
- });
- $('#trigger_noanim').flyout({
- //title: 'My Flyout without animation',
- title: '',
- content: '<i>My flyout contents!</i> It works! kljsdkfljkls dfks djfkl sjdkfj skd fksdfjks d',
- html: true,
- animation: false
- });
- $('#trigger_dismiss').flyout({
- title: 'My Dismissible Flyout',
- content: '<i>My flyout contents!</i> It works! kljsdkfljkls dfks djfkl sjdkfj skd fksdfjks d',
- html: true,
- dismissible: true
- });
- $('#target_anchor').flyout({
- title: 'My Manual Flyout',
- content: '<i>My flyout contents!</i> It works! kljsdkfljkls dfks djfkl sjdkfj skd fksdfjks d',
- html: true,
- trigger: 'manual'
- });
- var timeHandle = null;
- $('#trigger_manual').click(function() {
- if (timeHandle) {
- clearTimeout(timeHandle);
- timeHandle = null;
- }
- $('#target_anchor').flyout('toggle');
- timeHandle = setTimeout(function() {
- $('#target_anchor').flyout('hide');
- }, 2000);
- });
- $('#target_anchor2').flyout({
- title: 'My Manual Flyout',
- content: '<i>My flyout contents!</i> It works! kljsdkfljkls dfks djfkl sjdkfj skd fksdfjks d',
- html: true,
- trigger: 'manual'
- }).mouseover(function() {
- $(this).flyout('show');
- }).mouseout(function() {
- $(this).flyout('hide');
- });
- $('#target_anchor3').flyout({
- title: function() {
- return 'My Flyout at ' + (new Date()).toString()
- },
- content: function() {
- return '<i>My flyout contents!</i> It works at ' + (new Date()).toString();
- },
- html: true,
- })
- });
- </script>
XML/HTML Code
- <div class="triggers">
- <input type="button" value="trigger top" id="trigger_top" class="trigger"/>
- <input type="button" value="trigger right" id="trigger_right" class="trigger"/>
- <input type="button" value="trigger bottom" id="trigger_bottom" class="trigger"/>
- <input type="button" value="trigger left" id="trigger_left" class="trigger"/>
- <input type="button" value="no animation and no title" id="trigger_noanim" class="trigger"/>
- <input type="button" value="dismissible" id="trigger_dismiss" class="trigger"/>
- </div>
- <div class="triggers">
- <a id="target_anchor" href="#" class="target_anchor">Sample Link 1: triggered by button</a>
- <input type="button" value="manual trigger" id="trigger_manual" class="trigger"/>
- <a id="target_anchor2" href="#" class="target_anchor">Sample Link 2: works like a tooltip</a>
- <a id="target_anchor3" href="#" class="target_anchor">Sample Link 3: dynamic title and contents</a>
- </div>
原文地址:http://www.freejs.net/article_jquerywenzi_548.html