0

Web サイト用の jquery タブを作成しました。タブの 1 つのコンテンツ内にいくつかのアプリケーション ボタンがあります。ボタンの 1 つ (これらのボタンには別のリンクが含まれています) をクリックすると、タブ ページから移動し、別のページでコンテンツが開きます。そうなりたくないのですが、どうすればいいですか?

4

2 に答える 2

1

追加する必要があります

$(".btn").click(function() {

// Code to run goes here...

Return False // - Stops the link from firing
}

またはjqueryを使用すると、preventDefaultを実行できます...

$(".btn").click(function(e) {

// code here...

e.preventDefault();
}
于 2011-05-05T15:19:23.757 に答える
0
<!DOCTYPE html>
<html>
<head>
<META name="WebPartPageExpansion" content="full">
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>

  <script>
  $(document).ready(function() {
    $("#frame-1").attr("src","http://www.google.com");
    $("#frame-2").attr("src","http://www.google.com");
    $("#frame-3").attr("src","http://www.google.com");
    $("#frame-4").attr("src","http://www.google.com");
    $("#tabs").tabs();
  });
  </script>
</head>
<body style="font-size:62.5%;">

<div id="tabs">
    <ul>
            <li><a href="#tabs-1">site1</a></li>
            <li><a href="#tabs-2">site2</a></li>
            <li><a href="#tabs-3">site3</a></li>
            <li><a href="#tabs-4">site4</a></li>
      </ul>
            <div id="tabs-1">
            <iframe id="frame-1" src="http://www.facebook.com" width="100%" height="500">
            <p>Your browser does not support iframes.</p> </iframe>
            </div>
    <div id="tabs-2">
            <iframe src="http://www.google.com" id="frame-2" width="100%" height="500">
            <p>Your browser does not support iframes.</p></iframe>  
    </div>
    <div id="tabs-3">
            <iframe src="url3" width="100%" id="frame-3" height="500">
            <p>Your browser does not support iframes.</p></iframe>  
    </div>
    <div id="tabs-4">
            <iframe  src="url4" id="frame-4">
            <p>Your browser does not support iframes.</p></iframe>  
    </div>



</div>
</body>
</html>
于 2011-05-05T15:39:35.713 に答える