JScrollpane wont work after ajax

139 views
Skip to first unread message

Edgar Lizcano Sosa

unread,
Feb 23, 2012, 2:02:32 PM2/23/12
to jscrollpane
so after i load some content on my div i wanted to initialize
jscrollpane but it just wont work heres my code see if u guys can tell
me what its wrong

Ajax (jquery)

$("#mision").click(function() {
var id = this.id;
$.ajax({
url: template + "/acciones.php",
type: "POST",
data: "id=" + id,

complete: function() {

},

success: function(x) {
$("#cargaContenido").html(x).fadeIn();
$('#cargaContenido').jScrollPane();
},

error: function() {
//called when there is an error
},
});

});
it does insert the content but the scrollpane will never appear :/ any
ideas?

Deepak Bharadwaj

unread,
Nov 8, 2012, 10:21:15 AM11/8/12
to jscro...@googlegroups.com
i need exactly this....did u figure this out Edgar ?....im using this for datatables.

Edgar Lizcano Sosa

unread,
Nov 8, 2012, 12:20:46 PM11/8/12
to jscro...@googlegroups.com
Yep i did , actually this is what i did to fix this problem.

case 'Objetivos':
  var id = 'objetivos';
$("#content").load(template + '/vision.php',function(){
$("ul li").removeClass('oversubmenu')
$(".objetivos").addClass('oversubmenu');
$("#objetivos").css('color','white !important');
$(".inscripciones").css('color', '#90D3CB');
$(".inicio").css('color', '#90D3CB');
$(".programas").css('color', '#90D3CB');
$(".servicios").css('color', '#90D3CB');
$(".galeria").css('color', '#90D3CB');
$(".noticias").css('color', '#90D3CB');
$(".contacto").css('color', '#90D3CB');
$(".nosotros").css('color', '#FCF8F6');
$( '.container' ).children().show();
$("#loader").hide();
$.ajax({
 url: template + "/acciones.php",
 type: "POST",
 data: "id=" + id,
 beforeSend: function(){
 $("ul li.submenu").css("color","#2A99A1");
 },
 
 complete: function() {
   //called when complete
 },
 success: function(x) {
 $("#cargaContenido").css('display','none'); 
   $("#cargaContenido").html(x);
   $("#cargaContenido").fadeIn('1000');
    $("#scrollpro").css({'height':(($(window).height())-210)+'px'});
   $('#scrollpro').jScrollPane({
verticalDragMinHeight: 20,
verticalDragMaxHeight: 20,
horizontalDragMinWidth: 20,
horizontalDragMaxWidth: 20
});
 
   $(window).resize(function(){
         $('#scrollpro').css({'height':(($(window).height())-210)+'px'});
         $('#scrollpro').jScrollPane({
         
          autoReinitialise: true,
          verticalDragMinHeight: 20,
verticalDragMaxHeight: 20,
horizontalDragMinWidth: 20,
horizontalDragMaxWidth: 20
         
          });
    });
   
},
 error: function() {
   //called when there is an error
 },
});
hoverli()
});
break;

What i did was instead of using the existent div where i load everything. I decided to add another one on my ajax  document. Like this.

<div id="scrollpro" style="overflow:auto; width:280px;">
<div id="pruebadiv" style="width:280px">
<P class ="subtitulo">Misi&oacute;n</p>
<p class ="cuerpotexto" style="text-align:justify">Formar a futuros maquillistas profesionales adaptando sus perfiles a las necesidades de sus empleadores, expandiendo sus oportunidades de desarrollo personal, profesional y económico.<br/><br/></p> 
<p class ="cuerpotexto" style="text-align:justify">Logramos la combinación perfecta entre excelentes técnicas de maquillaje profesional y los más altos estándares de comportamiento en el ambiente laboral.<br/><br/></p> 
<p class="cuerpotexto" style="text-align:justify">"Somos un centro donde cualquier persona pueda mejorar su apariencia al aprender la teoría y práctica básica de la imagen y el maquillaje"<br/><br/></p> 
<p class="cuerpotexto" style="text-align:justify">Nägu crea un espacio de intercambio entre profesionales, empresas y estudiantes con la más alta calidad de enseñanza para contribuir al buen desempeño de la industria en México.</p>
</div>
</div>

Hope it works for you!

--
You received this message because you are subscribed to the Google Groups "jscrollpane" group.
To view this discussion on the web visit https://groups.google.com/d/msg/jscrollpane/-/1FtjCAm3gm4J.

To post to this group, send email to jscro...@googlegroups.com.
To unsubscribe from this group, send email to jscrollpane...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jscrollpane?hl=en.

Message has been deleted
Message has been deleted

Edgar Lizcano Sosa

unread,
Nov 8, 2012, 1:19:45 PM11/8/12
to jscro...@googlegroups.com
do you have a link to your website?

On Thu, Nov 8, 2012 at 11:58 AM, Deepak Bharadwaj <deepak...@gmail.com> wrote:
i have something like this 

$("#searchbutton").click( function () {  

var xyz=$("#some").val();
    $("#ProgressBar").loading();
                $("#ProgressBar").loading('Start','Searching');
               foo = $('#table').dataTable({
                
                         "bProcessing": true,
                         "bServerSide": false,
                         "bDestroy": true,
                         "bFilter":true,
                         "sScrollX": "100%",
                         "sScrollY": "100%",
                         "sAjaxSource": "xyz?"+abc,
 "sPaginationType": "input",
                         "bJQueryUI": false,  
                         
                             "fnServerData": function( sAjaxSource, aoData, fnCallback, oSettings) {  
                
                                    oSettings.jqXHR = $.ajax( {
                                    "dataType": 'json',
                                    "type": "GET",
                                    "url": sAjaxSource,
                                    "data": aoData,
                                    "success": function (json){
                                        
                                        
                                     $('.scroll-pane-arrows').jScrollPane(
                                     {
                                     showArrows: true,
                                     horizontalDragMinWidth: 20,
                                     horizontalDragMaxWidth: 35,
                                     horizontalGutter: 10
                                     }
                                     );
                                       
                                            fnCallback(json);
                                     },

where do i insert scrollpane code ? and also if i hit the search button i dont get the data again...and where do i put the reinitialise ? in my function ?

--
You received this message because you are subscribed to the Google Groups "jscrollpane" group.
To view this discussion on the web visit https://groups.google.com/d/msg/jscrollpane/-/i6TZClnYYTUJ.
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
0 new messages