2012-12-06 23 views
-1

我有這樣的fancybox 2,更改標題描述按alt

<a class="fancybox-effects-c" rel="gallery1" href="images/large/9.png" title="project description here >> <a href='http://www.google.com'target='_blank'>View website</a>"> <img src="images/thumbs/107.png" alt="" /></a> 

一個鏈接,但在徘徊它顯示的代碼。經過許多事情後,我決定將標題描述切換到alt字段將解決我的問題,但無法弄清楚如何做到這一點。 我假設它在jquery.fancybox.js文件中,我只需要將其切換。誰能幫忙?

更新:我發現了一個更好的解決方案,而無需移動標題描述中高音場我可以用這個代碼

var tempTitle = ""; 
$('a[title]').hover(
function(e){ 
    e.preventDefault(); 
    tempTitle = $(this).attr('title'); 

    $(this).attr('title', ''); 

     $(this).mousedown(
      function(){ 
       $(this).attr('title', tempTitle); 
      } 
     ); 
} 
, 
function() { 
    $(this).attr('title', tempTitle); 
} 
); 

就像一個魅力禁用懸停功能!

+0

我誤投關閉這個問題,認爲它與另外一個,是我不好複製。請忽略我的近距離投票。 – JFK

回答

-1

試試這個:

<a class="fancybox-effects-c" 
    rel="gallery1" href="images/large/9.png" 
    title="project description here >> <a href='http://www.google.com' target='_blank'>View website</a>"> 
<img src="images/thumbs/107.png" alt="" /> 
</a> 

有在是target之前沒有空格你title

+0

更正了一個錯字,但沒有真正回答這個問題。 – JFK

+0

謝謝!修正了錯字,alt標籤現在用於fancybox描述,但是它不再使用fancybox-effects-c?! – user1883495

0

如果有這個網站:

<a class="fancybox-effects-c" rel="gallery1" href="images/large/9.png"><img src="images/thumbs/107.png" alt="project description here &gt;&gt; <a href='http://www.google.com'target='_blank'>View website</a>" /></a> 

....哪裏通緝題注的fancybox是標記的alt屬性(縮略圖),然後使用此代碼:

$(document).ready(function() { 
    $(".fancybox-effects-c").fancybox({ 
     beforeShow: function() { 
      this.title = $(this.element).find('img').attr('alt'); 
     } 
    }); // fancybox 
}); // ready​ 

注意我用&gt;代替>避免腳本的問題。

DEMO

+0

JFK!非常感謝你,但由於某種原因,它不再使用fancybox-effects-c。它的奇怪......正如你在演示中看到的那樣,那不是效果-c,而且它也比頁面更寬。有任何想法嗎? – user1883495