niklasvh / feedback.js

Feedback form with screenshot
http://experiments.hertzen.com/jsfeedback/
Other
870 stars 196 forks source link

Possible to change the 'send feedback' button? #22

Open d2gibbons opened 11 years ago

d2gibbons commented 11 years ago

I would like to use feedback.js but the floating 'Send feedback' button would need to be replaced with a fixed A HREF link on the page.

The issue I have is the onClick event contains a lot of JS and I don't know how to activate it via a href without the floating button removed.

This possible?

partyz commented 11 years ago

In your Index (or footer if templated):

$(document).ready(function () {
    // initialize Feedback
    Feedback({ h2cPath: navigation.getUrl('Scripts/Feedback/html2canvas.js') });
    // change button to anchor
    $('button.feedback-btn').replaceWith('a.feedback-btn');
    // wrap in div so You could apply positioning style
    $(".feedback-btn").wrap('<div id="feedback-fixed"></div>');
});  

Now in the CSS:

feedback-fixed {

z-index: 10005;
width: _YOUR_WIDTH_ !important;
height: _YOUR_HEIGHT_ !important;
position: fixed; /\* generally you can use whatever You want _/
/_ optional other styles below e.g. */
top: 50px;
right:-6px;

}