Why is the lightbox jQuery plugin not working for me?

后端 未结 2 2031
忘了有多久
忘了有多久 2020-12-21 13:03

Going by the instructions both here: http://lokeshdhakar.com/projects/lightbox2/ and in the book \"Murach\'s JavaScript and jQuery\" (on pages 320 and 321), I\'m trying to a

2条回答
  •  抹茶落季
    2020-12-21 13:50

    The lightbox you're trying to implement only works with jQuery jquery-1.7.2 or below and also you don't need jquery-ui-1.9.2.min.js in order for the Lightbox to work.

    For this version of lightbox to work, you need lightbox.css, jquery-1.7.2.js and lightbox.js.

    Shown below is a sample code similar to your one where the Lightbox is working. ( Paste this code on a Text editor, save it as a HTML page and open it using your Web Browser )

    
    
        
    
         
         
         
    
    
    
    
    
    

    You can use fancybox instead of lightbox, which works with the latest jQuery versions. The latest version of Fancybox is Fancybox 2, You can download it from this Site - http://fancyapps.com/fancybox/

    Code for implementing Fancybox 2

    
    
        
         
    
        
        
        
    
        
    
    
    
    
    
    

    UPDATE #1

    You need all the files in the source folder to implement fancybox (helpers folder is optional). You need to keep the fancybox css, js and images in one location. What you can do is copy the source folder into your web app directory and rename it to fancybox. Then you can call the css file, js files from your html page. eg:

    
    
    

    enter image description here

提交回复
热议问题