jQuery not working inside ajax loaded div withen same page
I've been after this for days with no luck & tried questions/answeres here but couldn't figure out how to fix mine (tried changing one .live with .click in the code but no luck). This is what I have/changed in the jquery.ajaxy.js (there maybe other places in the code I need to change but when I tried, ajaxy didn't work right so I'm doing something wrong here. This code may not even be part of the solution because its the jQuery inside the ajax loaded div that doesn't work)
$.fn.preventDefaultOnClick = $.fn.preventDefaultOnClick || function(){
//original
//return $(this).click(function(event开发者_高级运维){
return $(this).live('click', function(event){
event.preventDefault();
return false;
});
};
My Test link(s) at http://eddiepotros.com/test/
Click About, the keywords DESIGNER & ONE STOP SHOP should show jquery styled tooltips but it doesn't work unless you go to the page itself http://eddiepotros.com/test/pages/about.html then it works (loading jquery there too but even if I remove it, still won't work)
Click on Portfolio, same problem. jQuery code not working on that page/div unless you go directly to it eddiepotros.com/test/pages/portfolio.php
Any suggestions please?? Just to be clear, I don't know if the code I posted is what can solve my problem. I'm just guessing but it doesn't seem like it's doing anything as per the first 2 comments here. My problem is no jQuery can be called from that ajax loaded div
I'VE BEEN TRYING THIS FOR A LONG TIME WITH NO LUCK STILL!
return this.live('click', function(event){
JQuery object is implied?
Try this:
$.fn.preventDefaultOnClick = function(){
return $(this).live('click', function(e){
e.preventDefault();
});
};
Have you tried putting the JavaScript on the about.html
$('#about a[href][title]').qtip({
content: {
text: true // Use each elements title attribute
},
hide: { /*when: 'inactive',*/ delay: 800, effect: 'fade' },
show: { effect: 'grow' },
style: 'cream'
});
at the bottom of the HTML instead of in the document.Ready section.
Revert any changes you have done before to make the the tooltip to work.
in the about.html remove the document.ready.
just put the code at the end of about.html page.
<script>
// By suppling no content attribute, the library uses each elements title attribute by default
$('#about a[href][title]').qtip({
content: {
text: true // Use each elements title attribute
},
hide: { /*when: 'inactive',*/ delay: 800, effect: 'fade' },
show: { effect: 'grow' },
style: 'cream' // cream, dark, green, light, red, blue
});
//effects such as fade, slide, grow
// NOTE: You can even omit all options and simply replace the regular title tooltips like so:
// $('#content a[href]').qtip();
</script>
It should work. Lemme know if it doesn't
精彩评论