Pages

Showing posts with label Jquery. Show all posts
Showing posts with label Jquery. Show all posts

Monday, October 21, 2013

Return to top in page using jquery

$("html, body").animate({ scrollTop: 0 }, 200);
 
use this jquery code in onclick event. it's working like a charm. This 
is the simplest code for return to top in page. It is also working if 
you are using AJAX and calling from AJAX part.
 
If it's help you, comment it and share it.
 
 
 

Friday, October 4, 2013

jQuery not working after AJAX call


When programmer bounded the functionality of the click event even before the new content is injected to the DOM. So that functionality will not be available to the newly added (injected) dynamic content. To handle this , you need to use jQuery on

So Change your code from
$(function(){
   $(".class_name").click(function(){    
     // your code    
   });
});
to
$(function(){
    $(document).on("click",".class_name",function(){
       //your code
    });
});
jQuery on will work for current and future elements. on is avaialbe from jQuery 1.7+ onwards. If you are using a previous version of jQuery, use live

So Change code in previous version
$(".class_name").live("click",function(){

Thursday, August 18, 2011

Noconflict plugins in Joomla

SC jQuery plugin is used to load jQuery javascript library, and set "no conflict" mode to allow usage with mootools, and other libraries. No conflict mode removes the "$" operator from jQuery, allowing other libraries to use that operator. This plugin is use in joomla 1.5, joomla 1.6 and also in joomla 1.7 .

More usage details for jQuery no conflict mode are available at http://docs.jquery.com/Using_jQuery_with_Other_Libraries

For More detail and download plugin visit @ http://extensions.joomla.org/extensions/core-enhancements/scripts/7230

Wednesday, August 17, 2011

JQuery and Mootools conflicts in Joomla

Mootools and jQuery can conflict each other in joomla, when you load both in your joomla site because they can use same method names, therefore one of both could break.So when you create a nice Template for Joomla 1.5 and you decide to use jQuery, the hell breaks open when implementing:
<jdoc:include type="head" />
This, is because Joomla 1.5 uses MooTools and Caption javascript frameworks, for the backend admin panel, but also some components may require it.

So for no-conflict jQuery wrote the following lines in the top of my index.php template:



$headerstuff = $this->getHeadData();
$headerstuff['scripts'] = array();
$this->setHeadData($headerstuff);

Tuesday, July 26, 2011

jCarousel: No width/height set for items

PROBLEM: While loading, jCarousel popup alert with this error message:
"jCarousel: No width/height set for items. This will cause an infinite loop. Aborting..."
I would always get this error message every time the front page loads. I have been searching for a solution for many months and have finally found one.

SOLUTION: Not sure if this is really a solution or workaround, but it does the job of stopping the nagging popup box once and for all (while permitting jCarousel functionality).
  1. Open jquery.jcarousel.pack.js in the ../jcarousel/lib/ directory.
  2. Search for the word "alert" and you should find a snippet of code like this:
    Aborting|loop|infinite|an|cause|will|This|items|set|No|jCarousel|alert|class|
  3. Replace "alert" with "isNan":
    Aborting|loop|infinite|an|cause|will|This|items|set|No|jCarousel|isNan|class|
  4. Refresh the webpage that loads jCarousel and you should no longer get the infinite loop popup error!