English 中文(简体)
How do you make a Jquery Tab both mouseover and yet click to open the page?
原标题:

it wont let me submit more than one link, so please use your imagination, i need multiple tabs with mutliple mouse overs or images so that thing in the middle is an image

<script type="text/javascript">
$(function() {
$("#tabs").tabs({event:  mouseover }).addClass( ui-tabs-vertical ui-helper-clearfix );
$("#tabs li").removeClass( ui-corner-top ).addClass( ui-corner-right );
$( .openpage ).click(function(){
  window.location=$(this).attr( title );
    });
});
</script>

<div id="tabs">
<ul>
<li><a href="#tabs-1" title="content1.html" class="openpage">content1</a></li>
</ul>
<div id="tabs-1"><imgimg src="/images/1.jpg" alt=""></div> 
</div>
问题回答

This code is taken from jQuery Docs.

HTML code. Note that I ve added classes for tabs.

<div id="tabs">
    <ul>
        <li class="tab1"><a href="#fragment-1"><span>One</span></a></li>
        <li class="tab2"><a href="#fragment-2"><span>Two</span></a></li>
        <li class="tab3"><a href="#fragment-3"><span>Three</span></a></li>
    </ul>
    <div id="fragment-1">
        <p>First tab is active by default:</p>
        <pre><code>$( #example ).tabs();</code></pre>
    </div>
    <div id="fragment-2">
        Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
        Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
    </div>
    <div id="fragment-3">
        Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
        Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
        Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
    </div>
</div>

Now, if you want to add multiple effects on tabs, all you have to do is the following:

  $(document).ready(function(){
    $("#tabs").tabs();
    $("#tabs .tab1").click(function() { alert( hello world ); });
  }); 

I ve not tested this, but I think it should work.





相关问题
jQuery ui tabs anchoring, how to prevent it?

I ve built a tab navigation, but everytime if i try to access the a certain div using the url with the hash #, it would then anchor to the section, is there anyway to prevent it from auto-anchoring? ...

WPF TabControl add extra tabs to a bound control

I have a Tab Control with a ItemsSource Binding. ... I want to add a predefined tab to the front called All that has an aggregate of all the other tabs, and I would also like to add a button at ...

Multi-tab application (C#)

I m creating a multi-tabbed .NET application that allows the user to dynamically add and remove tabs at runtime. When a new tab is added, a control is added to it (as a child), in which the contents ...

JQuery Simplemodal and Tabs Help Needed

I ve got an asp.net page containing a Textbox with an Autocomplete extender on it. It s setup so the user can type a short reference code into the textbox and then choose from the list of matching ...

JWYSIWYG or jHtmlArea within a Jquery Ui Tab

I am not able to get my jwysiwyg and Jhtmlarea text editors to work within an AJAX loaded Jquery UI Tab Both text editors work when loaded normally. This loads the tabs on the "View Page" <...

热门标签