Созданная функция не найдена - PullRequest
0 голосов
/ 05 мая 2010

Я пытаюсь создать простую функцию, но во время выполнения firebug говорит, что функция не существует.

Вот код функции:

<script type="text/javascript">
function load_qtip(apply_qtip_to) {
   $(apply_qtip_to).each(function(){
      $(this).qtip(
      {
         content: {
            // Set the text to an image HTML string with the correct src URL to the loading image you want to use
            text: '<img class="throbber" src="/projects/qtip/images/throbber.gif" alt="Loading..." />',
            url: $(this).attr('rel'), // Use the rel attribute of each element for the url to load
            title: {
               text: 'Nieuwsbladshop.be - ' + $(this).attr('tooltip'), // Give the tooltip a title using each elements text
               //button: 'Sluiten' // Show a close link in the title
            }
         },
         position: {
            corner: {
               target: 'bottomMiddle', // Position the tooltip above the link
               tooltip: 'topMiddle'
            },
            adjust: {
               screen: true // Keep the tooltip on-screen at all times
            }
         },
         show: { 
            when: 'mouseover', 
            solo: true // Only show one tooltip at a time
         },
         hide: 'mouseout',
         style: {
            tip: true, // Apply a speech bubble tip to the tooltip at the designated tooltip corner
            border: {
               width: 0,
               radius: 4
            },
            name: 'light', // Use the default light style
            width: 250 // Set the tooltip width
         }
      })
    }
}
</script>

И я пытаюсь назвать это здесь:

<script type="text/javascript">
// Create the tooltips only on document load
$(document).ready(function() 
{
    load_qtip('#shopcarousel a[rel]');
   // Use the each() method to gain access to each elements attributes
});
</script>

Что я делаю не так?

1 Ответ

2 голосов
/ 05 мая 2010

Вы пропускаете ), закрывая вызов each.

Изменить последнюю строку в объявлении функции на

);}

Для подобных проблем в будущем, попробуйте вставить свой код в http://www.jslint.com/

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...