jquery - make input button open fancybox -


HTML:

P>
  & lt; input id = "test" type = "image" src = "image.png" value = "url.php? आईडी = 1" & gt;  

जेएस:

  $ ('# परीक्षण')। क्लिक करें (फ़ंक्शन (मेएफएफ) {makeFB.preventDefault () ; Var fbUrl = $ (this) .attr ('value'); var thisClick = $ ('a')। Attr ('href', fbUrl); thisClick.addClass ('fancybox- बटन'); thisClick.click ( );});  

RESULT:

सक्रिय विंडो में यूआरएल खोलता है। मुझे इनपुट छवि के माध्यम से फैंसीबॉक्स पॉपअप शुरू करने की आवश्यकता है I क्या यह संभव है? & lt; a & gt;

आप & lt; a & gt; टैग।

यदि आप fancybox v2.x का प्रयोग कर रहे हैं, तो आप विशेष (एचटीएमएल 5) href और प्रकार पास कर सकते हैं > डेटा-फेंसीबॉक्स - * जैसी विशेषताएं:

  & lt; इनपुट वर्ग = "fancybox" डेटा-fancybox-type = "iframe" डेटा-fancybox-href = "url.php ? Id = 1 "प्रकार =" छवि "src =" image.png "/ & gt; & Lt; input class = "fancybox" डेटा-fancybox-type = "image" डेटा-fancybox- href = "चित्र / छवि01.jpg" प्रकार = "छवि" src = "image.png" / & gt;  

ध्यान दें कि उपरोक्त उदाहरण में दोनों बटन समान वर्ग को साझा करते हैं ताकि आप कई तत्वों के लिए एक ही स्क्रिप्ट का उपयोग कर सकें। इसके अलावा, उनमें से प्रत्येक को एक अलग प्रकार सामग्री के लिए सेट किया गया है।

फिर इस सरल जेएस कोड का उपयोग करें

  $ ("। Fancybox" )।फैंसी बॉक्स();  

देखें

Comments

Popular posts from this blog

Editing Python Class in Shell and SQLAlchemy -

ajax - Decimal('12000') is not JSON serializable -

uislider - In a MATLAB GUI, how does one implement a continuously varying slider from a GUIDE created .m file? -