简体   繁体   中英

How to add a PHP variable into my Jquery image slider?

I'm using a Jquery Image slider , and I want to add a couple of things to it.

When you load the full-size image, I want to show two divs, one with an image title and the other with a description of the picture but I'm new to javascript and can't work out how to do it.

I have tried adding document.write commands into the javascript code to test it, but this just outputs text on a blank page, where as I want it to appear when the image is loaded and then I can position the divs where I want them.

I would greatly appreciate some help, thanks in advance!

jQuery code:

   $("img.thumb").click(function(){
    $("#fp_gallery").append("<div/>").text("description");  
    $("#fp_gallery").prepend("<div/>").text("title");
   }

Try something like this. This is based on their demo site.

You will be much better off to use jQuery for all of that sort of thing. Look into http://api.jquery.com/category/manipulation/ for what you're after. You may also want to do a bit of research on understanding how the HTML DOM works ( http://w3schools.com/htmldom/default.asp ) to better allow you to work with jQuery and the manipulation tools therein.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM