Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Steve 472 posts 1216 karma points
    Jun 23, 2015 @ 20:49
    Steve
    0

    JQuery Event Handeler Placement In Razor Not Firing

    I have included a JQuery event handler for a the colorbox plugin to resize the colorbox to allow for a larger title area when my Razor pulls the images into the colorbox (lightbox), but the event never fires, and I've tried placing the code in the actual Razor and in the template for the page that will have the macro on it, but it never triggers the event. Here is my code and the page ( https://edit-wwwprep.rose-hulman.edu/admissions-financial-aid/early-planning/operation-catapult.aspx) on which it is active (click the first image on the content area to start the lightbox, that should be re-sizing with the following code.

    $(document).ready(function(){
    
        $(document).bind('cbox_complete', function(){
        var cboxTitleHeight = $('#cboxTitle').height();
        var cboxContentHeight = $('#cboxContent').height();
        var cboxWrapperHeight = $('#cboxWrapper').height();
        var colorboxHeight = $('#colorbox').height();
     var cboxPhotoHeight = $('.cboxPhoto').height();
    
        $('#cboxMiddleLeft, #cboxMiddleRight, #cboxContent').css('height', (cboxContentHeight + cboxTitleHeight) + 'px');
        $('#cboxWrapper').css('height', (cboxWrapperHeight + cboxTitleHeight) + px');
        $('#colorbox').css('height', (colorboxHeight + cboxTitleHeight) + px' );
        $('#cboxLoadedContent').css('height', (cboxTitleHeight + cboxPhotoHeight) + 'px');
          });
      });
    
  • Gerty Engrie 130 posts 490 karma points c-trib
    Jun 23, 2015 @ 21:22
    Gerty Engrie
    0

    Hmm the link is broken... care to setup a jsfiddle or something with the generated code?

  • Steve 472 posts 1216 karma points
    Jun 24, 2015 @ 12:18
    Steve
    0

    I believe I fixed the link.

  • Gerty Engrie 130 posts 490 karma points c-trib
    Jun 24, 2015 @ 12:31
    Gerty Engrie
    0

    Still not available :(

  • Steve 472 posts 1216 karma points
    Jun 24, 2015 @ 18:21
    Steve
    0

    Okay, I put the code on the live site instead of the dev, so it should be visible on this page here:

    http://www.rose-hulman.edu/admissions-financial-aid/early-planning/operation-catapult.aspx

    I put in an extra line that should be changing the color of the slide titles to a red color, but as you can see, it never fires. Please let me know if you see an error. I added the 'test' to the concatenated results, so I could see if it is working, but no, it's not) Thanks!

    $('.slideGroup').colorbox({onComplete:function(){
           $('#cboxTitle').css('color', '#800000');
       }});
    
    $('.slideGroup').colorbox({onComplete:function(){
    
    var cboxTitleHeight = $('#cboxTitle').height();
    var cboxContentHeight = $('#cboxContent').height();
    var cboxWrapperHeight = $('#cboxWrapper').height();
    var colorboxHeight = $('#colorbox').height();
    var cboxPhotoHeight = $('.cboxPhoto').height();
    
    $('#cboxMiddleLeft, #cboxMiddleRight, #cboxContent').css('height', (cboxContentHeight + cboxTitleHeight) + 'test');
    $('#cboxWrapper').css('height', (cboxWrapperHeight + cboxTitleHeight) + 'test');
    $('#colorbox').css('height', (colorboxHeight + cboxTitleHeight) + 'test' );
    $('#cboxLoadedContent').css('height', (cboxTitleHeight + cboxPhotoHeight) + 'test');
    
    
    }});
    
  • Steve 472 posts 1216 karma points
    Jun 29, 2015 @ 18:27
    Steve
    0

    Is there some place that I have to put this to work correctly? I'ts like it doesn't ever register the "onComplete" handler. Any suggestions would be helpful.

Please Sign in or register to post replies

Write your reply to:

Draft